Preserve version ordering in packagedb VersionResponse

Open Beginner friendly
#857 0 comments 0 reactions 0 assignees View on GitHub

@drawliin is already working on this.

Since Mar 27, 2026.

  • #858 by @drawliin — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
api, backend

Research direction

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.

Written by the indexing model from the issue text.

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
Dominant language
HTML
Stars
70
Forks
76
Avg merge
23m
Merged PRs (30d)
2

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aboutcode-org/purldb

All issues in aboutcode-org/purldb

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.