fix(release): survive the version-bump race that wedged publishing - #115
Open
gjtorikian wants to merge 4 commits into
Open
fix(release): survive the version-bump race that wedged publishing#115gjtorikian wants to merge 4 commits into
gjtorikian wants to merge 4 commits into
Conversation
Runs #99-#112 all failed after #99 published 0.62.0 to npm but lost a push race committing the bump back to main, leaving package.json at 0.61.0 forever re-deriving an already-published version. Two guards: - Bump from max(package.json, registry) so a stale manifest self-heals instead of wedging every subsequent publish. - Rebase-and-retry the bump-commit push so a merge landing mid-run no longer kills the job after the npm publish already succeeded.
Greptile SummaryThe release workflow now reconciles manifest and npm registry versions, commits the selected version before building, and retries non-fast-forward pushes so interrupted releases can recover safely.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
|
Addresses both review findings: a transient npm view failure no longer silently falls back to the possibly-stale manifest base (only E404 — never published — does), and the release tag now points at GITHUB_SHA so a mid-run merge can't put newer spec content under the tag than what npm serves for that version.
Tagging the pre-bump GITHUB_SHA fixed artifact/spec correspondence but left the tagged package.json one version behind the release. Instead, reorder: commit and push the bump (rebase-and-retry) before npm publish, then build from the pushed tree and tag HEAD. A lost race now fails before anything is published, and tag, manifest, and artifact always agree. If publish fails after the bump lands, re-running the workflow self-repairs: the rebase dedups the already-landed bump and publishes the version main already records.
With the bump landing before publish, a build or publish failure leaves main one version ahead of npm. A fresh run previously took max(manifest, registry) as its base and bumped again, so the version already committed to main would never ship. Now a manifest ahead of the registry means exactly one thing — an interrupted release — and the run publishes that pending version as-is (no new bump, no new commit) before normal bumping resumes.
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
Hardens
release.ymlagainst the race documented in #114: run #99 published0.62.0to npm, then lost a push race committing the bump back tomain(PR #100 merged mid-run).package.jsonstayed at0.61.0, so every publish run since re-derived0.62.0and died onnpm error You cannot publish over the previously published versions.Two guards, either of which alone would have prevented the 13-run failure streak:
max(package.json version, registry version)as its base (npm view+sort -V), so a stale manifest can no longer wedge publishing.npm viewfailure falls back to0.0.0, i.e. plain manifest-based behavior for a never-published package.git push/git pull --rebase origin main. The bump commit only touchespackage.json/package-lock.json, which the trigger paths deliberately exclude, so the rebase is conflict-free against spec merges and the push can't re-trigger the workflow.Test plan
js-yaml); bump-step shell passesbash -n.0.61.0/ registry0.62.0→ base0.62.0; manifest ahead → manifest wins.release.ymlviaworkflow_dispatch(bump: minor) → should publish0.63.0, commit the bump, tagv0.63.0, and create the release.Companion to #114 (state resync); this PR prevents recurrence.
🤖 Generated with Claude Code