Improve unit-test coverage across crates#1208
Open
YuanyuanTian-hh wants to merge 1 commit into
Open
Conversation
Add targeted unit tests across diskann-bftree, diskann-label-filter, diskann-providers, diskann-quantization, diskann-tools, and vectorset to raise workspace coverage. Add tempfile dev-dependencies for file-IO tests. Add a codecov ignore for vectorset/src/main.rs (binary entry point, not unit-testable).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR increases unit-test coverage across multiple workspace crates by adding targeted tests for error paths, parsing, storage helpers, and binary utilities, and adjusts coverage reporting to better reflect unit-testable code.
Changes:
- Added/expanded unit tests across
diskann-bftree,diskann-label-filter,diskann-providers,diskann-quantization,diskann-tools, andvectorset. - Added
tempfileas a workspace dev-dependency where needed for file-IO tests; updatedCargo.lock. - Updated Codecov configuration to ignore
vectorset/src/main.rs(binary entry point).
Reviewed changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vectorset/src/loader.rs | Adds async unit tests covering dataset loading/iteration and malformed input handling. |
| vectorset/Cargo.toml | Adds tempfile as a dev-dependency for new loader tests. |
| diskann-tools/src/utils/search_index_utils.rs | Adds tests for truthset/range-truthset loading helpers. |
| diskann-tools/src/utils/ground_truth.rs | Adds tests for ground-truth generation (including vector filters, inserts, labels, multivec). |
| diskann-tools/src/bin/subsample_bin.rs | Adds tests for RNG seeding and sampling probability edge cases. |
| diskann-tools/src/bin/generate_minmax.rs | Adds tests for dispatch validation and output header writing. |
| diskann-tools/Cargo.toml | Adds tempfile dev-dependency for new tests. |
| diskann-quantization/src/multi_vector/distance/factory.rs | Adds tests exercising all ISA selection/build paths and unsupported-ISA errors. |
| diskann-providers/src/utils/timer.rs | Adds coverage for elapsed time / gcycles helpers. |
| diskann-providers/src/storage/pq_storage.rs | Adds tests for getters and error paths (missing file, dimension mismatch). |
| diskann-providers/src/model/pq/pq_construction.rs | Adds tests for PQ construction error paths from membufs. |
| diskann-providers/src/model/pq/fixed_chunk_pq_table.rs | Adds tests for direct distance methods and compress/inflate behaviors. |
| diskann-label-filter/src/utils/jsonl_reader.rs | Adds tests for IO/parse/display error paths and query parsing failures. |
| diskann-label-filter/src/utils/flatten_utils.rs | Adds tests for remaining wrapper helper functions. |
| diskann-label-filter/src/traits/query_evaluator.rs | Adds tests validating default trait methods (is_match, count_matches). |
| diskann-label-filter/src/stores/bftree_store.rs | Adds tests for error conversions and Display. |
| diskann-label-filter/src/set/roaring_set_provider.rs | Adds tests for CRUD helpers and IdentityHasher specializations. |
| diskann-label-filter/src/parser/query_parser.rs | Adds tests for additional operators, invalid types, and Display coverage. |
| diskann-label-filter/src/parser/ast.rs | Adds tests for Display coverage and formatting edge cases. |
| diskann-label-filter/src/kv_index/query_evaluator_impl.rs | Adds tests for corrupt posting-list data errors during range evaluation. |
| diskann-label-filter/src/kv_index/posting_list_accessor_impl.rs | Adds tests for posting-list accessor read/missing/corrupt behaviors. |
| diskann-label-filter/src/kv_index/inverted_index_provider_impl.rs | Adds tests for insert/delete/update and batch operations over posting lists. |
| diskann-label-filter/src/kv_index/generic_index.rs | Adds tests for field normalization and posting-list load/corruption paths. |
| diskann-label-filter/src/inline_beta_search/predicate_evaluator.rs | Adds tests for boolean predicate evaluation semantics. |
| diskann-label-filter/src/inline_beta_search/inline_beta_filter.rs | Adds tests validating beta scaling depending on predicate match. |
| diskann-label-filter/src/inline_beta_search/encoded_document_accessor.rs | Adds tests for distance scaling and missing-label error handling. |
| diskann-label-filter/src/encoded_attribute_provider/roaring_attribute_store.rs | Adds tests for attribute-store CRUD and error conditions. |
| diskann-label-filter/src/encoded_attribute_provider/encoded_attribute_accessor.rs | Adds tests for visiting labels, multi-id iteration, and poisoned-lock recovery. |
| diskann-label-filter/src/encoded_attribute_provider/document_provider.rs | Adds tests for status logic and delegated behaviors. |
| diskann-bftree/src/vectors.rs | Adds tests for buffer-dimension errors and deleted/not-found paths. |
| diskann-bftree/src/quant.rs | Adds tests for quantized get_vector_into error paths. |
| diskann-bftree/src/neighbors.rs | Adds tests for neighbor-provider validation/error paths. |
| diskann-bftree/src/lib.rs | Adds tests for error Display/acknowledge/escalate behaviors. |
| Cargo.lock | Records added tempfile dev-dependency usage. |
| .codecov.yml | Ignores vectorset/src/main.rs to avoid penalizing non-unit-testable binary entry code. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+20
to
+22
| impl<T: bytemuck::Pod> DatasetLoader<T> { | ||
| pub async fn new<P: AsRef<Path> + Clone>(path: P) -> Result<Arc<Self>> { | ||
| let path = path.as_ref().to_path_buf(); |
Comment on lines
+290
to
+295
| loop { | ||
| match fut.as_mut().poll(&mut cx) { | ||
| Poll::Ready(v) => return v, | ||
| Poll::Pending => std::hint::spin_loop(), | ||
| } | ||
| } |
Contributor
|
@YuanyuanTian-hh thanks for this change. A few requests:
|
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
Adds targeted unit tests across several crates to raise workspace test coverage, prunes a few low-value tests, and adds one Codecov ignore so the headline coverage reflects unit-testable code.
Changes
Validation
Notes