fix(core,github-action): stabilize version computation and PR creation#225
Conversation
🧭 Changeset detectedMerging this PR will release the following updates: sampo-core (Cargo) — patch version bumpPatch changes
sampo-github-action (Cargo) — patch version bumpPatch changes
|
There was a problem hiding this comment.
Pull request overview
This PR stabilizes how stable version numbers are computed when transitioning prerelease crates to stable, and updates the GitHub Action flow so a stabilize PR can still be created when changesets were preserved under .sampo/prerelease/.
Changes:
- Add
run_stabilize_releasetosampo-core, includingstabilize_version_from_parsedto correctly strip prerelease suffixes without over-bumping. - Update
sampo-github-actionto compute and execute stabilization via the new core API (without callingexit_prereleasefirst), and to detect prerelease packages even when the normal changesets dir has no pending entries. - Add unit + integration tests covering stabilize scenarios (including preserved-changeset and dry-run cases).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/sampo-github-action/src/sampo.rs | Adds action-layer wrappers to dry-run capture and execute stabilize releases via sampo-core. |
| crates/sampo-github-action/src/main.rs | Ensures Auto mode can still prepare a stabilize PR when prerelease packages exist but the normal changesets dir is empty; switches stabilize PR flow to new stabilize plan/release functions. |
| crates/sampo-core/src/release.rs | Implements run_stabilize_release, threads a stabilize flag into planning, and adds stabilize_version_from_parsed. |
| crates/sampo-core/src/release_tests.rs | Adds integration tests for stabilize behavior across current/preserved changesets and dry-run. |
| crates/sampo-core/src/lib.rs | Re-exports run_stabilize_release. |
| .sampo/changesets/virtuous-lord-vellamo.md | Records the fix as a patch changeset for core + action crates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let plan = sampo::capture_stabilize_plan(workspace)?; | ||
| if !plan.has_changes { | ||
| println!( | ||
| "No stable release changes detected after exiting pre-release. Skipping stabilize PR.", | ||
| ); | ||
| println!("No stable release changes detected. Skipping stabilize PR."); | ||
| git::git( |
There was a problem hiding this comment.
After removing the exit_prerelease call, prepare_stabilize_pr still collects prerelease_packages but no longer uses it, which will produce an unused-variable warning (and can break builds if warnings are denied). Remove the binding, prefix it with _, or use it (e.g., for logging).
What has changed?
sampo-core: Addedrun_stabilize_release, a new public function that transitions prerelease packages to stable. It uses a new privatestabilize_version_from_parsedhelper that strips the prerelease suffix and only applies an additional bump when the changeset requests a larger change than what the prerelease base already encodes (e.g.0.2.7-alpha.6+ patch →0.2.7, not0.2.8). Addedstabilize: booltocompute_plan_stateandprepare_release_planto route version computation through this helper.sampo-github-action:prepare_stabilize_prno longer callsexit_prereleasebefore computing the release plan. It now usescapture_stabilize_planandrun_stabilize_release, which compute the correct stable version in one step.execute_operations(Auto mode) now checks for prerelease packages whencapture_release_planreturns no changes, so a stabilize PR is created even after a prerelease PR has been merged and its changesets moved to.sampo/prerelease/.How is it tested?
test_stabilize_version_from_parsedunit test inrelease.rscovering patch/minor/major bumps against patch-, minor-, and major-implied prereleases, plus stable inputs.release_tests.rs: current-changeset scenarios (Bug 1) and preserved-changeset scenarios (Bug 2), including a dry-run variant.How is it documented?
No documentation changes needed — these are internal fixes with no user-facing API or configuration changes.