computeAffectedVersions narrows coarse window after SortEvents lexicographic fallback
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start in go/internal/database/datastore/affected_versions.go at computeAffectedVersions and trace its call to osvutil.SortEvents, then inspect how buildVersionMatcher uses coarse_min and coarse_max. Add a unit test for the documented Packagist-style fallback case; done means a SortEvents error leaves both coarse bounds unbounded so the semantic matcher can find the affected version.
Written by the indexing model from the issue text.
Description
Summary
In go/internal/database/datastore/affected_versions.go, computeAffectedVersions calls osvutil.SortEvents and discards the error:
_ = osvutil.SortEvents(eHelper, events)
When any event version fails Parse/Compare, SortEvents re-sorts lexicographically (documented as arbitrary/stable) and returns that error to signal the order is not semantic. The caller still derives coarse_min / coarse_max from positional assumptions that only hold under a semantic sort (first introduced, last event).
Those coarse bounds become hard Datastore inequality filters in buildVersionMatcher, so a row excluded by a wrongly-narrowed window is never returned to the semantic matcher.
Worked example (Packagist)
Events: introduced 1.0, fixed 9.0, introduced 20.0, fixed 30.0, introduced 1.0#bad (Packagist rejects #).
Lexicographic fallback order ends with fixed 9.0, so today's code emits coarse_max = coarse(9.0). Version 25.0 is semantically in-range (20.0–30.0) but fails the coarse_max >= coarse(25.0) pre-filter.
Expected
On SortEvents error, leave coarse_min/coarse_max at the unbounded defaults (00:000… / 99:999…), matching the Python _get_coarse_min_max ValueError path that resets to MIN/MAX.
Note
This is a correctness / false-negative matching bug in the Go datastore index path (live importer/worker), not a security advisory request. Happy to send a small patch + unit test once this is assigned per CONTRIBUTING.
- Dominant language
- Go
- Stars
- 2.9k
- Forks
- 371
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 111
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/osv.dev
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
backlog data quality
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·