fix(release): keep finalize versions on main#437
Merged
Conversation
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
Finalizing a prerelease now leaves the stable package version on
maininstead of publishing it only from a detached tag commit. A fresh finalize requiresmainto point exactly at the selected prerelease, commits the stable version there, and pushes bothmainand the annotated stable tag.Finalize now rejects an advanced or divergent
mainwith guidance to create a new prerelease. For releases already created by the old detached flow, it can idempotently fast-forwardmainto the existing stable tag only when the selected prerelease is its ancestor; it never forces or overwrites history. The trusted workflow still validates the selected tag and continues publishing from the resolved release tag.Related: EntityProcess/agentv#1437
Validation
The regression tests run the real release script against disposable repositories and bare remotes. Before implementation, all five focused checks failed for the expected reasons; after the fix:
bun run buildbun run typecheckbun run lintbun test tests/unit/scripts/release.test.ts— 5 passedbun test— 1,326 passed, 5 skippedbun run test:e2e— 116 passed, 4 skippedbun -e "import { readFileSync } from 'node:fs'; import yaml from 'js-yaml'; yaml.load(readFileSync('.github/workflows/publish.yml', 'utf8'));"git diff --checkThe focused tests cover fresh success, advanced-main rejection, safe detached-tag recovery with an idempotent retry, unsafe divergent-tag rejection, and workflow tag validation without detaching.
Manual bare-remote E2E:
This produced the same commit for remote
mainand peeledv3.1.0, an annotated tag object, stable package version3.1.0, and current branchmain.Operational note
The already-published
v1.13.1cannot use automatic recovery now. Its stable commit6814b807and currentorigin/maincommit174a5997are sibling descendants ofv1.13.1-next.1(b520d060), so neither can fast-forward to the other. Finalize will correctly reject that state; do not force-updatemainor move the published tag. Repair requires an explicit maintainer-reviewed version normalization on currentmain, or a new prerelease/stable version from currentmain(for example1.13.2-next.1).Post-Deploy Monitoring & Validation
finalizerun after merge.main, pushes bothmainand the stable tag, and the remotemainSHA equals the stable tag's peeled SHA before npm publication.main.main; never force-push or retag an already-published version.