Skip to content

fix(resolver): exclude prereleases from stable version ranges - #11

Merged
showxu merged 2 commits into
masterfrom
fix/issue-6-stable-range-prereleases
Oct 17, 2026
Merged

showxu merged 2 commits into
masterfrom
fix/issue-6-stable-range-prereleases

Conversation

@showxu

@showxu showxu commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Stable version ranges could select a prerelease outside the requested range. With tags v1.0.0, v1.1.0, v1.2.0-rc.1, v2.0.0-beta.1, --from 1.0.0 resolved to 2.0.0-beta.1 and --up-to-next-minor-from 1.1.0 resolved to 1.2.0-rc.1, because 2.0.0-beta.1 < 2.0.0 under SemVer precedence.

Range membership is now separate from ordering (SemanticVersion.isInRange(from:to:)) and applies to --from, --up-to-next-minor-from and explicit --from … --to ranges:

  • a stable candidate is eligible when lower <= candidate < upper;
  • a prerelease candidate is also eligible only when a bound that itself has prerelease identifiers shares the candidate's major.minor.patch.

Stable-only ranges therefore never select a prerelease; when no eligible tag exists, resolution fails with the existing "tag in range" error. Explicit prerelease ranges (for example 0.1.0-alpha.1..<0.1.0), prerelease upper bounds, exact matches and SemVer ordering are unchanged.

Validation

  • swift build — pass
  • swift test — 113 tests in 17 suites pass
  • xcrun swift-format lint --configuration .swift-format --recursive Package.swift Sources Tests — exit 0, no warnings in changed files
  • git diff --check — clean
  • Manual check with an isolated HOME: --from 1.0.0 selects 1.1.0; --up-to-next-minor-from 1.1.0 selects 1.1.0; --from 1.2.0 with only 1.2.0-rc.1/2.0.0-beta.1 above fails with tag in range 1.2.0..<2.0.0.

Resolves #6

Versions must be at or above the lower bound and below the upper bound. Prereleases also require a bound with prerelease identifiers and the same major.minor.patch.

Resolves #6
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T07:18:59.775371Z 010b338 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Assert that equal-precedence range tags resolve to the lexicographically highest tag.
@showxu
showxu merged commit 010ccac into master Oct 17, 2026
2 checks passed
@showxu
showxu deleted the fix/issue-6-stable-range-prereleases branch October 17, 2026 07:33
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.

fix(resolver): exclude unintended prereleases from stable version ranges

1 participant