diff --git a/.github/actions/setup-node-env/action.yml b/.github/actions/setup-node-env/action.yml index 7e1206e9e594..8b2bc1c4b675 100644 --- a/.github/actions/setup-node-env/action.yml +++ b/.github/actions/setup-node-env/action.yml @@ -387,6 +387,12 @@ runs: append_pnpm_option_arg PNPM_CONFIG_NETWORK_CONCURRENCY network-concurrency append_pnpm_option_arg PNPM_CONFIG_STORE_DIR store-dir append_pnpm_option_arg PNPM_CONFIG_VIRTUAL_STORE_DIR virtual-store-dir + if [ "$STICKY_DISK" = "true" ] && [ "$STICKY_WRITER" = "true" ] && + [ "$sticky_snapshot_matches" != "true" ]; then + # A mounted stale tree can make a normal frozen install report "Already up to date". + # Only the canonical writer may rebuild the shared modules directory in place. + install_args+=(--force) + fi run_pnpm_install() { if [ "$STICKY_DISK" = "true" ]; then # Pnpm can keep retrying optional platform tarballs after the diff --git a/test/scripts/ci-workflow-guards.test.ts b/test/scripts/ci-workflow-guards.test.ts index 7000d7dbd442..648806e22779 100644 --- a/test/scripts/ci-workflow-guards.test.ts +++ b/test/scripts/ci-workflow-guards.test.ts @@ -2161,6 +2161,14 @@ describe("ci workflow guards", () => { ); expect(installStep.run).toContain("timeout --signal=TERM --kill-after=15s 4m"); expect(installStep.run).toContain('pnpm "${install_args[@]}" --config.fetch-retries=0'); + const forceStickyWriterInstall = + 'if [ "$STICKY_DISK" = "true" ] && [ "$STICKY_WRITER" = "true" ] &&\n' + + ' [ "$sticky_snapshot_matches" != "true" ]; then'; + expect(installStep.run).toContain(forceStickyWriterInstall); + expect(installStep.run).toContain("install_args+=(--force)"); + expect(installStep.run.indexOf(forceStickyWriterInstall)).toBeLessThan( + installStep.run.indexOf("run_pnpm_install()"), + ); expect(installStep.run).toContain("install_attempts=2"); expect(installStep.run).toContain("install_attempts=3"); expect(installStep.run).toContain(