fix(build): restore exact cache output snapshots (#122837)

This commit is contained in:
Peter Steinberger
2026-08-12 15:20:11 -07:00
committed by GitHub
parent 87b503675a
commit 93f5e0f1f6
2 changed files with 33 additions and 9 deletions
+8
View File
@@ -853,6 +853,14 @@ export function restoreBuildAllStepCacheOutputs(
}
const fsImpl = params.fs ?? fs;
const rootDir = params.rootDir ?? process.cwd();
const stampedOutputSet = new Set(cacheState.stampedOutputs);
// A restored snapshot owns its declared output set. Remove older checkout
// outputs first so cache hits cannot combine declarations from two builds.
for (const relativeFile of cacheState.relativeOutputFiles ?? []) {
if (!stampedOutputSet.has(normalizePortablePath(relativeFile))) {
fsImpl.rmSync(path.resolve(rootDir, relativeFile), { force: true });
}
}
for (const relativeFile of cacheState.stampedOutputs) {
copyFileSync(
fsImpl,