Repository navigation
perf(test): run mock retention checks before broad imports - #138294
Conversation
Keep the complete manual and automock retention chains directly after the collection-failure pair, before unrelated imports grow the shared heap. Preserve every census, assertion, timeout and file cleanup boundary. Also fix existing brace and shadowing lint diagnostics in the replay checks.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 4, 2026, 9:45 AM ET / 13:45 UTC. ClawSweeper reviewWhat this changesThis PR moves the generated manual and automock retention test files immediately after the intentional collection-failure pair, and applies lint-only braces and binding-name cleanup. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. The focused lexical reorder preserves the mock producer/release assertions and matches the fixture’s alphabetical sequencer; no patch defect was found. An inspectable exact-head terminal trace is still needed before merge because the body provides results as narrative rather than attached runtime output. Priority: P3 Review scores
Verification
How this fits togetherThe non-isolated Vitest runner reuses a worker across generated fixture files and cleans shared module, mock, environment, and global state after each file. This fixture uses lexical file ordering and V8 heap queries to prove manual and automock payloads are released between files. flowchart LR
A[Generated fixture files] --> B[Alphabetical test sequencer]
B --> C[Non-isolated Vitest worker]
C --> D[Per-file cleanup runner]
D --> E[Mock retention checks]
E --> F[V8 heap census]
F --> G[Child report validation]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +8. Total +8 across 1 file. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the narrow fixture-order change and add redacted exact-head terminal evidence showing the complete outer test passes while the four retained heap witnesses still execute. Do we have a high-confidence way to reproduce the issue? No: the reported full Linux CI timeout has not been reproduced or fully attributed; the body reports local observations only. Is this the best way to solve the issue? Yes: the custom lexical sequencer makes fixture renaming the smallest maintainable way to move the retained heap checks ahead of unrelated imports while preserving their adjacent producer/observer boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 068ef71bd20e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…138294) Keep the complete manual and automock retention chains directly after the collection-failure pair, before unrelated imports grow the shared heap. Preserve every census, assertion, timeout and file cleanup boundary. Also fix existing brace and shadowing lint diagnostics in the replay checks.
The non-isolated runner's four mock-retention checks ran after unrelated gateway and agent imports had grown the shared heap. Each
v8.queryObjectscall performs a collection and heap scan. In the failing CI observation, those four bodies exceeded their existing five-second limits.Run the complete manual and automock retention chains immediately after the intentional collection-failure pair. This changes only six generated test filenames and their ordering comment. Every producer/release assertion, partial-remock check, file cleanup boundary, timeout, and strict native-report validation remains. It preserves the four censuses retained by #131632. The same file also receives required braces and unshadowed replay bindings to fix six existing lint diagnostics discovered by the changed-file gate. Production delta is zero; tests are +23/-15, net +8.
The original and reordered fixtures both completed all 45 passing assertions, the one intentional publisher skip, and the expected collection failure locally. In one matched Node 26.8.1/macOS pair, the four census bodies totaled 2076.745 ms before and 164.894 ms after; child test duration was 8.85 s and 6.06 s. These are descriptive local observations. The original passed locally, and the full 120-second Linux CI timeout has not been reproduced or fully attributed. No RSS, retained-memory, Gateway, or general throughput improvement is claimed.
Two separate real-owner negative controls preserve the leak checks: retaining manual mock metadata causes only the manual release census to observe one object instead of zero; retaining cached automock exports causes only the automock release census to fail. The presence witnesses and opposite retention pair still pass. Complete native reports, file/project/PID identities, lifecycle markers and owned cleanup were independently checked. The fault fixtures remain retained as evidence.
Those comparison and fault observations precede the equivalent lint cleanup. The final committed source separately passes the complete normal runner test, formatting, and canonical changed-file gate, including root-test typechecking and type-aware lint. Independent managed Codex review through P2 found no actionable findings. All local commands are closed; hosted CI remains the normal landing gate.
Inspectable terminal evidence
The final test source validated below is byte-identical to commit
baf93037f5446efd77ae6824e283216dfa438f83(test/non-isolated-runner.test.ts, SHA-256e96c69f02d27c251679d9c6cd34e924cb1a9c4b3b739f8eb9c8da083f3f4f5c0). Validation ran before that commit was created, on the final source after the lint cleanup. Recorded runtime: Node 26.8.1, macOS arm64. The excerpts are copied from retained output: ANSI color controls are omitted for readability, and the private checkout prefix is replaced with<worktree>. No result, duration, test name, or failure text is rewritten.Final source: complete outer runner test and strict child-report validation
Recorded command:
/opt/homebrew/Cellar/node/26.8.1/bin/node scripts/run-vitest.mjs test/non-isolated-runner.test.ts --maxWorkers=1 --reporter=verbose.Complete outer stdout:
Complete outer stderr:
The outer test passes only after the existing strict child-completion validator verifies the real child's exit 1 for its intentional collection failure, matching PID/project/file inventory, 45 passed assertions plus one intentional skip, zero failed assertions, zero unhandled errors/timeouts, and both producer/observer teardown markers. It also rejects missing/corrupt reports and replayed mismatches. The actual child is awaited before those checks.
This final normal run emits the outer test summary, not the child's individual test lines. Its successful child fixture/report directory is removed after validation and join; no separate final-run raw child stdout/report is retained. The earlier child transcript below is explicitly from the pre-lint candidate.
Final source: formatting and canonical changed-file gate
Recorded format command:
/opt/homebrew/Cellar/node/26.8.1/bin/node node_modules/oxfmt/bin/oxfmt --check --threads=1 test/non-isolated-runner.test.ts.Recorded gate command:
/opt/homebrew/Cellar/node/26.8.1/bin/node scripts/check-changed.mjs --base d492a4b84f2d850d5237fe6b737c19a02d6d3d50 --timed -- test/non-isolated-runner.test.ts. Complete stage summary:Each command exited 0; the retained ownership receipts record joined groups, no forced cleanup or survivors, and removed private runtimes.
Earlier pre-lint candidate: retained full child stdout and four heap witnesses
This is pre-lint candidate evidence, source SHA-256
7b560fe68b54d7c883e343d636f9779e5b8c08a14037ef7b422ecf0886bfad91, not execution of the final commit. Its generated fixture bodies/order and four heap checks are identical to the final source; the later changes only add braces and rename two replay callback bindings. This observation-only run retained the actual child output/report after the child joined.Complete child stdout:
The one failed file is the intentional
01-a-crash.test.tscollection failure; its retained stderr reportsError: synthetic collect failure. Stderr also retains the Vite dynamic-import analysis warning and experimentalv8.queryObjectswarning. The strict outer validator accepted this expected shape. Separate manual-metadata and automock-export retention faults each made its own release census fail with one retained object instead of zero while the opposite pair passed.These earlier witnesses and the single before/after timing pair are not relabeled as final-source execution. The full 120-second Linux timeout remains unreproduced and not fully attributed; no new run or benchmark was performed to prepare these excerpts.