aboutcode-org / aboutcode-org/purldb

Preserve version ordering in packagedb VersionResponse

Offen Anfängerfreundlich
#857 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
HTML
Sterne
67
Forks
69
Ø Merge
8 T. 8 Std.
Gemergte PRs (30 T.)
1

Beschreibung

While looking at `packagedb/package_managers.py`, I noticed that `VersionAPI.get_until()` builds `VersionResponse.valid_versions` and `newer_versions` using sets.

That means duplicates are removed, but the original version order from `fetch()` is also lost.

There is already a related note in the file:

`# FIXME: DO NOT use set() for storing version lists: they lose the original ordering`

I think this should preserve fetch order while still deduplicating values.

A possible fix would be:
- change `valid_versions` and `newer_versions` to ordered lists
- keep a small `seen` set internally in `get_until()` for deduplication
- add/update tests in `packagedb/tests/test_package_managers.py`

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Start in packagedb/package_managers.py at VersionAPI.get_until() and inspect how VersionResponse.valid_versions and newer_versions are built from fetch(). Then review packagedb/tests/test_package_managers.py and add or update coverage for preserving fetch order while removing duplicates; done means the response lists retain first-seen ordering and the tests pass.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
api, backend
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
85/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.