Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 2:44 AM ET / 06:44 UTC. ClawSweeper reviewWhat this changesThe PR makes the stalled advisory-response tests advance fake time and the deadline clock together before asserting that the audit aborts after its total budget. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 2 items remain No introduced correctness defect was found. Current main still lacks this test-only clock alignment, and this maintainer-authored PR should remain open for normal maintainer handling. Priority: P2 Review scores
Verification
How this fits togetherThe dependency-audit script calls npm’s advisory endpoint and bounds each request, response-body read, and retry by a total deadline. Its tooling tests simulate stalled HTTP bodies and assert that the request is cancelled without an extra retry. flowchart LR
A[Audit test] --> B[Stalled HTTP response]
B --> C[Total deadline]
C --> D[Timeout and cancellation]
D --> E[Retry decision]
E --> F[One request assertion]
E --> G[Error outcome assertion]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +1. Total +1 across 1 file. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single-clock fake-timer harness so the test deterministically verifies the existing total-budget behavior without changing production retry policy. Do we have a high-confidence way to reproduce the issue? Yes. The supplied pre-change terminal trace records the focused HTTP 503 failure, and source inspection shows the old test mixed a real backoff timer with a performance-based deadline. Is this the best way to solve the issue? Yes. Controlling the test’s timeout and deadline clocks together fixes the test-only race at the owner boundary while preserving the production audit client’s remaining-budget behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fcdd8533696b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Closing as superseded by the already-landed audit-test hunk in commit 5871f31ab78d6be12a1e3767931e6d5ac57f358e, included in PR #137853. I compared this PR's diff with the raw landed commit and current main Fresh proof on the diagnostic branch rebased onto that main commit: node scripts/run-vitest.mjs test/scripts/pnpm-audit-prod.test.ts68 passed on Node 24.20.0. The audit test and production owner are identical to that main commit; the branch's only delta is the four-file SQLite diagnostic patch in #137999. This full-file run includes the newer retry-policy tests, and the production audit owner from PR #137989 is preserved unchanged. I also personally checked Vitest v4.1.11's async advancement and fake/real timer lifecycle, resolving the earlier review's dependency-source retrieval limitation. The author's branch and worktree are retained. |
Related: #137960 (advisory validation and total outage budget); observed in #137971 (This Mac settings PR CI).
What Problem This Solves
Resolves a problem where the production-audit stalled-body tests intermittently fail unrelated PR CI with “expected vi.fn() to be called once, but got 2 times.” The reported failure occurred in
core-tooling-12-hosted-3in run 33843525043. The HTTP 503 case also reproduced locally before this change.Why This Change Was Made
The tests now advance fake request timers and
performance.now()together to the exact 20 ms budget boundary, retaining the assertions for one fetch, cancelled body, and timeout/permanent-403 error. Real timers round fractional milliseconds while the deadline uses a high-resolution clock, so the old real-backoff test could reach the retry check with a small positive remainder.The implementation deliberately clamps each attempt to the remaining budget; it does not require the full configured request timeout before retrying. Ordinary CI itself uses a 30-second budget with a 60-second default request timeout. Changing that policy to stabilize this assertion would alter legitimate recovery behavior. The fix belongs in the test's timing control; timers are restored in
finally, and separate real-timer lifecycle and backoff-budget coverage remains.User Impact
Developers get deterministic stalled-body CI coverage. Production audit behavior, retry policy, budgets, and error classification are unchanged.
Evidence
Before the fix,
node scripts/run-vitest.mjs test/scripts/pnpm-audit-prod.test.ts -t stalledreproduced the reported failure:After the fix:
node scripts/run-vitest.mjs test/scripts/pnpm-audit-prod.test.ts: 62 tests passed.for i in $(seq 1 15); do node scripts/run-vitest.mjs test/scripts/pnpm-audit-prod.test.ts -t "stalled" || exit 1; done) passed every iteration:CPU-pressure proof:
node scripts/run-vitest.mjs test/scripts/pnpm-audit-prod.test.ts -t stalledwith eight parallel Node busy loops: 7 passed, 55 skipped; all eight workers terminated afterward.node scripts/check-changed.mjs: exit 0 (formatting, root test types, script lint, changed-test lint, and repository guards).Independent Codex autoreview: scoped-clean, no actionable P0–P2 findings.
Production/tooling LOC: +0/-0. Tests: +7/-6 (net +1).