Skip to content

fix(self-upgrade): don't offer a .dev0/.post0 build's base tag as the rollback version - #5358

Merged
mnriem merged 1 commit into
github:mainfrom
goranai:fix-rollback-hint-dev0
Nov 10, 2026
Merged

mnriem merged 1 commit into
github:mainfrom
goranai:fix-rollback-hint-dev0

Conversation

@goranai

@goranai goranai commented Nov 10, 2026

Copy link
Copy Markdown

Description

_stable_release_tag_for_version() is documented to return vX.Y.Z "only for exact stable release versions", but it tested parsed.post and parsed.dev for truthiness. Both are ints, so X.Y.Z.dev0 and X.Y.Z.post0 (dev == 0, post == 0) were accepted as the stable tag vX.Y.Z.

Main always carries X.Y.Z.dev0, and docs/install/pipx.md documents installing from main. So after a failed specify self upgrade from 1.3.4.dev0 to v1.3.4, the rollback hint tells the user to "pin back to the previous version" with ...spec-kit.git@v1.3.4, which is the release that just failed. The fix compares against None, so these versions fall back to the existing "Previous version was not an exact stable release tag" message, as rc and dev1 already do.

1.3.4.dev0   -> v1.3.4     (before: wrong)   -> None (after)
1.3.3.post0  -> v1.3.3     (before: wrong)   -> None (after)
1.3.4.dev1   -> None       (unchanged)
1.3.3        -> v1.3.3     (unchanged)

Testing

Added test_dev0_failure_does_not_suggest_unreleased_tag_as_rollback and test_post0_failure_degrades_rollback_hint_to_releases_page next to the existing pre-release rollback test. Both fail on main and pass with this change.

  • Tested locally with .\.venv\Scripts\specify.exe --help
  • Ran relevant existing tests with .\.venv\Scripts\python.exe -m pytest tests/specify_cli/test_version_execution.py tests/specify_cli/test_version_verification.py -q: 56 passed, 3 skipped, 1 failed. The failure is test_non_windows_uv_tool_dry_run_still_previews_installer, which fails identically on unmodified main on Windows (POSIX-only scenario).
  • Tested with a sample project (not applicable)

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

AI disclosure: Claude Code (model: Claude Opus 5.5), autonomous agent mode. The agent found the bug by reading the code, wrote the reproduction, the fix and both regression tests, and ran the tests. I reviewed the finding and approved submitting it.

🤖 Generated with Claude Code

… rollback version

packaging's Version.dev/.post are ints, so X.Y.Z.dev0 and X.Y.Z.post0 passed the stable-release check and the rollback hint pointed at vX.Y.Z.

Assisted-by: Claude Code (model: Claude Opus 5.5, autonomous)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@goranai
goranai requested a review from mnriem as a code owner November 10, 2026 04:52
Copilot AI auto review requested due to automatic review settings November 10, 2026 04:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported, and the change includes targeted regression coverage for the corrected rollback behavior.

No open issues 🎉

What changed in this PR

This pull request fixes rollback guidance for self-upgrades originating from .dev0 and .post0 versions by ensuring only exact stable releases produce a rollback tag.

Changes:

  • Changed stable-version detection to distinguish None from falsy development and post-release values.
  • Added regression tests for .dev0 and .post0 rollback behavior.
  • Preserved existing rollback handling for stable and other prerelease versions.
File Description
tests/​specify_cli/​test_version_execution.py Adds regression tests verifying that failed upgrades from .dev0 and .post0 versions do not suggest the failed release as a rollback target.
src/​specify_cli/​_version.py Corrects stable release-tag detection by comparing version components against None rather than relying on truthiness.

Review effort: Lite (auto)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported, and the change includes targeted regression coverage for the corrected rollback-tag detection.

No open issues 🎉

Review effort: Lite (auto)

@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Nov 10, 2026
@mnriem
mnriem merged commit 6eb83a5 into github:main Nov 10, 2026
16 checks passed
@mnriem

mnriem commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

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

Labels

triage-must-have Verdict: high-value, important work for Spec Kit — do first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants