aboutcode-org / aboutcode-org/purldb
Preserve version ordering in packagedb VersionResponse
- Linguagem predominante
- HTML
- Estrelas
- 67
- Forks
- 69
- Merge médio
- 8d 8h
- PRs com merge (30d)
- 1
Descrição
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`
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- api, backend
- Tipo de issue
- Bug
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Pouca atividade
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 85/100