Repository navigation
test: restore diagnostic mocks and reset trace state - #2354
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
jatmn
left a comment
There was a problem hiding this comment.
— jatmn's PR Review agent
Merge readiness
- Draft PR: GitHub still marks this pull request as a draft (
mergeable_state: blockeduntil marked ready). - Live
maindrift:behind_default_countis 1 (live base40297b49792f4b4cbde34d9b3b08d56fcf0e92c4vs three-dot merge-base7141ba29f3b85769491da65ab42567a1cee1d1d1). Rebase onto currentmainbefore merge so CI and serial-order fixes run on the latest tree. - Merge-base decision:
live-base-three-dotreviewing7141ba29..09bdb3c8(single commit09bdb3c8). - Required CI on head
09bdb3c87f344d0a4cf166e2e80218045532b0be: all completed check runs success (includingunit-tests (1–8),typecheck,smoke-and-tests,dedicated-tests,CodeQL,CodeQL (javascript-typescript),pr-intent-scan). CodeRabbit commit status success (“Review completed”). - Validation I ran (review-owned checkout,
TMPDIRunder runruntime/tmp):- Serial command (single process, no shards):
bun run scripts/run-tests.ts --randomize --seed=<seed> --max-concurrency=1 --feature=UNATTENDED_RETRY. - On merge-base
7141ba29: seed 101 exit 0; seed 4242 exit 1 (4 failures); seed 2027 exit 1 (76 failures). - On head
09bdb3c8(same command,--shard-timeout-ms=1200000): seed 101 exit 0; seed 4242 exit 1 (4 failures —getAgentModel provider-aware fallbackhaiku alias cases, not the three files in this diff); seed 2027 exit 1 (76 failures). - Targeted repro on merge-base:
bun test --max-concurrency=1onLSPDiagnosticRegistry.test.ts→attachments.lspDiagnostics.test.ts→context.test.ts→ 1 fail (unknown openai-compatible model fallback logs one debug warning and no console errors); same chain on head → 0 fail. - CI shard command (3× each, shards 1 and 4 per author):
bun run scripts/run-tests.ts --shards=8 --shard-index=<K> --feature=UNATTENDED_RETRY --max-concurrency=1→ 9/9 exit 0, no exit 132. (Workflow does not pass--isolate; CI isolates via per-shard child processes inrun-tests.ts.) - PR testing bullets vs full serial: the body claims seeds 4242 and 2027 are clean on head; full serial runs above still fail with the same failure counts as merge-base for those seeds. The in-scope leak class this PR targets is verified via the targeted chain and seed 101; consider narrowing the PR testing section so it does not claim whole-serial cleanliness for seeds that still surface unrelated order-dependent failures.
- Serial command (single process, no shards):
🟢 Thanks for the contribution. I do not see any actionable issues from my review.
Summary
Fixes order-dependent failures seen in the serial single-process run (
bun run scripts/run-tests.ts --randomize --seed=101 --max-concurrency=1, no shards). Each test passed alone.src/utils/context.test.ts) and "suspicious terminal columns can be flagged again after returning to normal width":LSPDiagnosticRegistry.test.tsandattachments.lspDiagnostics.test.tsmockeddebug.js(andslowOperations.js/LSPDiagnosticRegistry.js) without restoring them. Later files' spies inherited the earlier warning calls.mock.moduleand restore them inafterAll.slowOperations.jskeeps its real exports and overrides onlyjsonStringify.teammateViewHelpers.interruptionTrace.test.ts):claude.lifecycle.test.tsmade the test pick up an olderclaude_stream_cleanupabort.beforeEachand usessnapshotEnv, the same pattern as test: reset teammate interruption trace state #2350.claude.lifecycle.test.tsis not touched, because resetting in its ownafterEach/afterAllcrashes Bun under--isolate.CustomSelectstub. I confirmed it reproduces without that restore, so this PR makes no change for it.attachments.lspDiagnostics.test.tsnow also usessnapshotEnvfor its env handling.Impact
Testing
bun run build,bun run check,bun run typecheck,bun run typecheck:type-tests,bun run lint(0 errors) andbun run security:pr-scanpass;git statusclean.bun run scripts/run-tests.ts --randomize --seed=<S> --max-concurrency=1(no shards, no--featureflags) for seeds 101, 4242 and 2027: no failures. This claim covers only that command.--isolatecommands for the touched shards (1 and 4): pass, with no crash.Notes
--feature=UNATTENDED_RETRYstill has order-dependent failures (for example seeds 4242 and 2027). They also occur on main, are not caused or fixed by this PR, and are being fixed in a separate PR.Summary by CodeRabbit