Skip to content

fix(version): release a reapplied change whose revert shipped in an earlier release - #1074

Merged
goosewobbler merged 15 commits into
mainfrom
fix/1071-reapply-across-releases
Nov 22, 2026
Merged

goosewobbler merged 15 commits into
mainfrom
fix/1071-reapply-across-releases

Conversation

@goosewobbler

@goosewobbler goosewobbler commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Reapplying a change that was reverted in an earlier release gave no version bump, and the changelog listed it as a plain changed entry. Its Reapply "…" title (or older git's Revert "Revert "…"") didn't match the preset's header pattern, so it had no type and no breaking note.

The bump and the changelog now both read such a reapply as the commit it reapplies, so it bumps and is listed like the original:

  • Titles: one loop peels Revert "…" and Reapply "…" layers and squash-merge (#N) suffixes down to the original subject, counting a Reapply as two reverts. That covers git's Reapply, older git's double revert, GitHub's revert button and squash-merged titles.
  • One step: resolveReverts drops each commit reverted in the range with its revert, then reads a remaining reapply that names its revert (This reverts commit …) as the commit it reapplies. The bump and the changelog both call it, so the two can't run out of order.
  • Pairing: a Revert "…" or Reapply "…" commit that names one commit in its This reverts commit … line pairs with it by that hash alone, since a squash merge changes the titles git quotes. A squash of several reverts, naming several commits, keeps the preset's matching. This changes one behaviour from fix(version): keep a commit that is reverted and re-applied in the same release #1068: a squash-merged revert in the same range as the commit it reverts now cancels it, instead of both being kept and the reverted change released.

Not covered: a breaking change declared only in the original commit's BREAKING CHANGE: footer comes back as non-breaking, since the reapply carries only the title.

Closes #1071

Testing

Version-CLI cases in packages/version/test/integration/reverts.spec.ts for Reapply "…", a squash-merged reapply with two suffixes, and a GitHub-button double revert, each with its revert in an earlier release. All bump to 2.0.0 and list drop Node 18 as a breaking added entry, and fail without the fix. The squash-merged revert case now expects the revert to cancel its commit, and a squash of several reverts keeps every commit; the other same-range revert cases are unchanged.

pnpm lint and pnpm typecheck pass.

…arlier release

A `Reapply "…"` commit (or older git's `Revert "Revert "…""`) whose revert is
not in the range is now read as the commit it reapplies. It bumps the version and
is listed with its type and breaking note, as the original commit was. The bump and
the changelog share the one helper that does this.
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Standing release PR: #1054 · v0.47.1 queued (4 packages) · open 2d 11h 52m · ✅ ready to merge

Release Preview — v0.47.0 → v0.48.0

Note: Labels on this PR are advisory in standing-pr mode. Bumps come from conventional commits in the standing PR; override by editing labels on the standing PR itself. Add release:immediate to bypass the standing PR and release this PR directly.

These changes will be added to the release PR (#1054) when merged:

Changelog

monorepo 0.47.0 → 0.48.0

Breaking

  • version: pair every revert with the commit it names by hash

Changed

  • version: pass resolveReverts the commits themselves
  • version: resolve reverts in one step
  • version: state asReapplied's precondition, not its caller
  • version: reword asReapplied's purpose
  • version: say directly what asReapplied does
  • version: cut restated and stilted comments in the revert helpers
  • version: release a change reapplied a second time across a release
  • tighten comment and docs wording

Fixed

  • version: pair a revert by hash only when it names one commit
  • version: strip every squash-merge suffix from a revert title
  • version: only read a reapply as its original commit when it names its revert
  • version: unwrap nested and squash-merged revert titles, and pair a reapply by hash
  • version: recognise a squash-merged reapply
  • version: release a reapplied change whose revert shipped in an earlier release

All packages → 0.48.0 (sync versioning)

  • @releasekit/version
  • @releasekit/notes
  • @releasekit/publish
  • @releasekit/release

After merge — predicted release

Approximate. The standing PR rebuilds against main at merge time; if other commits land first, the prediction may shift.

Package Standing PR This PR After merge
monorepo 0.47.1 0.48.0 0.48.0 ⚠ escalated from 0.47.1

Updated automatically by ReleaseKit

A squash merge appends ' (#N)' to the reapply's title. Also drop a test comment the earlier revert test already makes.
… a reapply by hash

One loop peels Revert/Reapply titles and squash-merge (#N) suffixes down to
the subject, counting a Reapply as two reverts, so a GitHub-button double
revert like `Revert "Revert "X" (#13)" (#15)` and a reapply of a reapply are
recognised. A reapply pairs with its revert by the hash it names alone, since
a squash merge changes the titles git quotes. Single reverts pair as before.
…s its revert

A reapply that survives the revert filter and names its revert has no revert in the range, which is the case to release. One without a 'This reverts commit' line stays a plain entry, as before.
Reverting a squash-merged revert and squash-merging the result gives two suffixes, as in 'Reapply "X" (#13) (#14)'.
Four git reverts with a release after the third leave 'Reapply "Reapply "X""' alone in the range, which only a multi-layer unwrap reads as X.
resolveReverts drops each commit reverted in the range with its revert and
reads a remaining reapply as the commit it reapplies, so the bump and the
changelog make one call and can't run the two steps out of order.
A revert now cancels the commit named in its `This reverts commit` line
whatever its title, so a squash-merged revert drops with the commit it
reverts instead of releasing it. This also keeps a squash-merged revert of
a reapply from leaving the reapply to be read as the original change.
A squash of several reverts names several commits, which one hash can't
pair, so it keeps the preset's matching instead of cancelling the first
named commit and dropping the revert. Also say resolveReverts reads a
reapply as its original when its revert isn't in the range, not when it
was released.
The changelog attaches each commit's hash and message to the parsed commit, so resolveReverts takes and returns commits, without an accessor or an item wrapper.
@goosewobbler
goosewobbler merged commit a62ad10 into main Nov 22, 2026
31 checks passed
@goosewobbler
goosewobbler deleted the fix/1071-reapply-across-releases branch November 22, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

version: reapplying a change reverted in an earlier release gives no bump

1 participant