Repository navigation
reject invalid float indices before conversion - #59
Merged
CanReader merged 1 commit intoOct 15, 2026
Merged
Conversation
CanReader
approved these changes
Oct 15, 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.
What this changes
Embedding::forwardandBatch::labelsnow reject negative, non-finite, fractional, and out-of-range float IDs before converting them tousize. Both use the same small helper, and the panic names the invalid value; valid IDs, including negative zero, keep their existing behavior.Why
The previous cast silently turned
-1andNaNinto index 0 and truncated fractional IDs. Fixes #46.How it was verified
The six public-API regressions produced four passes and two failures on the unchanged base, then all six passed with the fix. They cover both consumers, the offending value in the panic, valid IDs, and the
usizeboundary.cargo test --locked --offlinepassescargo clippy --locked --offline --all-targets -- -D warningsis cleancargo fmt --checkpassesRun on Linux with Rust 1.99. MSRV 1.87, release mode, and other operating systems were not run locally.
Checklist
///docs