fix(versioning/pep440): drop the local segment from a compatible release - #45383
Open
MLuc24 wants to merge 1 commit into
Open
fix(versioning/pep440): drop the local segment from a compatible release#45383MLuc24 wants to merge 1 commit into
MLuc24 wants to merge 1 commit into
Conversation
A local version segment is not valid in a `~=` specifier, so building one from a new version such as 38.3.3.post1+git.5af13757 produced a range that matches nothing. getNewValue then failed its own satisfies() check, logged "failed to calculate newValue" and returned null, so the update was dropped. Only the local segment is removed; a post release stays, as it is allowed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
~=updates were abandoned when the new version carried a local segment. From the issue:A local version segment is not valid in a compatible release specifier, so that range matches nothing.
getNewValuebuilds the range, fails its ownsatisfies()check at the end, logs the warning and returnsnull, and the dependency is never updated.The
~=branch only reached this when the current value and the new version have the same number of release components, which is why the failure looks narrow:~=38.0.038.3.3.post1+git.5af13757null~=38.3.3.post1~=38.0.038.3.3+local.1null~=38.3.3~=38.0.038.3.3.post1~=38.3.3.post1~=38.038.3.3.post1+git.5af13757~=38.0Only the local segment is dropped. A post release is valid in
~=and stays, which keeps this consistent with what the same input already produced without the+…part.I checked the other operators before settling on this scope:
>=,<, and combined ranges already return the current value untouched when it still matches, and==38.0.0correctly keeps the local segment, since==is one of the two operators that permit it. So the defect really is limited to~=.One note for a maintainer: the issue says the expected result is
~=38.3.0. This PR produces~=38.3.3.post1instead, because that is what~=38.0.0already produces for38.3.3.post1today — matching existing behaviour seemed better than changing the precision rule as part of a bug fix. Happy to switch if you would rather it truncate.Context
AI assistance disclosure
The diagnosis, the fix, the test and this description were produced by Claude Opus 5 running in Claude Code. The before/after values in the table were printed by calling
getNewValueonmainand on this branch, not inferred.Use of AI in replying to PR comments
Who answers review comments:
Answering honestly per the template: @MLuc24 owns this account and directs the work, but has not committed to replying to review comments. If a maintainer asks for changes and nobody responds within a reasonable window, please close this rather than leave it open.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
Added to
lib/modules/versioning/pep440/range.spec.tsrather than theit.eachtable inindex.spec.ts, because the long fixture values there force Prettier to realign every row of that table and bury the change in noise.vitest run lib/modules/versioning/pep440/— 239 passedmainand passes here:tsc --noEmit -p tsconfig.json— cleanoxlint,biome check,prettier --checkon the changed module — cleanI did not run Renovate against a real repository, so the end-to-end update is unverified.