Repository navigation
fix(test): drain late mock registrations - #126037
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 6:16 AM ET / 10:16 UTC. ClawSweeper reviewWhat this changesThe PR makes the shared non-isolated Vitest runner drain mock registrations added during an in-flight resolver pass and adds a regression test for the no-second-caller case. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open for maintainer review: the focused runner change and regression test address the stated late-registration path, but exact Vitest private-queue contract confirmation and exact-head CI remain required before merge. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherOpenClaw’s non-isolated Vitest runner serializes mock resolution between test files so each module import observes its declared mock registrations. It sits between test-file setup and Vitest’s module loader, affecting test-shard reliability rather than product runtime behavior. flowchart LR
A[Non-isolated test file] --> B[Mock registration queue]
B --> C[Shared test runner]
C --> D[Serialized resolver pass]
D --> E[Vitest module loader]
E --> F[Test shard result]
Decision needed
Why: The PR is maintainer-authored and changes shared test infrastructure whose correctness depends on an upstream private implementation unavailable in this review environment. Before merge
Agent review detailsSecurityNone. PR surfaceTests +27. Total +27 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one serialized runner path, verify the pinned Vitest 4.1.11 queue contract directly, and merge only after the exact-head CI run confirms the affected non-isolated shard remains stable. Do we have a high-confidence way to reproduce the issue? Yes, from source: the regression test deterministically adds an ID while the final resolver pass is held open and establishes the prior single-pass omission. I did not execute it because this read-only checkout lacks installed dependencies. Is this the best way to solve the issue? Unclear; the loop is the narrowest apparent repair for registrations stranded in the replaced queue, but its correctness still depends on direct confirmation of the pinned Vitest resolver contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c69abc232755. 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
HistoryReview history (3 earlier review cycles) |
db410b0 to
8bb6fa7
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Land-ready at exact head Classification: a shared test-harness contention race exposed by Vitest 4.1.11 lifecycle concurrency, not a production update CLI defect or a dependency regression requiring downgrade. Vitest 4.1.11's Before/after proof:
Reviews and hosted proof:
Production LOC delta: 0. Test support +5 net; regression test +22. No CLI output, side effect, dependency, docs, or changelog change. Known proof gaps: none. |
|
Merged via squash.
|
What Problem This Solves
Resolves a problem where the non-isolated CLI test shard could split mocked imports across module instances, producing 35 false
src/cli/update-cli.test.tsfailures even though focused update CLI behavior remained green. Vitest 4.1.11's restored global lifecycle concurrency limit made the existing scheduling race recur in cleanup CI run https://github.com/openclaw/openclaw/actions/runs/32950521368.Why This Change Was Made
The serialized mock resolver now drains IDs queued during its final in-flight pass before allowing that caller to continue. This keeps later module fetches from invalidating mocks midway through an import graph and adds the no-second-caller case missing from the existing resolver coverage. It does not change production CLI behavior or downgrade Vitest.
User Impact
There is no end-user CLI behavior change. Maintainers get reliable non-isolated CLI CI after the Vitest 4.1.11 upgrade, unblocking unrelated command cleanup work.
Evidence
src/cli/update-cli.test.ts; 5,494 passed, 42 skipped: https://github.com/openclaw/openclaw/actions/runs/32950521368/job/98124290066mock-lateremained unprocessed (["mock-a"]instead of["mock-a", "mock-late"]).BareModuleMocker.resolveMocks()resolves the current static queue before replacing it with[]; the 4.1.10→4.1.11 comparison does not modify that owner. The relevant 4.1.11 change restores lifecycle concurrency: https://github.com/vitest-dev/vitest/releases/tag/v4.1.11AI-assisted: yes. No agent transcript attached.