Skip to content

Commit 3eaf9d1

Browse files
committed
Fix post-release lockfile drift false positive
The coherence gate treated any file change from version-sync.sh as a version drift error, but version-sync.sh always refreshes the npm lockfile via 'npm install --package-lock-only'. When optional platform packages are published to the registry after a release, the next CI run resolves them in the lockfile (changing from hollow stubs to fully resolved entries), causing a false drift failure. Exclude npm/socket-patch/package-lock.json from the drift check since lockfile changes don't indicate version string drift - they're just npm re-resolving optional dependencies based on current registry state.
1 parent 365924c commit 3eaf9d1

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

scripts/release-lint.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,24 @@ if [ -n "$(git status --porcelain)" ]; then
7979
else
8080
bash scripts/version-sync.sh "$VERSION" >/dev/null
8181
DRIFTED="$(git status --porcelain | awk '{print $2}')"
82-
if [ -n "$DRIFTED" ]; then
83-
fail "version-sync.sh $VERSION is not a no-op — these files carried a stale version: $(echo "$DRIFTED" | tr '\n' ' ')"
82+
# Exclude npm/socket-patch/package-lock.json: version-sync refreshes it via
83+
# npm install --package-lock-only, which re-resolves optional platform packages
84+
# from the registry. After a release publishes those packages, the lockfile
85+
# changes from hollow stubs to fully resolved entries (or vice versa when
86+
# running on the bump commit before publish), but that's not version drift.
87+
DRIFTED_VERSIONS="$(echo "$DRIFTED" | grep -v '^npm/socket-patch/package-lock\.json$' || true)"
88+
if [ -n "$DRIFTED_VERSIONS" ]; then
89+
fail "version-sync.sh $VERSION is not a no-op — these files carried a stale version: $(echo "$DRIFTED_VERSIONS" | tr '\n' ' ')"
8490
# The tree was clean before the sync, so restoring exactly the files the
8591
# sync touched leaves it as found.
8692
echo "$DRIFTED" | xargs git checkout --
8793
else
88-
note "version coherence OK: every stamped site already carries $VERSION"
94+
if [ -n "$DRIFTED" ]; then
95+
note "version coherence OK: every stamped site already carries $VERSION (npm lockfile refreshed from registry, as expected)"
96+
echo "$DRIFTED" | xargs git checkout --
97+
else
98+
note "version coherence OK: every stamped site already carries $VERSION"
99+
fi
89100
fi
90101
fi
91102

0 commit comments

Comments
 (0)