Repository navigation
fix(#826): frozen install in new-feature.sh so provisioning cannot dirty the lockfile - #827
Merged
admarble merged 1 commit intoJul 27, 2026
Conversation
…rty the lockfile #816 made this substitution for the TypeScript worktree-manager path but missed this script, which still used `npm install --silent` at all three sites. `npm install` normalizes and rewrites package-lock.json whenever the local npm disagrees with the npm that committed it — observed here as npm 10 stripping the `libc` fields a newer npm wrote via dependabot. Every freshly provisioned worktree therefore started with an unstaged lockfile, and that single dirty file cascades into three unrelated-looking failures: `rebaseBeforePR` refuses to run so the #295 stale-base guard silently never fires (while the run log still says success), `checkWorktreeFreshness` counts it as uncommitted work so stale worktrees are never recreated, and chain checkpoints skip on an "unrelated dirty file", breaking chain resume (#760) on every link. Reproduced live: provisioning the worktree for this very issue left `package-lock.json` modified with 12 deletions before any edit. `npm ci` never rewrites the lockfile, and the enclosing `[ ! -d node_modules ]` guard means it only ever runs against an absent node_modules — exactly its precondition. Extracted to a `frozen_install` helper so the three sites cannot drift, with an explicit failure path (AC-4): a bare `set -e` abort would leave a half-provisioned worktree with no explanation, so the helper names the cause (lockfile out of sync with package.json) and the remedy. Edits templates/scripts/ — scripts/new-feature.sh is a symlink to it.
Closed
10 tasks
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
scripts/new-feature.shstill usednpm install --silentat all three install sites. #816 made exactly this substitution for the TypeScript worktree-manager path — this script was missed by it.npm installnormalizes and rewritespackage-lock.jsonwhenever the local npm disagrees with the npm that committed it (here: npm 10 stripping thelibcfields a newer npm wrote via dependabot). So every freshly provisioned worktree began life with an unstaged lockfile, and that single dirty file cascades into three unrelated-looking failures:rebaseBeforePRrefuses to run (cannot rebase: You have unstaged changes), so the fix: Rebase worktrees onto main before PR to prevent lockfile drift #295 stale-base guard silently never fires while the run log still reports successcheckWorktreeFreshnesscounts it as uncommitted work, so stale worktrees are never recreatedFound while provisioning the #804 worktree; it would otherwise have ridden along in PR #825.
Change
All three sites now go through a
frozen_installhelper wrappingnpm ci --silent, which never rewrites the lockfile. Extracting the helper means the three sites cannot drift apart — which is how this one got missed in the first place.The enclosing
[ ! -d node_modules ]guard means the install only ever runs against an absentnode_modules, which is exactlynpm ci's precondition.Edits
templates/scripts/new-feature.sh—scripts/new-feature.shis a symlink to it, so editing the link would have been a no-op.AC verification
npm install --silentremain; 3frozen_installcall sitescp -rsnode_moduleswith no install; cache-miss and cache-init callfrozen_installthen update the hash file. Only the two install sites changedAC-2: A/B on a scratch worktree at the same commit
The 12 deletions are the
libcfields — the exact signature #816 documents.AC-4: failure path
Injected an out-of-sync dependency into
package.jsonsonpm cigenuinely fails, then ran the extracted helper verbatim:Execution stops there (the probe's trailing "SHOULD NOT REACH HERE" never prints). A bare
set -eabort would have exited just as non-zero but left a half-provisioned worktree with no explanation of why — hence the explicit handler rather than relying onset -e.Test plan
bash -n templates/scripts/new-feature.sh— syntax OKNon-Goals
Closes #826