aboutcode-org / aboutcode-org/purldb
Preserve version ordering in packagedb VersionResponse
- Langage dominant
- HTML
- Étoiles
- 67
- Forks
- 69
- Merge moyen
- 8 j 8 h
- PR mergées (30 j)
- 1
Description
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`
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- api, backend
- Type d'issue
- Bug
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Activité
- Calme
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 85/100