Repository navigation
fix(test): isolate Vitest caches across linked checkouts - #132867
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 7:10 PM ET / 23:10 UTC. ClawSweeper reviewWhat this changesThe PR relocates Vitest’s default writable module cache to each checkout’s Merge readinessKeep this maintainer-authored PR open. Current main still places default parallel-run caches under shared Priority: P3 Review scores
Verification
How this fits togetherOpenClaw test launchers pass filesystem-cache paths into Vitest for normal runs, parallel project plans, and extension batches. Vitest stores rebuildable transforms at those paths, so cache ownership determines whether linked checkouts can invalidate each other. flowchart LR
A[Linked checkouts] --> B[Test launchers]
B --> C[Checkout cache resolver]
C --> D[Default and parallel cache leaves]
D --> E[Vitest module cache]
E --> F[Test execution]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +81, Other -1. Total +80 across 9 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the checkout-owned resolver and distinct cache leaves, then complete exact-head CI and retain the recorded Vitest-contract verification with the merge evidence. Do we have a high-confidence way to reproduce the issue? Source-reproducible, with medium confidence: current main’s fallback resolves beneath shared Is this the best way to solve the issue? Yes, subject to the stated Vitest-contract check: one checkout-root resolver used by normal, parallel, and extension-batch paths removes the shared writable owner while preserving explicit overrides. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9e86e084e155. LabelsLabel 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
History |
9691877 to
b8f9db6
Compare
|
The cache-owner repair is ready to land at b8f9db6. Exact-head CI 33280098801 completed successfully. The latest ClawSweeper review has no actionable findings; its request to complete exact-head CI is satisfied. The real two-checkout Vitest regression fails with the original helper and passes with this repair. Focused proof passed all 536 original config/runner tests plus all 84 source-side scheduler tests, with both selected changed-file gates and independent P0–P2 reviews clean. The first CI run exposed the omitted source-side path assertions, which were corrected; the next run’s sole failed leaf was the existing Clipboard lifecycle bug, and one integration rebase after its fix retained all nine intended file blobs and the stable patch ID. Commands: The observed recovery was one focused startup from over 13 minutes without RUN to a completed 32.79-second diagnostic run, not a full-suite benchmark. Explicit cache overrides and CI seed behavior remain unchanged; explicitly sharing one cache leaf across independent commands remains the documented limitation. Product runtime LOC +0/-0; tooling owner +19/-8; test/support +88/-19. |
|
Merged via squash.
|
…2867) * fix(test): isolate Vitest caches across linked checkouts * test: align scheduler cache expectations with checkout ownership
What Problem This Solves
Resolves a problem where focused tests stall before starting when linked worktrees share installed dependencies. A test in one checkout can invalidate and recursively delete another checkout's Vitest transforms.
Why This Change Was Made
Vitest's default filesystem cache lives beneath node_modules, which is shared by linked development checkouts. Its lockfile integrity check removes the entire selected cache on a mismatch. Move the default cache into the owning checkout's .cache/vitest directory and share that root resolver across normal, parallel-project, and plugin-batch test runners. Keep the normal leaf separate from scheduler leaves so one invocation cannot clear its siblings.
Explicit cache paths, CI restored seeds, existing Windows opt-in, and cache opt-outs are unchanged. No new options, dependencies, timeouts, or retries.
User Impact
Developers can share installed dependencies between checkouts without sharing writable default transforms. No OpenClaw product-runtime behavior changes. Independent commands using the same checkout and same cache leaf still need to be serialized or assigned separate explicit cache paths.
Evidence
The original focused Browser test spent over 13 minutes before Vitest printed RUN. A guarded diagnostic traced ensureCacheIntegrity → clearCache → recursive removal of the linked shared cache. After this repair, the same command completed in 32.79 seconds, exposing its two intended Browser regressions. This is one observed startup recovery, not a whole-suite speedup benchmark.
The new regression launches real Vitest processes in two private package workspaces sharing only private node_modules. After changing the dependency lock, the original helper deletes the first checkout's cache sentinel; the repaired helper preserves it. The same regression source failed before the fix and passed afterward.
Production runtime LOC: +0/-0. Tooling owner LOC: +19/-8; the growth provides one checkout-owned default and separates independently invalidated cache leaves. Test/support LOC: +88/-19.
The first hosted run, 33277503922, caught one omitted source-side scheduler test that still asserted the old default cache path. Both stale expectations are now updated; its complete 84-test file and the actual changed-file gate, including core-test typechecks and targeted lint, pass. The eight original files and cache implementation are unchanged. A fresh independent P0–P2 review of this correction found no actionable issues.
Integration refresh: the corrected scheduler leaf passed in 33278706524; its only failed leaf was the already-tracked Clipboard lifecycle error after 4,094 passing tests. After the combined Browser/Clipboard repair #132878 landed, this branch was rebased once onto containing main. All nine intended file blobs and the stable patch ID are unchanged; a fresh exact-head CI run is required before merge.
Review follow-through: the latest ClawSweeper review found no patch defect and requested finished exact-head CI plus an independent dependency check. The installed Vitest 4.1.11
FileSystemModuleCacheconstructor,clearCache, andensureCacheIntegritywere directly inspected: metadata mismatch awaits recursive removal of the selected cache directories. Fresh CI remains required before landing. These are rebuildable Vitest transform artifacts; their file format is unchanged, with no OpenClaw persistent-state schema or migration change.A separate existing case remains: callers that explicitly force one cache path across parallel plugin-batch groups can still share a live cache. The current hosted plugin-prerelease job does not combine those options; this patch preserves explicit override semantics.