Repository navigation
fix(temporal): find a pin by the matcher's folded name (PEP 503, Cargo -/_), not only exact or lowercase - #989
Merged
Merged
Conversation
…exact or lowercase spelling pins_by_project (from #974) asked for `package_name IN (name, lower(name))`, so a PyPI "Foo_Bar" pin was missed for an advisory on "foo-bar" (and a Cargo serde_json for serde-json), and the scorer and Preemption Tier 2 read "version unknown". Names now fold as the matcher folds them (fourda_depengine::matching): PyPI per PEP 503, Cargo `-` = `_`, npm exact (scopes included), others lowercase. The name index is asked for the exact, lowercase and folded spellings (and `_` / `.` forms where separators fold); only when none is stored for a PyPI or Cargo name does a separator-insensitive LIKE scan run, its rows kept by the same fold. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018hjX3pEMmC7CHfG41PiPj7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
This is a follow-up to #974.
temporal_versions::pins_by_projectlooked a package up aspackage_name IN (name, lower(name)). When a pin was stored under a mixed-case or differently separated name, the lookup missed it, and both the scorer and Preemption Tier 2 then said "version unknown". Examples:Foo_Barpin, when the advisory namesfoo-bar;serde_jsonpin, when the advisory namesserde-json.Names are now compared the way the matcher compares them (
fourda_depengine::matching::pep503_name/package_key):-,_or.becomes a single-. SoDjangomatchesdjango, andFoo_Barmatchesfoo-barandfoo.bar.-and_name the same crate.The index is still used:
idx_user_deps_packagelookup now asks for the exact, lowercase and folded spellings, plus the_/.forms where separators fold.LIKEscan run. Its rows are kept only if they fold to the same name.Tests
Djangovsdjango,Foo_Barvsfoo-bar, andfoo.barvsFoo_Bar;foobardoes not matchfoo-bar;serde_jsonvsserde-json, in both directions;JSONStreamis notjsonstream,foo_baris notfoo-bar), a scoped name is found, and ecosystem families never mix.cargo test --lib -- temporal scoring:: preemption::: 1124 passed, 0 failed.cargo clippy --lib -D warningsand fmt are clean, and the pre-commit and pre-push hooks passed.🤖 Generated with Claude Code
https://claude.ai/code/session_018hjX3pEMmC7CHfG41PiPj7