perf(prepush): share pro-test npm and vite caches across worktrees - #6853
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Fresh worktrees paid ~55s on the pro-test freshness gate: npm ci extracted tarballs even when they were already in the shared cache, and each worktree rebuilt without a shared Vite cache. npm ci --prefer-offline now uses that cache at both hook sites and during worktree bootstrap, which also seeds pro-test/node_modules. Vite's default cacheDir is linked to a lockfile-sharded path under git-common-dir — a .vite link, never a node_modules symlink. Concurrent hook builds flock the shared cache. The freshness check and its trigger list are unchanged.
koala73
force-pushed
the
perf/prepush-pro-test-cache-6766
branch
from
August 17, 2026 12:26
0e269ac to
27a9c90
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A fresh worktree that tripped the pro-test freshness gate used to spend ~55s on
npm ci+vite buildbefore it even comparedpublic/pro/. After this change the same gate still fails a stale marketing bundle, but the install and Vite cache are shared across worktrees instead of being paid again on every checkout.Closes #6766.
What changed
npm ciat the hook's admission-leased install site and in worktree bootstrap now passes--prefer-offlineagainst the existing/tmp/worldmonitor-npm-cache. Bootstrap also seedspro-test/node_modules(copy/npm ci, never anode_modulessymlink — that path is known-broken here).Vite's default
node_modules/.viteis linked at hook time to a lockfile-sharded directory under the same git-common-dir that #6846 uses for admission, so every worktree of the same repo and lockfile shares one cache. Concurrent hook builds take aflockon that directory.pro-test/vite.config.tsis intentionally untouched. Editing it would putpro-test/in the branch delta, fire this same gate, and force apublic/pro/rebuild. On this machine a clean rebuild of currentmainalready produces different hashed assets than the committed production bytes — a pre-existing drift, not something this cache change should ship.Measurements
Issue report (
curious-frolicking-kite, 2026-08-16):pro-testnpm cipro-testnpm run buildThis worktree (Node 24.19, after
npm ci --prefer-offline):pro-testnpm ci --prefer-offlinevite buildfirst runvite buildsecond runvite buildscacheDirvs default outputgenerate-product-config+npm run buildpublic/pro/(pre-existing)The ≤20s first-push target is the bootstrap-seeded path:
pro-test/node_modulesis already present, so the hook skipsnpm ciand only rebuilds. Productionvite builddid not write acacheDiron this machine, so the 31s→7s warm number from the issue is likely OS page cache + an already-installed tree more than a Vite dep-optimize hit.Test plan
pro-test/node_modulesrunsnpm ci --prefer-offlinepro-test/node_modulessymlink is refused and does not runnpm ci.viteis a link intowm-vite-cache/pro-test-<hash>;node_modulesitself is not a symlinkpublic/pro/index.htmlstill fails with the existing stale-bundle errorpro-testand includes--prefer-offlinenode_modulessymlink instead of following itgit diffpaths unchangednpm cistays under the admission leaseKnown Residuals
pro-test/vite.config.tsdoes not setcacheDir. The hook shares Vite's default cache directory instead, so this PR does not have to rebuildpublic/pro/.ce-code-reviewdid not finish (reviewer hung). Orchestrator reviewed correctness, gate regressions, and the symlink landmine locally.Post-Deploy Monitoring & Validation
No additional operational monitoring required. This only changes the local pre-push hook and worktree bootstrap. Production
/probytes are not in the diff; a stale committed bundle still fails the same hook error.