Skip to content

[partial][draft][in-progress] migrating unit tests#928

Draft
JordanMaples wants to merge 5 commits intomainfrom
jordanmaples/migrate_unittests
Draft

[partial][draft][in-progress] migrating unit tests#928
JordanMaples wants to merge 5 commits intomainfrom
jordanmaples/migrate_unittests

Conversation

@JordanMaples
Copy link
Copy Markdown
Contributor

@JordanMaples JordanMaples commented Apr 8, 2026

This is a first step in the effort to migrate unit tests from diskann_async to diskann #927. If you don't think tests that have been brought over should be moved, they probably shouldn't have been. Please point them out and I'll do my best to put them back where I found them.

I'll update this field as I continue to work on it:

  • Asked copilot to isolate trivially migratable tests and move them. It landed on the Multi-Hop tests. Here are the notes it had for me when I asked about major differences between the two implementations:
1. Provider & quantization — The originals used new_quant_index (inmem provider with a
trained PQ table). The new tests use test_provider::Provider::grid() — no quantization at
all. Since these tests are about multihop traversal behavior, not quantization accuracy, this
shouldn't matter, but it does mean the new tests exercise a simpler code path through the
accessor.

2. Start point filtering — This is the biggest behavioral difference. The inmem provider's
post-processor includes FilterStartPoints, which strips the start point from results. The
test provider does not filter start points. This forced a change in
reject_all_returns_zero_results: the original asserted result_count == 0, the new version
asserts zero non-start-point results. The other three tests weren't affected.

3. Async → sync — Originals were #[tokio::test] async fn. The new tests are #[test] fn using
current_thread_runtime().block_on(), matching the existing pattern in
diskann/src/graph/test/cases/.

4. Grid setup — Originals manually built vectors, adjacency lists, trained PQ, and called
populate_data/populate_graph. The new tests use Provider::grid() which does everything in one
call — less surface area, but also means the graph topology is generated differently (by
synthetic::Grid rather than the utils::genererate_3d_grid_adj_list helper).

5. Filter types — Moved as-is, no logic changes.

The start point difference (#2) is the one most worth flagging to your reviewer — it's a
genuine behavioral gap, not just a mechanical port. 

@JordanMaples JordanMaples force-pushed the jordanmaples/migrate_unittests branch from 2a56fc4 to 5a59f22 Compare April 8, 2026 22:20
@JordanMaples JordanMaples force-pushed the jordanmaples/migrate_unittests branch from 5a59f22 to 5655eea Compare April 9, 2026 21:12
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 9, 2026

Codecov Report

❌ Patch coverage is 90.98361% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.37%. Comparing base (1d3f1b3) to head (5655eea).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
diskann/src/graph/test/cases/multihop.rs 90.98% 22 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #928      +/-   ##
==========================================
- Coverage   89.38%   89.37%   -0.02%     
==========================================
  Files         447      448       +1     
  Lines       84299    84265      -34     
==========================================
- Hits        75350    75308      -42     
- Misses       8949     8957       +8     
Flag Coverage Δ
miri 89.37% <90.98%> (-0.02%) ⬇️
unittests 89.21% <90.98%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
diskann-providers/src/index/diskann_async.rs 96.36% <ø> (-0.05%) ⬇️
diskann/src/graph/test/cases/multihop.rs 90.98% <90.98%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

JordanMaples and others added 3 commits April 9, 2026 14:40
- Move groundtruth, is_match, assert_top_k_exactly_match, and
  assert_range_results_exactly_match from diskann-providers/test_utils
  to diskann/graph/test/search_utils for cross-crate reuse
- Migrate test_even_filtering_multihop to diskann as
  even_filtering_multihop, using test_provider::Provider::grid()
- Remove test_multihop_filtering and test_even_filtering_multihop
  from diskann-providers
- Update all consumers in diskann-providers to use shared search_utils

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add callback_enforces_filtering test to multihop.rs
- Expand CallbackMetrics to track total_visits, rejected_count,
  adjusted_count (matching original)
- Remove test_multihop_callback_enforces_filtering, CallbackFilter,
  and CallbackMetrics from diskann-providers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Gate is_match, assert_top_k_exactly_match, assert_range_results_exactly_match
  with #[cfg(test)] in diskann/graph/test/search_utils
- Restore search_utils in diskann-providers/test_utils for cross-crate use,
  re-exporting groundtruth from diskann
- Update diskann-providers and diskann-disk imports accordingly
- Remove unused imports (Mutex, QueryVisitDecision, Knn) and dead code
  (test_multihop_search) from diskann-providers
- Fix needless_range_loop in multihop.rs
- Remove stale duplicate diskann dep in diskann-disk/Cargo.toml

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

2 participants