Skip to content

[rush] Use deterministic cache restore staging - #6226

Open
Yashwanth Reddy Verupaka (yashwanth195) wants to merge 1 commit into
microsoft:mainfrom
yashwanth195:user/yverupaka/fix-cache-restore
Open

Yashwanth Reddy Verupaka (yashwanth195) wants to merge 1 commit into
microsoft:mainfrom
yashwanth195:user/yverupaka/fix-cache-restore

Conversation

@yashwanth195

@yashwanth195 Yashwanth Reddy Verupaka (yashwanth195) commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Rush currently uses randomly named staging directories for build-cache restores. Use predictable, exclusively claimed slots without letting parallel restores or their cleanup overwrite a project output.

Details

Reserve all declared project and graph outputs, including unselected operations and shard outputs. Compare lexical paths and resolved ancestors before claiming a slot. Exclusive directory creation coordinates across processes; within a process, concurrent restores share the reservation catalog and advance a per-parent cursor. Occupied slots are never reused or removed by another restore.

Restore in place if a complete current snapshot is unavailable or the staging path cannot be safely resolved. No cache key or archive format changes.

How it was tested

  • Targeted Jest runCLI (run in band): 148 tests passed across staged restore, bridge, cacheable operations, legacy skip, and retained results in the reviewed candidate. Eight regressions failed on the preceding deterministic draft, as expected. For 75 concurrent restores, mkdir probes dropped from 2,850 to 75.
  • Final change: node - with the focused Jest runCLI harness ran StagedRestore.test.js; the case-sensitive identity regression failed before the change, then all 42 staged-restore tests passed.
  • Isolated Rush-lib and bridge TypeScript and ESLint checks and Rush-lib API Extractor passed before the final two-file adjustment. A separate local full TypeScript attempt against older installed prerequisites reported dependency API mismatches. Full-repo and native cold/warm/mixed acceptance were not rerun.
  • git diff --check b87dafc59039a409755930fcff980b0c2d61a340 73f7f7d34bbe37327ad0124accd05e08bd82f7ed: passed.

Impacted documentation

No website documentation is affected.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:heft-sharding Sharding feature for heft especially for jest

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

2 participants