Repository navigation
test(core): kill the document and skill search mutants left open by the v0.24.0 gate - #1811
Merged
Merged
Conversation
…te left open (#1766) The gate reported 31 missed mutants in doc_search_semantic, doc_search_hybrid, skill_search and doc_list_children. They need no ONNX model: the keyword test embedder gives a chunk the cosine 1 / sqrt(distinct words), so a fixture can choose every rank. - hybrid: each list is asked for limit * 2 documents (limit 1: the document second in both lists beats the one first in a single list, and a third place in either list would change the winner), and a score is the sum of 1 / (60 + rank) over the lists, with exact values. - semantic: the index window is limit * 10 chunks past chunks of the other kind, the cap is limit * 3 chunks of the wanted kind (reached with fewer than limit documents, and reaching past a long document), the snippet is cut only above 200 bytes, and a document keeps the first of two equally close chunks (the expectation is read from the index, not from how ties are ordered). - skill_search: limit * 5 files are asked for, and the semantic mode returns the embedding error where hybrid falls back on FTS. - doc_list_children: a skill lists nothing by slug or by id. Three pieces of code only the gate saw as live are simplified, with the same behaviour: the semantic loop of the hybrid fusion inserts instead of adding to an entry that cannot exist (the semantic list holds each document once), the first skill guard of doc_list_children repeated the check after the slug is resolved, and skill_search no longer tracks a best_semantic score (the semantic list is ordered best first, so the first file of a skill is its best).
The quantized vecq engine returns a similarity approximately, so the exact cosine values failed there. The ranks, the slugs and the windows the tests pin do not depend on the value; the RRF scores, which come from ranks, stay exact.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
7 tasks
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.
What
Killing tests for 29 of the 31 mutants that the v0.24.0 mutation gate left open in
doc_search_semantic,doc_search_hybrid,skill_searchanddoc_list_children, and three small simplifications of code that only the gate showed to be redundant (same behaviour). The other 2 mutants arek * 4inindex.search, which cannot be observed (below).Why
Part of #1766, which stays open. The comment on the issue said these needed the embedding model. They do not: the keyword test embedder gives a chunk the cosine
1 / sqrt(distinct words), so a fixture can choose every rank and every window. I re-ran the gate on the code ofdevelopfirst (88 mutants in the functions of the checklist: 51 caught, 6 unviable, 31 missed) so that this list is measured, not remembered from the issue.doc_duplicate_reportandembed_needwere already caught: that item of the checklist is confirmed.How
Ten tests in a new
search_window_tests.rs, each naming the behaviour it pins:limit * 2documents. Withlimit1 the document second in both lists (1/62 + 1/62) beats the ones first in a single list, and a third place in either list would change the winner, so a wider or empty window changes the result. A score is the sum of1 / (60 + rank)over the lists, with exact values for all three documents.limit * 10chunks past chunks of the other kind (14 files of skills before the plain document,limit2); the cap islimit * 3chunks of the wanted kind (six chunks of one document leaveb-docout atlimit2, and reaching all eight atlimit3); a snippet is cut only above 200 bytes (199, 200 and 201); a document keeps the first of two chunks with exactly the same vector. That last expectation is read from the index, so it does not depend on how ties are ordered.limit * 5files are asked for (nine files of one skill before the next skills), andsemanticmode returns the embedding error wherehybridanswers from FTS.Simplifications, with the behaviour pinned by the tests above and by the existing suite:
doc_list_childrenchecked for a skill twice; the check after the slug is resolved covers both inputs.skill_searchno longer tracksbest_semantic: the semantic list is ordered best first and read first, so the first file of a skill is its best (3 mutants).The cosine values in the tests are compared with a tolerance, because the quantized
vecqengine returns them approximately; the ranks, slugs, windows and RRF scores are exact. The tests pass on both engines.Not killed, listed as the owner rule asks:
lib.rsindex.search(&query, k, k * 4),* → +and* → /(2 mutants). The third argument is the breadth of the HNSW search, a tuning value; on any store the tests can build the result is the exact nearest set, so no assertion can tell the values apart.Testing
cargo test --workspacepassescargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warningspassescora review --base origin/develop)The new tests also pass on the other engine:
cargo test -p uteke-core --no-default-features --features "onnx,vecq" --lib -- search_window_tests.Mutation gate (owner rule 2026-08-19),
cargo mutants -p uteke-core -F 'doc_search_hybrid|doc_search_semantic|skill_search|doc_duplicate_report|doc_list_children|embed_need|EmbedGate|MAX_SCAN_DIRS' -- --lib, same filter before and after:developk * 4, above)After the last edit (tolerance on the cosine) the two functions whose tests changed were run again: 46 mutants, 42 caught, 2 unviable, the same 2 missed. The 88 to 77 comes from the code removed above.
Related Issues
Refs #1766 (does not close it).
Checklist
fix/,feat/,docs/,chore/,refactor/,test/,perf/,security/)develop