Skip to content

test(kpm): raise M9 coverage — exclude examples + edge tests (#177)#218

Merged
kalwalt merged 3 commits into
devfrom
test/kpm-m9-coverage-177
Jun 26, 2026
Merged

test(kpm): raise M9 coverage — exclude examples + edge tests (#177)#218
kalwalt merged 3 commits into
devfrom
test/kpm-m9-coverage-177

Conversation

@kalwalt

@kalwalt kalwalt commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

Lifts M9-module coverage toward the ≥90% target (PR #176 landed at 84.76%, 91 lines uncovered). v0.8.0 milestone close-out, 3/4.

Refs #177.

Stacked on #147 (uses query_from_keyframe). Base is the #147 branch; GitHub will auto-retarget this to dev once #147 (#217) merges. Review #217 first.

Changes

  • Exclude examples/** from tarpaulin — the 30-line simple_nft_dual.rs diagnostic sat at 0% and was the single biggest gap. Examples are demos, not test code (the issue's preferred option).
  • clustering.rs — degenerate-input test: BHC build over all-identical descriptors (zero-distance k-medoids split) + query. Targets the lowest-covered file (74%).
  • visual_database.rs — no-match test via query_from_keyframe (refactor(kpm): factor VisualDatabase::query inner loop, optionally expose pyramid/keyframe variants #147): maximally-distant descriptors short-circuit try_match_one (the "no-match" branch the issue names).

Note

Coverage isn't measurable on the local (Windows) dev box — tarpaulin runs in CI only. Codecov on this PR is the source of truth for the resulting %. If it still flags residual per-file gaps (e.g. rust_backend DualFreakMatcher divergence, the hough 1-liner), those are quick follow-ups rather than blockers.

Verification

  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo test --all-features green (2 new tests)

🤖 Generated with Claude Code

kalwalt and others added 2 commits June 23, 2026 22:47
…_from_keyframe (#147)

Recover part of the C++ query onion. Step 1 (no public API change): extract
the per-keyframe matching loop into `match_against_database` and the
per-query reset into `reset_query_state`. Step 2: expose
`query_from_keyframe(Keyframe)` — runs only the matching loop against the
database (skips pyramid build + feature extraction), for deterministic
testing and callers that already hold a `Keyframe`. Mirrors C++
`query(const keyframe_t*)`.

`query(&Matrix<u8>)` is now a thin wrapper (build keyframe → match → stash),
behaviorally identical (existing query tests unchanged + green).

Skipped per YAGNI: `query_from_pyramid` — KPM uses GaussianScaleSpacePyramid
while AR2 uses BoxFilterPyramid8u, so there is no possible cross-pipeline
caller (documented in #147).

Test: query_from_keyframe self-matches an identical keyframe.

Closes #147.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- coverage: exclude `examples/**` from tarpaulin (the 30-line
  simple_nft_dual.rs diagnostic at 0% was the single biggest gap; examples
  are demos, not test code — the issue's preferred fix).
- clustering: add a degenerate-input test (BHC build over all-identical
  descriptors → zero-distance k-medoids split + query).
- visual_database: add a no-match test via query_from_keyframe (#147) —
  maximally-distant descriptors short-circuit try_match_one.

Codecov on this PR confirms the resulting M9 module coverage; any residual
per-file gaps (rust_backend DualFreakMatcher divergence, hough 1-liner) are
quick follow-ups.

Refs #177.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kalwalt kalwalt self-assigned this Jun 24, 2026
@kalwalt kalwalt moved this from Backlog to In progress in Plan to port KPM to rust Jun 24, 2026
@kalwalt kalwalt changed the base branch from refactor/kpm-query-keyframe-147 to dev June 26, 2026 09:59
# Conflicts:
#	crates/core/src/kpm/freak/visual_database.rs
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kalwalt kalwalt merged commit 2fcefa2 into dev Jun 26, 2026
29 of 30 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Plan to port KPM to rust Jun 26, 2026
kalwalt added a commit that referenced this pull request Jun 26, 2026
…218)

* refactor(kpm): factor VisualDatabase::query matching loop + add query_from_keyframe (#147)

Recover part of the C++ query onion. Step 1 (no public API change): extract
the per-keyframe matching loop into `match_against_database` and the
per-query reset into `reset_query_state`. Step 2: expose
`query_from_keyframe(Keyframe)` — runs only the matching loop against the
database (skips pyramid build + feature extraction), for deterministic
testing and callers that already hold a `Keyframe`. Mirrors C++
`query(const keyframe_t*)`.

`query(&Matrix<u8>)` is now a thin wrapper (build keyframe → match → stash),
behaviorally identical (existing query tests unchanged + green).

Skipped per YAGNI: `query_from_pyramid` — KPM uses GaussianScaleSpacePyramid
while AR2 uses BoxFilterPyramid8u, so there is no possible cross-pipeline
caller (documented in #147).

Test: query_from_keyframe self-matches an identical keyframe.

Closes #147.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(kpm): raise M9 coverage — exclude examples + edge tests (#177)

- coverage: exclude `examples/**` from tarpaulin (the 30-line
  simple_nft_dual.rs diagnostic at 0% was the single biggest gap; examples
  are demos, not test code — the issue's preferred fix).
- clustering: add a degenerate-input test (BHC build over all-identical
  descriptors → zero-distance k-medoids split + query).
- visual_database: add a no-match test via query_from_keyframe (#147) —
  maximally-distant descriptors short-circuit try_match_one.

Codecov on this PR confirms the resulting M9 module coverage; any residual
per-file gaps (rust_backend DualFreakMatcher divergence, hough 1-liner) are
quick follow-ups.

Refs #177.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@kalwalt kalwalt deleted the test/kpm-m9-coverage-177 branch June 28, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant