Skip to content

feat(prepare): Handle prereleases in auto-versioning and add pre version - #957

Merged
BYK merged 4 commits into
masterfrom
fix/auto-version-after-prerelease
Nov 3, 2026
Merged

BYK merged 4 commits into
masterfrom
fix/auto-version-after-prerelease

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Auto-versioning analyzed commits since the latest tag, even when that tag was a prerelease. After getsentry/symbolic released 14.0.0-alpha.5, craft prepare with versioning.policy: auto failed because no commits came after the alpha (run):

[info] Analyzing commits since 14.0.0-alpha.5 for auto-versioning...
[error] Cannot determine version automatically: no commits found since the last release.

The GitHub release, npm (next), crates.io, and PyPI already treat 14.0.0-alpha.5 as a prerelease, so publishing doesn't need a fix. Only prepare picked the wrong base.

Behavior

Version (auto, pre, bump types)

  • auto and pre pick the bump type from the commits since the latest stable tag. The bump applies to the latest tag.
  • New pre version: calculates the version auto would release and cuts a prerelease of it. After 1.9.0 that's 1.9.1-alpha.0 for a patch, 1.10.0-alpha.0 for a minor, or 2.0.0-alpha.0 for a major. If the latest tag is already a prerelease of that version, pre cuts the next one instead: 14.0.0-alpha.5 → 14.0.0-alpha.6.
  • If the latest tag is a prerelease and auto would cut a major release, it cuts the next prerelease instead and logs how to get the stable release (craft prepare 14.0.0 or major). Non-major promotions still go stable: 1.1.0-alpha.0 → 1.1.0.
  • Bump types promote a prerelease: major after 14.0.0-alpha.5 gives 14.0.0.

Changelog base (also the previous_tag output used for the publish issue's "View changes" link)

  • Stable release: the latest stable tag, so 14.0.0 lists everything since 13.9.0, including what the alphas shipped.
  • Prerelease: the previous prerelease of the same major.minor.patch (14.0.0-alpha.5 follows 14.0.0-alpha.4). If there isn't one, the latest stable tag (14.1.0-alpha.0 follows 14.0.12, not 14.0.0-alpha.3).
  • preReleaseCommand still gets the latest tag as the old version, because that version is what the project files contain.

Implementation

  • git.ts: findLatestTag() runs git describe again with --exclude for each tag it rejects, scoped to the tag prefix. getLatestStableTag() and getChangelogBaseTag() are built on it. When tags exist but none can describe HEAD (fatal: No tags can describe), the lookups return '', just like when there are no tags.
  • autoVersion.ts: calculatePrerelease(version, currentVersion). New series use the alpha identifier.
  • prepare.ts: accepts pre, applies the rules above, and uses getChangelogBaseTag() for the changelog.
  • Docs (versioning.md) and the version input description in action.yml.

craft changelog (the PR preview) still uses the latest tag.

Verification

  • Unit tests for calculatePrerelease, getLatestStableTag, getChangelogBaseTag, and accepting pre. Two e2e dry-run tests: promoting 1.1.0-alpha.1 to 1.1.0, and auto cutting 2.0.0-alpha.1 after 2.0.0-alpha.0 with a changelog of only the new commit.
  • Manual dry runs of the built binary covered this sequence: pre → 1.1.0-alpha.0 (since 1.0.0), pre → 1.1.0-alpha.1 (since alpha.0), auto → 1.1.0 (since 1.0.0), explicit 2.0.0-alpha.0 (since 1.0.0), pre after a breaking change → 2.0.0-alpha.0, auto → 2.0.0-alpha.1, major → 2.0.0 (since 1.0.0).
  • tsc, eslint, and prettier pass. My sandbox's git wrapper rejects the test author overrides, so I couldn't run the e2e file there. CI passed on the first commit.

--

View Session in Sentry

…leases

Auto-versioning analyzed commits since the latest tag, even when that tag was a
prerelease. Promoting a prerelease with no new commits failed with "no commits
found since the last release", and the changelog of the stable release listed
only the changes since the last prerelease.

Auto-versioning and the changelog of a stable release now start from the latest
stable tag. The bump still applies to the latest tag, so 14.0.0-alpha.5
becomes 14.0.0. Prereleases keep their changelog since the previous tag.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-11-03 16:50 UTC

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let's refine the design a bit:

  1. We should have a pre magic version to cut the next pre-release
  2. If the latest release was a pre release and the next version is a major, auto should cut a new pre release to be safe
  3. When doing a pre-release it should list the changes since the last relevant pre-release if there is one. Like 14.0.0-alpha.5 should list changes from 14.0.0-alpha.4 but if we are cutting 14.0.0-alpha.0 we shouldn't get diff from 13.0.0-alpha.3 for instance but whatever the latest 13 stable release was. Or if it was 14.1.0-alpha.0, then it should be whatever stable was before 14.1.0 like 14.0.12.
  4. Any "stable" release should just get the diff from the previous stable release, ignoring any pre-releases in between.

Makes sense?

…major

- `pre` cuts the next prerelease: it continues the current series when the
  bump stays in it (14.0.0-alpha.5 -> 14.0.0-alpha.6) and starts a new one
  otherwise (13.9.0 with a major bump -> 14.0.0-alpha.0).
- After a prerelease, `auto` cuts another prerelease instead of a major
  release. Pass the version or `major` to release it.
- A prerelease's changelog lists the changes since the previous prerelease of
  the same major.minor.patch, or since the latest stable tag when it starts a
  new series. Stable releases still list the changes since the latest stable
  tag.
@sentry-junior sentry-junior Bot changed the title fix(prepare): Base stable releases on the last stable tag after prereleases feat(prepare): Handle prereleases in auto-versioning and add pre version Nov 3, 2026
Comment thread src/utils/__tests__/autoVersion.test.ts Resolved
Comment thread src/utils/__tests__/autoVersion.test.ts Resolved
…ease

calculatePrerelease() now takes the version auto would release instead of a
bump type, so pre reads as "auto, then make it a prerelease":
1.9.0 -> 1.9.1-alpha.0 for a patch, 1.10.0-alpha.0 for a minor. Behavior is
unchanged. Renames the e2e tests to name the versions they release.
Comment thread docs/src/content/docs/versioning.md Resolved
Comment thread docs/src/content/docs/versioning.md Resolved
Comment thread src/utils/__tests__/git.test.ts Resolved
…on a real repo

- `pre` needs minVersion >= 3.9.0, like other versioning features that are
  gated on the Craft version that introduced them.
- Replace the mocked getLatestStableTag tests, which asserted git arguments,
  with tests that read tags from a real repository.
- Use 2.1.0-alpha.3 -> 2.1.0 as the promotion example in the docs, since a
  major release after a prerelease stays a prerelease with auto.
BYK added a commit to getsentry/junior that referenced this pull request Nov 3, 2026
…eople involved (#2623)

A requester reviewed their own Junior pull request
(getsentry/craft#957). The watch reply mentioned them and then named
their GitHub login as a second person: "@burak Yigit Kaya BYK requested
changes on …".

The doer resolved to the right Slack user, so identity linking works.
The gap is in the doer line of the task input. It says "write to them as
you, and do not also call them <handle>" only when the doer is also in
People involved. The webhook adds People involved only to approval and
merge events. For `changes_requested` and `commented` reviews, the agent
got "That is the same person" with no rule against the double naming.
The junior-prod watch intent then asks it to mention the requester and
to name the reviewer, so it did both.

The fix adds the rule for a doer outside People involved: "If you
mention them, write to them as "you", and do not also call them
"<handle>"." The People involved wording does not change.

<!-- junior-request-attribution:start -->
via @BYK.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:local%3Aweb%3A7e24d58bb1265f0d1dbcdff7 -->

--

[View Session in
Sentry](https://sentry.sentry.io/explore/conversations/local%3Aweb%3A7e24d58bb1265f0d1dbcdff7/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: BYK <126780+BYK@users.noreply.github.com>
@BYK
BYK merged commit 8240d4b into master Nov 3, 2026
29 checks passed
@BYK
BYK deleted the fix/auto-version-after-prerelease branch November 3, 2026 16:49
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.

1 participant