From ecc822d588daabd74c32b5b1a4fbdf03d7aa57f3 Mon Sep 17 00:00:00 2001 From: Declan Carroll Date: Thu, 17 Sep 2026 09:47:55 +0000 Subject: [PATCH] ci: Force fresh sync patch validation (no-changelog) (#38929) --- .github/scripts/sync-master-to-3x.mjs | 9 +++++---- .github/scripts/sync-master-to-3x.test.mjs | 16 ++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/scripts/sync-master-to-3x.mjs b/.github/scripts/sync-master-to-3x.mjs index 8b1b6a4bcbb..77e7a10d736 100644 --- a/.github/scripts/sync-master-to-3x.mjs +++ b/.github/scripts/sync-master-to-3x.mjs @@ -151,9 +151,9 @@ export function resolveMechanicalPath({ git, pnpm, path, masterSha, log = consol log(`Regenerating ${path} with pnpm...`); pnpm(['install', '--lockfile-only', '--no-frozen-lockfile']); try { - // A lockfile-only install does not apply patches. Validate the regenerated lockfile - // with a full install so pnpm applies patches before accepting the resolution. - pnpm(['install', '--frozen-lockfile']); + // A lockfile-only install does not apply patches. Force a full install so pnpm + // does not accept cached dependencies without applying the regenerated patches. + pnpm(['install', '--frozen-lockfile', '--force']); } catch (error) { git(['checkout', '--conflict=merge', '--', path]); throw error; @@ -313,7 +313,8 @@ export function reconcileWithMergeTreeAtTip({ */ export function reconcileLockfileAtTip({ git, pnpm, masterSha, log = console.log }) { pnpm(['install', '--lockfile-only', '--no-frozen-lockfile']); - pnpm(['install', '--frozen-lockfile']); + // Force pnpm to reimport cached dependencies and apply the regenerated patches. + pnpm(['install', '--frozen-lockfile', '--force']); if (attempt(git, ['diff', '--quiet', '--', LOCKFILE]).ok) return; if (git(['rev-parse', 'HEAD']) === masterSha) { throw new Error('Lockfile reconciliation would amend a master commit; refusing.'); diff --git a/.github/scripts/sync-master-to-3x.test.mjs b/.github/scripts/sync-master-to-3x.test.mjs index 0951142bd3a..b9c12c5222a 100644 --- a/.github/scripts/sync-master-to-3x.test.mjs +++ b/.github/scripts/sync-master-to-3x.test.mjs @@ -185,10 +185,10 @@ test('resolveMechanicalPath regenerates and applies patches before staging the l const git = makeStub(); const pnpm = makeStub(); resolveMechanicalPath({ git, pnpm, path: LOCKFILE, masterSha: MASTER, log: () => {} }); - // `--no-frozen-lockfile` is load-bearing: pnpm defaults to frozen when CI=true. + // Regeneration must override CI's frozen default. Validation must bypass cached imports. assert.deepEqual(pnpm.calls, [ ['install', '--lockfile-only', '--no-frozen-lockfile'], - ['install', '--frozen-lockfile'], + ['install', '--frozen-lockfile', '--force'], ]); assert.ok(git.calls.some((a) => a[0] === 'add' && a.includes(LOCKFILE))); }); @@ -421,7 +421,7 @@ test('reconcileLockfileAtTip folds an inconsistent lockfile into the tip commit, reconcileLockfileAtTip({ git: inconsistent, pnpm, masterSha: MASTER, log: () => {} }); assert.deepEqual(pnpm.calls, [ ['install', '--lockfile-only', '--no-frozen-lockfile'], - ['install', '--frozen-lockfile'], + ['install', '--frozen-lockfile', '--force'], ]); assert.ok(inconsistent.calls.some((a) => a[0] === 'commit' && a.includes('--amend'))); @@ -684,11 +684,11 @@ test('sync auto-resolves a lockfile-only conflict during the replay — no PR, n await sync({ git, gh, pnpm, env, log: () => {} }); - // The stall regen and the tip reconciliation each run regeneration and validation. + // The stall regen and tip reconciliation each run regeneration and forced validation. assert.deepEqual(pnpm.calls[0], ['install', '--lockfile-only', '--no-frozen-lockfile']); - assert.deepEqual(pnpm.calls[1], ['install', '--frozen-lockfile']); + assert.deepEqual(pnpm.calls[1], ['install', '--frozen-lockfile', '--force']); assert.deepEqual(pnpm.calls[2], ['install', '--lockfile-only', '--no-frozen-lockfile']); - assert.deepEqual(pnpm.calls[3], ['install', '--frozen-lockfile']); + assert.deepEqual(pnpm.calls[3], ['install', '--frozen-lockfile', '--force']); assert.equal(pnpm.calls.length, 4); assert.ok(git.calls.some((a) => a[0] === 'add' && a.includes(LOCKFILE))); assert.ok(git.calls.some((a) => a[0] === 'rebase' && a[1] === '--continue')); @@ -838,7 +838,7 @@ test('buildConflictBranch pre-resolves mechanical files so only code conflicts r assert.equal(lockfileDeferred, false); assert.deepEqual(pnpm.calls, [ ['install', '--lockfile-only', '--no-frozen-lockfile'], - ['install', '--frozen-lockfile'], + ['install', '--frozen-lockfile', '--force'], ]); assert.ok( git.calls.some((a) => a[0] === 'checkout' && a[1] === MASTER && a.includes(POPULARITY)), @@ -886,7 +886,7 @@ test('buildConflictBranch restores and defers a lockfile when the patched instal assert.equal(lockfileDeferred, true); assert.deepEqual(pnpm.calls, [ ['install', '--lockfile-only', '--no-frozen-lockfile'], - ['install', '--frozen-lockfile'], + ['install', '--frozen-lockfile', '--force'], ]); assert.ok( git.calls.some(