Commit Graph

11 Commits

Author SHA1 Message Date
Sebastian Poxhofer c94897829c fix(versioning/poetry): accept PEP 440 specifiers instead of a lookup special case (#46147)
* refactor(versioning/poetry): accept PEP 440 specifiers instead of a lookup special case

`filterVersions()` carried a poetry-shaped branch: when `allowedVersions` was no
valid poetry range but a valid PEP 440 specifier, it matched releases with the
pep440 versioning instead. Poetry accepts PEP 440 specifiers, so the poetry
versioning is where that belongs: `isValid()` falls back to `pep440.isValid()`
and `matches()` to `pep440.matches()` for a range poetry's own syntax cannot
express, and the three versioning imports leave `filter.ts`.

The `config.versioning !== npmVersioning.id` guard on the semver fallback is
dropped as well: npm's `isValid()` is `validRange()` over a normalisation which
only rewrites x-ranges, so it accepts everything `semver.validRange()` accepts
(checked over 163k generated ranges) and the fallback was already unreachable
for npm versioning.

Behaviour changes:

- Poetry `isValid()` now accepts PEP 440 specifiers such as `!=1.2.3` or
  `>=2.6, !=3.0.*, <4`, which it used to reject. The poetry manager is
  unaffected, because it tests pep440 before poetry when picking a versioning.
- Poetry `matches()` now answers those ranges through pep440 everywhere, not
  only for `allowedVersions`.
- For poetry versioning, an `allowedVersions` which is an invalid poetry range
  but valid as both a semver range and a PEP 440 specifier is now matched by
  pep440 rather than semver, because the pep440 fallback moved ahead of the
  semver one.

* fix(versioning/poetry): route every PEP 440-only range to pep440

CI caught `python` versioning's `isLessThanRange('1.9.0', '== 2.7.*')` throwing
`Invalid comparator: ==`: since poetry `isValid()` accepts PEP 440 specifiers,
the python wrapper dispatched that range to poetry, whose npm-based
`isLessThanRange()` cannot parse it. Only `matches()` had the pep440 fallback.

`isLessThanRange()`, `getSatisfyingVersion()`, `minSatisfyingVersion()` and
`getNewValue()` now delegate to pep440 for ranges poetry's own syntax cannot
express, and `subset()` answers `undefined` for them instead of throwing.

The `python` versioning's `poetry.isValid(range) ? poetry : pep440` ternaries
became dead code (poetry now answers every valid range itself, and both modules
receive the same invalid ranges), so the module is `{ ...poetry, isBreaking }`.

The poetry spec also gains rows for three branches nothing covered before: an
unparsable candidate in `getSatisfyingVersion()` / `minSatisfyingVersion()`,
and `getNewValue()` with the `*` range, for which npm's implementation returns
`null`.

* test(versioning/poetry): keep the new spec rows clear of main's coverage rows

main's #46252 appended rows to the same minSatisfyingVersion, getSatisfyingVersion and getNewValue tables, which made the stacked PR conflict with main. Those rows are adopted verbatim at the table ends and the pep440 rows move into the middle of each table, so both sides merge cleanly.
2026-09-28 10:37:31 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Rhys Arkins 0d5d7a8669 refactor!: remove rangeStrategy=pin from versioning modules (#36261)
Refactors `getNewValue` logic to replace it with an optional
`getPinnedValue()` where rangeStrategy=pin. This way each versioning
module doesn't need to add and test extensive "pin" logic.

This should not be breaking, but out of an abundance of caution, we'll
mark it as such.
2025-11-06 08:07:40 +00:00
Rhys Arkins 67935500d7 feat(versioning): isBreaking (#31859)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-05-09 08:17:14 +00:00
Rhys Arkins 4316888c67 fix(versioning): bump rangeStrategy should pin if no range qualifier (#28309) 2024-04-10 09:47:14 +00:00
Norbert Szulc ca5ce48325 feat(versioning/python): implement getNewValue (#28224) 2024-04-06 13:06:17 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
RahulGautamSingh 938a36801e refactor: replace test.each with it.each (#21859) 2023-04-28 04:33:15 +00:00
Lctrs 2e25de1211 feat(datasource): support range constraints filtering (#20842)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-03-15 06:12:08 +00:00
RahulGautamSingh 352c9db904 test: add new wrapper for partial (#20618) 2023-02-25 06:46:32 +00:00
Michael Kriese 60ed6ad40d feat(versioning): add python versioning for buildpack (#17147) 2022-08-12 06:24:56 +00:00