refactor(settings): route SettingsDefaults diagnostics through emitDiagnostic#2981
Closed
darion-yaphet wants to merge 1 commit into
Closed
refactor(settings): route SettingsDefaults diagnostics through emitDiagnostic#2981darion-yaphet wants to merge 1 commit into
darion-yaphet wants to merge 1 commit into
Conversation
SettingsDefaultsManager used raw console.warn for its [SETTINGS] diagnostics. Replace with emitDiagnostic (hook-io) so the lines survive the Phase 2 hook stderr buffer (thedotmack#2292) — the same channel logger uses — instead of being swallowed by raw console. Keeps the deliberate stderr-not-stdout behavior that protects the machine-readable JSON contract on stdout. emitDiagnostic is chosen over logger because logger transitively depends on this module via shared/paths, so importing logger here would invert layering and risk a circular dependency at bootstrap. hook-io is a leaf module (type-only import), so no cycle.
Contributor
thedotmack
pushed a commit
that referenced
this pull request
Jul 5, 2026
Preserves PR #2981 by darion-yaphet.
Owner
|
Merged into the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SettingsDefaultsManageris a base-layer library module (runs under the worker daemon and hooks) that emitted its[SETTINGS]diagnostics via rawconsole.warn. Those lines can be swallowed by the Phase 2 hook stderr buffer (#2292).Replace the 5
console.warncalls withemitDiagnostic(fromhook-io):No stderr outputoncerecordWorkerUnreachablethreshold trips #2292) — the same channelloggeritself uses, instead of being swallowed by raw console.startpromise JSON on stdout to the hook framework).Why
emitDiagnostic, notloggerloggertransitively depends on this module (logger → shared/paths → SettingsDefaultsManager). Importingloggerhere would invert the layering and risk a circular dependency at bootstrap.hook-iois a leaf module (type-only import), so there is no cycle.Scope note
This was scoped deliberately. Of 546
console.*calls insrc/, the vast majority are correct and intentionally left as-is:worker-service.ts/ServerBetaService.ts— CLI entrypoints;console.log(JSON.stringify(...))is the program's stdout output contract. Routing to the file logger would silence the CLI.npx-cli/**,*Installer.ts,bin/**— user-facing CLI / install-time output.ui/viewer/**— browser React code; the Node file-based logger cannot run there.utils/logger.ts,shared/hook-io.ts— the logger's own stderr fallback.Verification
tsc --noEmitcleannpm run buildgreenbun test— 39 pass / 0 fail (incl.settings-defaults-manager.test.tsandlogger-usage-standards.test.ts)[SETTINGS]diagnostics confirmed still printing to stderr in test output