fix(check): use crates.io API for O(1) canonical matching#2
Merged
rocketman-code merged 1 commit intomainfrom Feb 23, 2026
Merged
fix(check): use crates.io API for O(1) canonical matching#2rocketman-code merged 1 commit intomainfrom
rocketman-code merged 1 commit intomainfrom
Conversation
fff6c0a to
42bdf0d
Compare
Replace 3-variant sparse index lookup with a single crates.io API call. The API canonicalizes names server-side, covering all separator variants in one request and eliminating the documented mixed-separator gap. - Set User-Agent header per crates.io API policy - Remove dead index_path() function and tests - Update all docs from "sparse index" to "crates.io API"
42bdf0d to
5361113
Compare
This was referenced Feb 23, 2026
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.
Summary
Replace the 3-variant sparse index lookup with a single crates.io API call for canonical name matching.
The crates.io API at
GET /api/v1/crates/{name}canonicalizes the name before querying -- the same logic used bycargo publish. This means one request covers ALL separator variants (hyphens/underscores), eliminating the documented mixed-separator gap without needing O(2^n) lookups.Before: 3 sparse index GETs guessing which separator spelling was used, with a documented gap for mixed-separator names like
my_cool-crate.After: 1 API call. O(1). Correct for all variants.
index_path()function and its tests (dead code)canonical_collision_via_apinetwork testTest plan
cargo test-- 35 pass, 0 failcargo test -- --ignored-- 6 network tests pass (including newcanonical_collision_via_api)cargo clippy --all-targets -- -D warnings-- clean