Skip to content

Improve unit-test coverage across crates#1208

Open
YuanyuanTian-hh wants to merge 1 commit into
mainfrom
test/coverage-improvements
Open

Improve unit-test coverage across crates#1208
YuanyuanTian-hh wants to merge 1 commit into
mainfrom
test/coverage-improvements

Conversation

@YuanyuanTian-hh

Copy link
Copy Markdown
Contributor

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

  • Unit tests added/expanded in:
    • diskann-bftree (error display/acknowledge/escalate paths, neighbor + vector error paths, getters)
    • diskann-label-filter (attribute store CRUD, poisoned-lock recovery, identity hasher, query evaluator default methods, parser, posting lists, document provider status logic)
    • diskann-providers (PQ construction/storage, timer)
    • diskann-quantization (multi-vector distance factory)
    • diskann-tools (ground-truth + search-index utils, bin tools)
    • �ectorset (loader file-IO)
  • Dev-dependencies: added empfile (dev-only) to diskann-tools and �ectorset for file-IO tests; Cargo.lock updated accordingly.
  • Codecov: ignore �ectorset/src/main.rs (binary entry point / Redis CLI, not unit-testable).

Validation

  • cargo test passes for all touched crates (0 failures).
  • cargo clippy --lib --tests clean for the edited crates.

Notes

  • No production/runtime dependencies changed (only [dev-dependencies]).

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).

Copilot AI 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.

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, and vectorset.
  • Added tempfile as a workspace dev-dependency where needed for file-IO tests; updated Cargo.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 thread vectorset/src/loader.rs
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(),
}
}
@YuanyuanTian-hh YuanyuanTian-hh changed the title test: improve unit-test coverage across crates Improve unit-test coverage across crates Jun 30, 2026
@harsha-simhadri

Copy link
Copy Markdown
Contributor

@YuanyuanTian-hh thanks for this change. A few requests:

  • diskann-provider will soon be gone, so lets not add more stuff to it.
  • The final form of diskann-label-filter is still unclear. So lets hold off adding more tests there.
  • Break the rest into seperate PRs for changes to each crate so the relevant people can sign off.

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.

3 participants