Skip to content

feat: accept a union of version ranges in a specifier - #112

Merged
SizzleUnrlsd merged 2 commits into
mainfrom
feat/version-range-union
Sep 23, 2026
Merged

SizzleUnrlsd merged 2 commits into
mainfrom
feat/version-range-union

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Needed by the Django advisories (CoreTrace-Entreprise/coretrace-python-analyzer-plugins#2): each spans three release series, and since #109 merges advisories by identifier, one record per series would keep only the last.

  • Version.satisfies accepts a || b: comma-separated clauses all hold within an alternative, any alternative suffices. _lower_bounds (what an unpinned requirement is tested against) covers every alternative.
  • import_osv emits one advisory per package with the union of its OSV ranges instead of one advisory per range. The existing two-range test now expects "<1.1 || >=2.0,<2.1"; the previous expectation (two advisories with the same id) is exactly what the merge rule collapses.

Tests: four boundary cases on ">=4.2,<4.2.28 || >=5.2,<5.2.11", pinned and unpinned requirements against a union. 919 passed; ruff and mypy clean. Usage guide mentions the syntax.

An advisory over several release series (Django's 4.2, 5.2 and 6.0)
needs one specifier: '||' now separates alternatives in Version.satisfies
and the lower bounds an unpinned requirement is tested against. The OSV
import emits one advisory per package with the union of its ranges, since
advisories are merged by identifier and one record per range would keep
only the last series.
@SizzleUnrlsd SizzleUnrlsd self-assigned this Sep 23, 2026
@SizzleUnrlsd
SizzleUnrlsd merged commit dad6e94 into main Sep 23, 2026
10 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/version-range-union branch September 23, 2026 05:32
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.

1 participant