fix(ship): sync package-lock.json version alongside package.json#1862
Open
oharriehausen wants to merge 1 commit into
Open
fix(ship): sync package-lock.json version alongside package.json#1862oharriehausen wants to merge 1 commit into
oharriehausen wants to merge 1 commit into
Conversation
/ship Step 12 (carved into bin/gstack-version-bump by garrytan#1806) bumps VERSION and package.json's version but leaves package-lock.json's version field stale. Every JS-repo ship then carries a spurious 2-line package-lock.json diff, and `npm ci` warns on the version mismatch. Same bug garrytan#1757 fixed against the old inline-bash surface; garrytan#1757 is now CONFLICTING since garrytan#1806 moved the code, so this re-ports the fix onto the CLI. writeLockVersion() mirrors writePkgVersion()'s semantics: - Silent skip when package-lock.json is absent (yarn/pnpm/bun/no JS). - Malformed lockfile -> exit 2, no corrupted write. - I/O failure after package.json already written -> exit 3 (half-write). - Updates both top-level `version` and packages[""].version (lockfileVersion 3 stores the root version in two places). Wired through both `write` (FRESH bump) and `repair` (DRIFT_STALE_PKG). The state classifier is intentionally untouched: a stale lockfile root version never blocks runtime, so it is opportunistically synced but is not a halt condition. Tests: 3 existing write/repair assertions updated for the new packageLock field; 3 new tests cover lockfile sync on write + repair plus the malformed-lockfile exit-2 guard. Full suite: 32 pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Validated — this looks correct and is the canonical surface for the lockfile-sync fix. Confirming the lineage so triage is clean:
No competing open PR found on this path. One small nicety (non-blocking): a test asserting the lockfile is left untouched when only |
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.
Problem
/shipStep 12 (carved intobin/gstack-version-bumpby #1806) bumpsVERSIONandpackage.json's version but leavespackage-lock.json's version field stale. Every JS-repo ship then carries a spurious 2-linepackage-lock.jsondiff, andnpm ciwarns on the version mismatch.This is the same bug #1757 fixed against the old inline-bash surface. #1757 is now CONFLICTING because #1806 moved that code into the CLI, so it can't be merged as-is. This PR re-ports the fix onto the new CLI surface — it's what #1757 needs to become.
Fix
writeLockVersion()mirrorswritePkgVersion()'s semantics:package-lock.jsonis absent (yarn/pnpm/bun/no JS).package.jsonalready written → exit 3 (half-write).versionandpackages[""].version(lockfileVersion 3 stores the root version in two places).Wired through both
write(FRESH bump) andrepair(DRIFT_STALE_PKG). The state classifier is intentionally untouched: a stale lockfile root version never blocks runtime, so it's opportunistically synced but is not a halt condition.Tests
write/repairassertions updated for the newpackageLockfield.write+repairplus the malformed-lockfile exit-2 guard.gstack-version-bump+ship-version-syncsuites: 32 pass, 0 fail.Built on top of v1.55.1.0 (
c43c850); clean, no conflicts.Closes the gap left by #1757.