Skip to content

fix(graph): reject non-finite typed vectors and ranking scores - #1095

Open
rudycelekli wants to merge 1 commit into
ruvnet:mainfrom
rudycelekli:fix/typed-graph-finite-vectors-931
Open

rudycelekli wants to merge 1 commit into
ruvnet:mainfrom
rudycelekli:fix/typed-graph-finite-vectors-931

Conversation

@rudycelekli

Copy link
Copy Markdown

Problem

Typed graph search accepted NaN/Infinity query components, typed node writes accepted non-finite embeddings, and a legacy invalid embedding could enter top-k ranking. The cited typed_graph.rs partial_cmp().unwrap() in #931 is in a test reference sorter, but these are user-reachable non-finite vector failures in the same path.

Change

  • Validate finite query components and typed node embeddings before search/write, including hybrid text queries and overflowing cosine query norms.
  • Ignore legacy/directly inserted invalid embeddings when scoring or building an ANN index; also discard non-finite scores from arithmetic overflow.
  • Use total_cmp for typed graph result and reference ordering.
  • Add regressions for NaN/Infinity inputs, legacy data, hybrid embedder output, and score overflow.

Related to #931. This fixes the typed graph slice, not the wider workspace sweep.

Verification

  • Before fix, search_rejects_non_finite_query_vectors failed because a NaN query was accepted; non_finite_stored_vectors_cannot_displace_finite_hits failed because a NaN node was accepted.
  • cargo test -p ruvector-graph passed (unit, integration, and doc tests; existing ignored tests remain ignored).
  • cargo build -p ruvector-graph passed.
  • cargo clippy -p ruvector-graph --lib -- -D warnings passed.
  • cargo fmt --all -- --check and git diff --check passed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant