Skip to content

fix(server): make debug-path startup receipt durable so logger.separation tests never time out on it - #674

Merged
danshapiro merged 9 commits into
mainfrom
the-usual/logger-separation-flake
Aug 22, 2026
Merged

fix(server): make debug-path startup receipt durable so logger.separation tests never time out on it#674
danshapiro merged 9 commits into
mainfrom
the-usual/logger-separation-flake

Conversation

@danshapiro

Copy link
Copy Markdown
Owner

Problem

test/integration/server/logger.separation.test.ts flaked on the cloud backend with a 30s timeout waiting for the Resolved debug log path marker line. Root cause: the marker was routed through pino's multistream into rotating-file-stream, which opens the file lazily and buffers writes — a short-lived probe process exiting before the async open completed silently discarded the line, so no file-content wait could ever see it. (The earlier 5s→30s wait widening on main only changed how long we wait for a line that was never written.)

Verified empirically: the immediate-exit probe (import logger then process.exit(0)) loses the marker 20/20 at the base commit.

Fix

In server/logger.ts, the one-time resolved-path receipt is now appended synchronously (fs.appendFileSync) during createLogger(), gated on isLevelEnabled('info') to preserve the exact prior suppression semantics, with an identical JSON shape (byte-compatible with what the tests parse; no pid/hostname). The rotating stream continues to handle the ongoing verbose flow unchanged. A narrow try/catch degrades a marker write failure to a diagnostic warning instead of crashing startup.

Tests

  • 2 new unit tests pin the receipt's exact shape (incl. env/version presence/omission) and LOG_LEVEL=warn suppression.
  • 1 new integration test proves a process that exits immediately after import still leaves the receipt (and exits 0).
  • The separation tests (concurrent/dist-source/explicit-instance) now also assert a stream-routed, per-instance proof line in each file — with cross-contamination negatives re-read after both positive waits — so they still prove each process writes through its own rotating stream into its own file (independent review caught that the out-of-band marker alone had silently removed that coverage).

Verification

  • Full suite on the cloud backend (the flake's venue) green at HEAD: all shards passed, target file 6/6 inside the full-suite cloud run; electron 350/350 locally.
  • Development ran through the complete the-usual workflow: load-bearing validation (4/4 verified, incl. empirical 20/20 marker-loss at base), independent plan review (2 rounds), task + whole-branch reviews (APPROVED), independent delta review (2 rounds, final PASSED) with a focused repair episode (2 rounds PASSED).

Fixes the flake without touching any wait durations.

@danshapiro
danshapiro merged commit c79a58b into main Aug 22, 2026
3 checks passed
danshapiro added a commit that referenced this pull request Aug 22, 2026
…utput on content-wait timeouts (kata ep0f; re-applied onto #674's durable-receipt version)
danshapiro added a commit that referenced this pull request Aug 22, 2026
…l durable receipt); branch rebased onto it
@danshapiro
danshapiro deleted the the-usual/logger-separation-flake branch August 23, 2026 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant