Skip to content

fix(linalg): validate hamming batch layout - #8873

Open
lance-gatefixer[bot] wants to merge 1 commit into
mainfrom
gatekeeper/fix-8871-1
Open

fix(linalg): validate hamming batch layout#8873
lance-gatefixer[bot] wants to merge 1 commit into
mainfrom
gatekeeper/fix-8871-1

Conversation

@lance-gatefixer

Copy link
Copy Markdown
Contributor

Summary

  • enforce the shared distance batch-layout invariants for Hamming batches in every build profile
  • document the public layout contract and cover a trailing partial vector with a release-sensitive regression test

Root cause

hamming_distance_batch guarded its layout preconditions with debug-only assertions. Optimized builds therefore let chunks_exact discard an incomplete trailing vector and return fewer distances, allowing K-means to rank an incomplete centroid set.

Validation

  • cargo test --release -p lance-linalg test_hamming_distance_batch_rejects_partial_vector
  • cargo test -p lance-linalg --lib
  • cargo test -p lance-linalg --doc
  • cargo fmt --all -- --check
  • cargo clippy --all --tests --benches -- -D warnings

Fixes #8871

@github-actions github-actions Bot added A-index Vector index, linalg, tokenizer bug Something isn't working labels Aug 30, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate recommendation: approve.

This fixes malformed Hamming batch handling at the public primitive with the same release-active layout contract used by L2 and Dot. The regression test covers the silent truncation path, and valid-call behavior and the public API remain unchanged.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-index Vector index, linalg, tokenizer bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: hamming_distance_batch silently drops the trailing centroid in release

0 participants