← LeaderboardThe Skill Leaderboard

rust-semver-prerelease-selection

Select Rust semver prereleases for a named release line. Verify VersionReq admission for preview versions separately from version precedence.

Published by sickn33 ↗sickn33/agentic-awesome-skills

Try your first task

A source-grounded starter task has not been verified for this skill yet.

SKILL.md

name: rust-semver-prerelease-selectiondescription: Select Rust semver prereleases for a named release line. Verify VersionReq admission for preview versions separately from version precedence.category: developmentrisk: criticalsource: selfsource_type: selfdate_added: "2026-12-03"author: ShianMiketags: [rust, semver, versionreq, prerelease, version-selection]

Rust semver prerelease selection

When to Use

  • An opted-in update channel skips a prerelease that appears to be above the minimum version.
  • A Rust resolver passes prerelease candidates through semver::VersionReq.
  • A tool must retain stable selection and preview a specific upcoming release.

Prerequisites

  • Locate the parsed version requirement, candidate list, and caller responsible for the opt-in.
  • Define the allowed release line and earliest acceptable prerelease. Clarify whether a label such as beta is a separate policy.
  • Use the project's resolved semver crate. The example uses semver 1.0.28 with synthetic versions.

1. Separate candidate admission from precedence

  1. Inspect both the candidate's version and the actual requirement. General bounds can include the candidate by precedence while matches still rejects a prerelease.
  2. The semver crate requires an explicit comparator with a nonempty prerelease and the same major, minor, and patch for the candidate to enter prerelease matching.
  3. Trace which matching branch the caller uses in stable mode and preview mode. A comparator for 1.2.3-beta.1 does not itself admit 1.3.0-beta.10.
  4. Rank admitted candidates using the intended version comparator. cmp_precedence implements SemVer precedence without build metadata.

2. Keep stable and preview policy explicit

  • Keep the established stable requirement and use it for stable releases. Give the preview path its own requirement or a documented policy for allowed release lines.
  • For previews of 1.3.0 starting at beta.2, use a requirement such as >=1.3.0-beta.2, <1.3.0. A release-line requirement can admit later prerelease labels such as rc. Enforce an additional label rule only when the product calls for it.
  • Apply preview rules only for opted-in candidates while retaining stable fallbacks. Decide whether the scope advances to another release line automatically or comes from configuration.
  • Use a distinct rule for choosing among artifacts with equal precedence when their build metadata identifies different deliverables.

3. Test the result of the real selection

  1. Verify matches for the intended line, a prerelease before the lower bound, a different line, and the final release.
  2. Use an unsorted catalog containing a stable fallback and prereleases with numeric identifiers such as beta.2 and beta.10.
  3. Assert the version selected in both modes. Add the final release and verify whether it takes precedence according to the product policy.
  4. Test catalog or resolver integration separately when candidate discovery, yanks, locks, or platform filters can affect selection.

Example

Test the selected release shows an old prerelease comparator silently leaving the preview channel on a stable fallback. A requirement for the intended release line selects the correct preview and still prefers its final release when available.

Limitations

  • The fixture implements one application policy over a list of parsed versions. It does not run Cargo dependency resolution or test a registry, locks, artifact download, or yanking.
  • The preview requirement can cover multiple prerelease labels on its matching release line. Test separate channel labels when needed.
  • Equal SemVer precedence does not identify a unique artifact when build metadata differs.

Safety and Side Effects

The sample uses only local, synthetic version strings. Changes to update policy can alter real artifact selection. Validate the policy against the caller's stable and preview channels before changing a production resolver.

Related Skills and Documentation