Skip to content

Conversation

@Turbo87
Copy link
Contributor

@Turbo87 Turbo87 commented Dec 8, 2025

Changes

This PR adds a new rust-release-channel versioning scheme, based on the "Toolchain specification" section of https://rust-lang.github.io/rustup/concepts/toolchains.html.

This was extracted from #39529 so that it can be reviewed and merged separately from the corresponding data source.

Context

Please select one of the following:

  • This closes an existing Issue, Closes: #
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

I did not find an open issue for this at first glance, but there are a couple of related issues/PRs/discussions:

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

I did use Claude Code for the initial draft, but reviewed, adjusted and tested everything manually afterwards.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests, but ran on a real repository, or
  • Both unit tests + ran on a real repository

The public repository: https://github.com/Turbo87/renovate-rust-test/pulls?q=is%3Apr

@Turbo87 Turbo87 force-pushed the rust-versioning branch 2 times, most recently from 0e72d7f to 6ba630a Compare December 8, 2025 13:29
@zharinov zharinov self-requested a review December 9, 2025 23:42
Copy link
Collaborator

@zharinov zharinov left a comment

Choose a reason for hiding this comment

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

LGTM as far as unit tests reflect the desired behavior (it looks like)

${'1.83.0-beta.5'} | ${false}
${'1.83.0-beta'} | ${false}
${'nightly-2025-11-24'} | ${false}
${'stable'} | ${false}
Copy link
Collaborator

Choose a reason for hiding this comment

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

the irony 😆

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hehe, yeah, but from what I understand isStable() expects a version string, not a random input string, so everything that is not a stable version is rejected by the implementation.

${'nightly-2025-11-23'} | ${'nightly-2025-11-24'} | ${false}
${'nightly-2024-11-24'} | ${'nightly-2025-11-24'} | ${false}
${'nightly-2025-10-24'} | ${'nightly-2025-11-24'} | ${false}
${'1.82.0'} | ${'nightly-2025-11-24'} | ${false}
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is this decided?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we always treat nightlies as greater than the other versions to achieve a stable sort order. isCompatible() is implemented to treat nightlies as incompatible to the other versions, so this will not actually matter much in practice.

const parsedVersion = parse(version);
const parsedCurrent = parse(current);
if (!parsedVersion || !parsedCurrent) {
return true;
Copy link
Collaborator

Choose a reason for hiding this comment

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

true? If we cannot parse versions shouldn't we return false.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figured that since the default impl for isCompatible() returns true in all cases then we might want to do the same, but I don't have a strong opinion on this. I'll change it to false instead.


// Sort and return the highest (last in sorted array)
matching.sort((a, b) => this.sortVersions(a, b));
return matching[matching.length - 1];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return matching[matching.length - 1];
return matching.slice(-1);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did you mean matching.slice(-1)[0]? .slice() returns an array, but getSatisfyingVersion() is supposed to return a single string

return null;
}

sortVersions(version: string, other: string): number {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be called compareVersions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

3 participants