Skip to content

feat(core): add CalVer versioning - #384

Open
jrandolf wants to merge 3 commits into
bruits:mainfrom
jrandolf:calver
Open

jrandolf wants to merge 3 commits into
bruits:mainfrom
jrandolf:calver

Conversation

@jrandolf

Copy link
Copy Markdown
Contributor

What has changed?

Closes #382.

  • [packages] versioning = "calver" gives each released package the version YYYY.M.MICRO. SemVer stays the default. The year and month are those of the UTC date, or those of packages.calver_year_month for a release line.
  • If the year and month match the current version, MICRO increases by one. If not, MICRO starts at 0. The bump level of a changeset sets only the changelog heading.
  • A fixed group shares one version, from the highest version of its members that are not ignored.
  • Sampo stops before it writes a file if a version does not increase, if a package in the plan has a pre-release version, or if .sampo/prerelease holds changesets.
  • Two commits also fix behavior that SemVer releases share. When an npm package and a crate have the same name, each exact pin and lockfile takes the version from its own ecosystem. Sampo refuses conflicting inherited Cargo workspace versions before it writes a file. I can move these two fixes to separate PRs if you prefer.

Not in this PR: the GitHub App's comments name numeric bumps, which CalVer does not make. A follow-up can change that wording.

How is it tested?

Config tests (reads_calver_options, rejects_invalid_calver_options), a table test of the version rule (calver_versions_from_utc_or_a_fixed_month), and release tests at a fixed instant for each rule: the bump level, fixed groups, dependents, the refusals, ignored members, automatic entries, the release line, preserved changesets, same-name packages and inherited Cargo versions. Each test fails without the change. cargo fmt, both Clippy configurations, cargo test and pnpm run check pass.

How is it documented?

The "Versioning" and [packages] sections of the CLI README, and minor changesets.

@sampo-s-bot

sampo-s-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🧭 Changeset detected

Merging this PR will release the following updates:

sampo (Cargo) — minor version bump

Minor changes

  • Added packages.versioning = "calver" to use the UTC year and month for sampo release and release pull requests. To pin a release line, also set packages.calver_year_month.

Patch changes

  • Fixed dependency pins and lockfile updates for packages that share a name across ecosystems. Cargo previews and releases stop before they write files if inherited versions conflict or a non-ignored crate outside the plan would inherit a new version.

sampo-core (Cargo) — minor version bump

Minor changes

  • ⚠️ breaking change: Changed detect_all_dependency_explanations to accept borrowed ReleasedPackage records keyed by canonical identifier. Pass only canonical version targets to PackageAdapter::finalize_workspace_roots.

    Set versioning and calver_year_month in Config literals, or use ..Config::default().

  • Added packages.versioning = "calver" to use the UTC year and month for sampo release and release pull requests. To pin a release line, also set packages.calver_year_month.

Patch changes

  • Fixed dependency pins and lockfile updates for packages that share a name across ecosystems. Cargo previews and releases stop before they write files if inherited versions conflict or a non-ignored crate outside the plan would inherit a new version.

sampo-github-action (Cargo) — minor version bump

Minor changes

  • Added packages.versioning = "calver" to use the UTC year and month for sampo release and release pull requests. To pin a release line, also set packages.calver_year_month.

Patch changes

  • Fixed dependency pins and lockfile updates for packages that share a name across ecosystems. Cargo previews and releases stop before they write files if inherited versions conflict or a non-ignored crate outside the plan would inherit a new version.

@github-actions github-actions Bot added documentation Improvements or additions to documentation crt:sampo Changes in Sampo CLI crate. crt:sampo-github-action Changes in Sampo's Github action crate. crt:sampo-core Changes in Sampo core logic or internal utils. devops wip labels Nov 18, 2026
@pjonsson

Copy link
Copy Markdown
Contributor

Two commits also fix behavior that SemVer releases share. When an npm package and a crate have the same name, each exact pin and lockfile takes the version from its own ecosystem. Sampo refuses conflicting inherited Cargo workspace versions before it writes a file.

Is this bullet saying that the released Sampo is mixing up version numbers from different ecosystems for packages with the same name today, and your fix(es) makes Sampo detect the issue and prevent a release with potentially the wrong version number from happening?

@jrandolf

Copy link
Copy Markdown
Contributor Author

Yes, it mixes them up today, but the fix removes the cause and detects nothing. Released Sampo keys new versions by bare name, so a crate and an npm package with the same name can silently take each other's version in exact pins and in the root Cargo.toml; the fix keys versions by ecosystem and name. The refusal is a separate Cargo fix: crates that inherit workspace.package.version and get different versions now stop before Sampo writes anything, where today the release fails after it has written the changelogs, or an unreleased crate silently takes the new version.

@goulvenclech

Copy link
Copy Markdown
Member

Sorry for the delay on this, let me gather my thoughts about it...

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crt:sampo Changes in Sampo CLI crate. crt:sampo-core Changes in Sampo core logic or internal utils. crt:sampo-github-action Changes in Sampo's Github action crate. devops wip documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CalVer versions (YYYY.M.MICRO) as an option

3 participants