Repository navigation
fix(scripts): stabilize Vitest shard timing keys - #120105
Conversation
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 4:28 AM ET / 08:28 UTC. ClawSweeper reviewWhat this changesThe branch canonicalizes locally selected Vitest file patterns before deriving timing-history keys, and adds persisted aggregation coverage for reversed selections. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessThis PR remains necessary: current main still hashes local include patterns in their supplied order, while the branch correctly hashes a sorted copy and proves persisted timing reuse for reversed selections. No actionable correctness or security finding was identified. Priority: P3 Review scores
Verification
How this fits togetherThe test-project runner stores duration samples keyed by each Vitest configuration and its selected files. Later parallel scheduling reads those samples to start expensive selections earlier. flowchart LR
A[Selected test files] --> B[Timing-key builder]
B --> C[Persisted timing metadata]
C --> D[Parallel shard scheduler]
D --> E[Vitest processes]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +15, Other 0. Total +15 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the shared order-insensitive key repair with its persistence-level regression coverage so equivalent local selections reuse their advisory scheduling history. Do we have a high-confidence way to reproduce the issue? Yes. The supplied current-head CLI trace runs the same selected tests in opposite orders and observes one persisted key advancing from sample count 1 to 2; source confirms that this key is consumed by parallel scheduling. Is this the best way to solve the issue? Yes. Canonicalizing only the metadata key at its shared owner fixes the order-dependent lookup without altering the caller’s selected execution order or adding a storage migration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9c3d3fc65a89. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (17 earlier review cycles; latest 8 shown)
|
bbf3323 to
9161dfc
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
9161dfc to
c7dd134
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Punchcard-Session: amber-lantern-timber-0m
8e9632b to
de1a6a1
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
Merge current main to move canonicalization into the shared timing metadata owner. Replace duplicate key comparisons with persisted sample aggregation coverage. Co-authored-by: qingminlong <[email protected]> Co-authored-by: Vincent Koc <[email protected]>
|
Updated Four actual The prior ClawSweeper review is older than 12 hours: @clawsweeper re-review. Exact-head CI remains the landing gate. |
|
Merged via squash.
|
What Problem This Solves
Reordering the same selected Vitest test files split their local timing history into separate keys. Later scheduling could not reuse the prior measurements for that selection.
Why This Change Was Made
Canonicalize the selection at the shared timing-key owner using a nonmutating, locale-independent sort. Current main moved this owner into
scripts/lib/vitest-shard-metadata.mts; the branch now preserves that extraction and its dependency-free scheduling boundary. Whole-config and named CI shard keys retain their existing contracts. No new storage format, version, option, dependency, or compatibility reader is introduced; old advisory timing entries can be rebuilt.The regression replaces a same-input self-comparison with actual timing-file write/read aggregation for reversed ASCII and Unicode selections. Frozen caller arrays also catch accidental in-place sorting. The existing whole-config and named-shard cases remain covered. Production LOC: +2/-2 (net 0); tests: +28/-13 (net +15).
User Impact
Repeated selections reuse timing history regardless of discovery or CLI argument order, while keeping the caller's execution order unchanged. Thanks @qingminglong and @vincentkoc.
Evidence
node --import tsx scripts/test-projects.mtscommand rantest/scripts/vitest-local-scheduling.test.ts test/scripts/package-root-args.test.tsand then the reversed target order. Both runs passed 2 files and 14 tests, but the artifact contained separatea10cb960b779and6f5eadc5858fkeys with sample count 1 each.test/vitest/vitest.unit-fast.config.ts#include-2-6f5eadc5858f, and the second run advanced its sample count from 1 to 2.node scripts/run-vitest.mjs test/scripts/vitest-shard-timings.test.ts: two aggregation cases failed before the fix; all 5 cases passed afterward, including whole-config and named CI controls.node scripts/check-changed.mjs -- scripts/lib/vitest-shard-metadata.mts test/scripts/vitest-shard-timings.test.ts: all 18 selected gates passed, including script/test-root types, script lint, formatting, dependency guards, and erasability. The temporary-directory report emitted existing-main advisory findings; the gate exited successfully.Provenance: the order-dependent hash was added in commit
496d90c3b5e, whose raw parent1531123d3547f9ff8ee8094590fc773305f018f2and parent-relative patch were inspected. The current-main owner extraction carried that behavior forward. No whole-suite scheduling speedup is claimed; the observed proof is real CLI execution and persisted sample reuse.