add rule 09: frontend dep changes — lockfile-correct workflow#4
Open
akkerkid wants to merge 1 commit into
Open
add rule 09: frontend dep changes — lockfile-correct workflow#4akkerkid wants to merge 1 commit into
akkerkid wants to merge 1 commit into
Conversation
… verify Codifies the workflow that prevents the PR-#55 (vite 5→6) class of failure: the autobox runs npm 9.2.0; npm install <pkg> there can produce a lockfile that's silently incomplete under stricter npm 10+ — npm test and npm run build on the autobox don't catch it because they reuse the pre-populated node_modules. Reviewer hits 16+ "Missing: <pkg> from lock file" errors when they try a fresh npm ci. Rule: - Always rm -rf node_modules + package-lock.json + npm install (don't trust surgical npm install <pkg>) - Verify with npm ci (strict) before committing - Capture both build and test output verbatim in PR body - Audit subagent gets a Q6 to flag orphan lockfile churn Caught the day after PR-#55 was rebased + audited ✅ ship; surfaced when reviewer ran an ephemeral node:20-alpine build/test as belt-and-suspenders verification before merging.
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
Adds a new rule
09-frontend-dep-changes.mdcodifying the lockfile-correct workflow for any change touchingfrontend/package.jsonorfrontend/package-lock.json. Wires it from the README index and from11-work-phase.md.Why
The autobox runs npm 9.2.0. Newer npm majors (10+) enforce stricter listing of transitive deps in
package-lock.jsonthan npm 9 does. A lockfile generated bynpm install <pkg>under npm 9 can be silently missing entries that npm 10'snpm cithen refuses with 16+Missing: <pkg> from lock fileerrors.The bot's autobox
npm testandnpm run buildreuse a pre-populatednode_modulesand don't re-resolve, so the defect is invisible there. It only surfaces when a reviewer with newer npm tries a freshnpm ci— at which point the PR is blocked and a rebase + force-push is needed.The trigger
PR akkerkid/meshcore-planner#55 (vite 5.4.21 → 6.4.2). The bot did everything else right — clean rebase onto fresh main, ✅ ship audit verdict, GPG-signed, breaking-change matrix complete, 38/38 tests passing on the autobox. But on
npm ciagainst a freshnode:20-alpine(npm 10.8.2) the install failed:After
npm installregenerated the lockfile from scratch, both build and the now-grown 70-test suite pass cleanly. So the version bumps themselves are fine — only the committed lockfile is incomplete.What the rule says (TL;DR)
For any frontend dep change:
rm -rf node_modules package-lock.json && npm install. Don't trustnpm install <pkg>to keep the rest of the lockfile honest.npm ci(strict mode) before committing — this is the reproducibility check.npm run buildandnpm testoutput verbatim in the PR body. Don't reuse stale test counts.package.jsondelta; flag orphan removals/additions.package.jsonandpackage-lock.jsontogether, never one without the other.Anti-patterns explicitly listed as ❌ block: hand-editing the lockfile, reusing prior audit numbers, claiming "build passes" without
npm cihaving succeeded first.Files
09-frontend-dep-changes.md(the rule itself, ~100 lines)README.md(index entry)11-work-phase.md(TL;DR pointer in the "Three special rules" section)Slot 09 was open in the existing 00–12 numbering; placed adjacent to
08-rebase-and-retest.mdsince both are PR-quality rules.Out of scope
autobox-provisionchange.11-work-phase.mdStep 1 covers backend test verification.Verification
11-work-phase.mdadds a one-paragraph pointer to 09. No other rules reference the old "frontend tests" gap.frontend/package*.json.Once merged, takes effect on the bot's next iteration (it pulls
bot-rulesat the start of every iter).