Skip to content

feat(version): support prerelease channels, Release-As, and a version label for calver targets - #335

Closed
nateships wants to merge 11 commits into
monkescience:mainfrom
nateships:feat/calver-prerelease-channels
Closed

nateships wants to merge 11 commits into
monkescience:mainfrom
nateships:feat/calver-prerelease-channels

Conversation

@nateships

@nateships nateships commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Suggested title: feat(version): support prerelease channels, Release-As, and a version label for calver targets

What

Calver targets can now release on a prerelease channel, honour a Release-As footer, and carry a fixed version label such as beta on every stable release. Before, a channel run with a calver target failed with prerelease channel "beta" supports semver targets only, calver targets ignored Release-As, and there was no way to keep a label on the main line.

Small commits, so Release-As or the derived target fix can be dropped or split out if you prefer:

  1. feat(version): support prerelease channels for calver targets
  2. feat(version): support Release-As for calver targets
  3. fix(release): keep Release-As over child bumps on semver and calver derived targets (also changes semver, see Behaviour notes)
  4. refactor(version): skip the prerelease comparison for equal calver suffixes
  5. docs(versioning): say when the calver prerelease counter restarts
  6. fix(release): ignore a calver Release-As value in another format
  7. fix(diagnostics): fit the Release-As hint to the problem
  8. feat(version): add a fixed label for calver releases
  9. docs(versioning): describe the calver label
  10. fix(versionfile): keep hyphens in a prerelease suffix (also changes semver, see Behaviour notes)
  11. fix(diagnostics): hint to remove the label from a calver Release-As value

Commits 8 to 11 add the label and can also be split into their own PR if you prefer. They reuse the calver suffix parsing of commit 1.

Why

Projects that use calver also ship betas, for example 2026.11.1-beta.1, 2026.11.1-beta.2, then 2026.11.1. The channel mechanics (branches, channel changelogs, prerelease provider releases) are already scheme-neutral; only the calver strategy refused prereleases.

Other projects go through a public beta phase on their main line: every release is a beta, and these betas are the latest releases that users install. They want 2026.11.1-beta, 2026.11.2-beta, 2026.12.1-beta, and at general availability they drop the label and continue with 2026.12.2. A channel does not fit, because channel releases are prereleases with a counter, and "latest" on the provider must point at the beta.

Behaviour

A channel prerelease is the version the next stable release would get now, plus -<prerelease>.<N>. N continues while that version stays the same and restarts at 1 when it changes. Stable runs still ignore prerelease tags.

Format YYYY.0M.MICRO, beta channel, release in November 2026:

Latest tag on the branch Run Next version
none beta 2026.11.1-beta.1
v2026.11.1-beta.1 beta 2026.11.1-beta.2
v2026.11.1 beta 2026.11.2-beta.1
v2026.11.2-beta.1 beta 2026.11.2-beta.2
v2026.11.1, with v2026.11.2-beta.* on the beta branch stable 2026.11.2
v2026.10.4-beta.2 beta 2026.11.1-beta.1
v2026.11.1 + Release-As: 2026.11.5 stable 2026.11.5
v2026.11.2-beta.1 + Release-As: 2026.11.5 beta 2026.11.5-beta.1

Version label, calver.label: beta, stable run, release in November 2026:

Latest tag on the branch calver.label Next version
none beta 2026.11.1-beta
v2026.11.1-beta beta 2026.11.2-beta
v2026.11.2 (label added) beta 2026.11.3-beta
v2026.11.2-beta (label removed) none 2026.11.3
v2026.10.4-beta beta 2026.11.1-beta
v2026.11.2-alpha (label changed) beta 2026.11.3-beta
v2026.11.1-beta + Release-As: 2026.11.5 beta 2026.11.5-beta
v2026.11.2-beta, beta channel run beta 2026.11.3-beta.1

Details:

  • Calver tags accept a semver prerelease suffix (v2026.11.1-beta.1). They sort below their stable release: 2026.11.1-beta.1 < 2026.11.1-beta.2 < 2026.11.1. Stable runs filter them out, as for semver.
  • x-yeet-version gets the full prerelease version. Segment markers (x-yeet-month, x-yeet-micro, ...) get the base.
  • Release-As on calver must match the configured format, be stable, be newer than the current version, and not be in a later period than today (a future version would make the next run fail with "current calver is from a future calendar period"). The footer value is normalized to the format (2026.1.5 becomes 2026.01.5). A value that is in the format but breaks one of these rules fails the release, as an invalid semver footer does. A value that is not in the format is ignored for that target with a warning, as before (see Behaviour notes).
  • The prerelease counter helper and the channel membership check are shared with semver (nextPrereleaseCounter, prereleaseAllowed); semver behaviour is unchanged.
  • Label. calver.label (top level or per target; a target inherits the top-level label and can set its own) adds -<label> to every stable version. A labeled version is a release, not a prerelease: MICRO counts it, stable runs keep its tag, and the provider release is created with prerelease: false, so "latest" points at it. This needs no new publishing code: the provider prerelease flag already comes from the channel, and a labeled release runs on the stable branch. Removing the label continues MICRO from the latest tag, labeled or not. Channel versions do not carry the label. A Release-As value is given without the label and yeet adds it; a value with a label is rejected.
  • Label versus prerelease. A label is one semver prerelease identifier with at least one letter and no dot (letters, digits, and hyphens). A channel suffix always has a counter after a dot. So yeet tells them apart from the tag alone, without the config: v2026.11.2-beta is a labeled release and v2026.11.2-beta.1 is a prerelease. This matters at general availability, when the label is no longer configured but the old tags must still count. Ordering stays semver: 2026.11.1-beta < 2026.11.1 < 2026.11.2-beta.
  • The channel gate in withChannelChangelogs stays, with a scheme-neutral message. Both built-in schemes now return true from SupportsPrerelease and SupportsReleaseAs, so that gate and warnUnsupportedReleaseAs are only reachable from tests. I kept them to keep the diff small; happy to remove them in this PR or a follow-up.

Behaviour notes

  • Semver derived targets change (commit 3, easy to split out). A derived target with a Release-As footer in its own commits lost the requested version when an included target had a higher bump: yeet re-planned from the child bump and dropped the footer. It now keeps the footer. For semver this changes a result: current 1.0.0, Release-As: 1.0.1 on the derived target and a feat in a child now gives 1.0.1 instead of 1.1.0, which matches what a path target already does. The plan still reports the higher child bump type. If you want semver left as it was, I can move this commit to its own PR or limit it to calver.
  • Release-As in another format on a calver target (commit 6). A value that is not in the calver format of a target, such as 2.0.0, gives the warning ignoring release override in another version format with hint="use the calver format YYYY.0M.MICRO to set the version of this target", and yeet ignores it for that target. This keeps repositories with semver and calver targets working: one commit with Release-As: 2.0.0 that touches both sets the semver target to 2.0.0, and the calver target releases normally. A value in the calver format that is a prerelease, not newer, or in a later period still fails. Semver is unchanged: a value that is not valid semver still fails. The body of commit 2 says a footer in another format fails the release; commit 6 replaces that rule.
  • A calver suffix without a dot is now a label (commit 8). In commit 1, a tag such as v2026.11.2-beta (no counter) was a prerelease of 2026.11.2, and a beta run continued it as 2026.11.2-beta.1. With commit 8 that tag is a labeled release of 2026.11.2, so stable runs see it and a beta run continues with 2026.11.3-beta.1. Channel tags always have a counter, so tags that yeet creates are not affected. On main before this PR, calver ignored every tag with a suffix.
  • Hyphens in a prerelease suffix in version files (commit 10). The version file pattern stopped a prerelease suffix at the first hyphen, so x-yeet-version on 1.2.3-rc-1 became 1.2.4-1, and on a label such as 2026.11.1-public-beta it became 2026.11.2-public-beta-beta. The suffix now accepts hyphens, as the build metadata part of the same pattern already did. This also fixes semver versions with a hyphen in the prerelease.
  • Release-As with a label (commit 11). A value such as Release-As: 2026.11.5-beta on a target with calver.label: beta fails with requested version must not include a label and hint="remove the label from the version, calver.label adds it".
  • Release-As hint (commit 7). The hint for an invalid Release-As value was always use a stable version newer than the current version. For a calver value in a later period it is now use a version from the current calendar period. The other cases keep the old hint, so the existing golden files do not change. The switch also maps the format reason to use a version in the version format of the target, but a release run never reaches it, because commit 6 warns and skips that value first.

Tests

  • internal/version: calver channel NextRelease table (same period, new period and new year, first beta of a period, counter past 9, no counter, padded and unpadded formats, day and week formats, future period, invalid counter, no bump), stable Next after a beta, prerelease tag parsing and rejection, OrderedRefs ordering and channel filtering, Release-As (normalize, apply, channel suffix, bump, five rejection cases).
  • internal/release: channel planning through the releaser with a fixed clock (no tags, first beta of the period, stable tag, beta tag, beta from an earlier month, stable run after betas), calver Release-As planning, a calver value in another format ignored with a warning (and a calver footer in another commit still applied), a future-period calver value rejected, a semver and calver repository where one commit with Release-As: 2.0.0 touches both targets (2.0.0 and 2026.11.1), Release-As on semver and calver derived targets with a higher child bump, the gate message with a strategy that has no prerelease support.
  • internal/version (label): label validation (accepted and rejected labels, NewCalVer rejects an invalid label), NextRelease with a label (first release, same period, new period, label added in the middle of a period, label removed in the same and in a later period, label changed, unpadded and day formats, future period), channel versions without the label, labeled tag parsing with a strategy that has no label, OrderedRefs with labeled and unlabeled tags mixed on stable and channel runs, Release-As with a label (added, a value with a label rejected, the version of the current labeled release rejected).
  • internal/config: invalid top-level and target labels, a target inherits or overrides the label.
  • internal/release (label): planning with a fixed clock (no tags, labeled tag in the period, labeled tag from an earlier period, label removed, channel prerelease tags ignored), and an auto-merged labeled release created with Prerelease: false.
  • internal/versionfile: markers with a calver prerelease version, with a labeled version, and after the label is removed.
  • internal/versionfile (fix): a semver version with a hyphen in the prerelease, and a calver label with a hyphen.
  • tests/ (binary, fake GitHub): labeled release after a labeled tag, release without the label after a labeled tag, a Release-As value with a label rejected with the label hint, a dotted label rejected by config validation. Also, beta after a stable tag, counter reset in a new period, stable run ignores beta tags, calver Release-As applied, calver Release-As in another format ignored with the warning and hint, calver Release-As from a future period rejected with the period hint. These use tags from 2025 so they do not depend on the current month.
  • Updated tests that pinned the old refusals.

make fmt, make lint (0 issues), make test, and make build pass.

Manual check with the binary and the fake GitHub provider, run in October 2026 with calver.label: beta: no tags gives 2026.10.1-beta; after v2026.10.1-beta gives 2026.10.2-beta; with the label removed after v2026.10.2-beta gives 2026.10.3. Finalizing a merged release PR for v2026.10.2-beta logs creating release tag=v2026.10.2-beta ... prerelease=false.

Docs

  • docs/versioning.md: calver prerelease versions, and when the counter restarts.
  • docs/release.md: replaced "Channels require semver." with a link to the calver rules.
  • docs/commits.md: Release-As on calver targets, and the warning for a value in another format.
  • yeet.schema.json: the channels description no longer says semver, and calver has a label property.
  • docs/versioning.md: a "Version label" section under Calver.
  • docs/release.md: labeled calver versions are stable releases, not prereleases.
  • docs/configuration.md: the version marker writes the full version, including a prerelease suffix or a label.
  • docs/commits.md: give Release-As without the label.

Out of scope

A channel on the stable branch itself (no separate beta branch) is still refused by validation. That is a separate question for its own issue.

  • A label for semver targets. With semver, 1.3.0-beta already means "before 1.3.0", and stable runs, channel filtering and bump planning all treat a suffix as a prerelease, so it is not a small change. Calver has no such meaning for the suffix.
  • An option to publish labeled releases as provider prereleases. They are published as normal releases because they are the latest releases of the project. If you want an opt-in, it could be a separate setting.
  • A way for a target to turn off a label it inherits from the top level. Today a target can only set its own label.

Questions

  • Is calver.label a good name? label is also used for PR labels under release.labels. Alternatives: calver.suffix or calver.prerelease_label.
  • Should a label be allowed to have dots, such as public.beta? I did not allow it so that the tag alone tells a label from a channel prerelease.

Security impact

None. The only new input is the label, which is validated as one semver prerelease identifier. Version strings are parsed and validated the same way as semver prerelease identifiers.

A calver prerelease adds the channel suffix to the version that the next
stable release would get, such as 2026.11.2-beta.1. The counter continues
while that version stays the same and restarts at 1 in a new period. A
stable release in the same period then takes that version.

Calver tags with a semver prerelease suffix now parse, sort below their
stable release, and update version file markers.
A Release-As footer on a calver target now sets the next version. The
value must match the configured format, be stable, be newer than the
current version, and not be in a later calendar period. On a prerelease
channel yeet adds the channel suffix, such as 2026.11.5-beta.1.

Before, calver targets ignored the footer with a warning. A footer that
is not valid for the calver format now fails the release, as it does for
semver targets.
…erived targets

A derived target with a Release-As footer in its own commits lost the
requested version when an included target had a higher bump. yeet then
planned the next version from the child bump and ignored the footer.

yeet now plans the derived target again with the higher bump and keeps
the requested version. This also changes semver derived targets: with
Release-As: 1.0.1 and a child feature, the derived target now releases
1.0.1 instead of 1.1.0, as a path target already does.
…ffixes

compareCalVerParts returned through a semver comparison even when both
suffixes were equal, which includes two stable versions. It now returns
early in that case.
The counter restarts when the version the next stable release would get
changes, such as after a stable release or in a new period, not only in
a new period.
A Release-As footer that is not in the calver format of a target now
gives a warning and yeet ignores it for that target, as before calver
supported the footer. One commit in a repository with semver and calver
targets can then set the semver version, such as Release-As: 2.0.0, and
the calver target still releases normally.

A value in the calver format that breaks a rule still fails the release,
as a semver value does: it must be stable, newer than the current
version, and not in a later calendar period.
The hint for an invalid Release-As value always said to use a stable
version newer than the current version. For a calver value in a later
calendar period that advice is wrong, because a newer version does not
help. The hint now asks for a version from the current calendar period
in that case, and for the version format of the target when the format
does not match. Other problems keep the old hint.
A calver.label such as beta is added to every stable version, for example 2026.11.1-beta. A labeled version is a release: MICRO counts it, stable runs keep its tag, and the provider release is not a prerelease. Without the label, MICRO continues from the latest tag, labeled or not.

A label is one identifier with at least one letter and no dot, so a labeled tag (v2026.11.2-beta) is different from a channel prerelease tag (v2026.11.2-beta.1).
The version pattern stopped a prerelease suffix at the first hyphen. A marker with 1.2.3-rc-1 or a calver label such as 2026.11.1-public-beta became 1.2.4-1 or 2026.11.2-public-beta-beta. The suffix now accepts hyphens, as the build metadata already did.
…alue

A Release-As value with a label, such as 2026.11.5-beta on a target with calver.label, gave the hint to use a stable version newer than the current version. The hint now says to remove the label, because calver.label adds it.
@nateships nateships changed the title feat(version): support prerelease channels and Release-As for calver targets feat(version): support prerelease channels, Release-As, and a version label for calver targets Oct 30, 2026
@ValentinLutz

Copy link
Copy Markdown
Member

This PR combines several independent changes, and some of them also change semver behaviour. Please split it into small, focused PRs so each one can be reviewed and released on its own. I'll review the details in the split PRs.

Split

PRs that can go ahead:

  1. fix(versionfile): keep hyphens in a prerelease suffix (commit 10)
  2. fix(release): keep Release-As over child bumps on derived targets (commit 3, without the calver test that depends on commit 2)
  3. feat(version): prerelease channels for calver targets (commits 1 and 5, commit 4 is not needed since semver.Compare already returns 0 for equal suffixes)

Please open an issue first for these two, as CONTRIBUTING.md asks for larger changes:

  1. calver.label (commits 8, 9, 11)
  2. Release-As for calver targets (commits 2, 6, 7)

Use cases for label and calver Release-As

Before any code for 4 and 5, I'd like to understand the use case:

  • calver.label: who needs a label in the version string of every stable release? PEP 440, npm and Cargo treat -beta as a prerelease, so downstream tools would see these releases as prereleases. Could name_template (for example {{ .Tag }} (beta)) cover the need instead?
  • Calver Release-As: in calver the date decides the version, so the footer can mostly only skip MICRO numbers. What is the concrete case? If it is forcing a release without releasable commits, a mechanism that does not require writing the next version by hand might fit calver better.

@nateships

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I split the PR as you suggested:

  1. fix(versionfile): keep hyphens in a prerelease suffix #345 fix(versionfile): keep hyphens in a prerelease suffix (commit 10, without the calver label test row)
  2. fix(release): keep Release-As over child bumps on derived targets #346 fix(release): keep Release-As over child bumps on derived targets (commit 3, without the calver test)
  3. feat(version): support prerelease channels for calver targets #347 feat(version): prerelease channels for calver targets (commits 1 and 5, commit 4 removed)

All three are rebased on main after 0.18.0. #347 also works with the new optional micro segment, and has tests for it.

For calver.label and calver Release-As, I will open issues with the use cases first, as CONTRIBUTING.md asks. I am closing this PR.

@nateships nateships closed this Oct 31, 2026
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.

2 participants