Skip to content

fix(grep): report truthful insufficient-result stats - #9

Merged
AlexMikhalev merged 2 commits into
mainfrom
task/3169-grep-truthful-stats
Aug 12, 2026
Merged

fix(grep): report truthful insufficient-result stats#9
AlexMikhalev merged 2 commits into
mainfrom
task/3169-grep-truthful-stats

Conversation

@AlexMikhalev

Copy link
Copy Markdown
Contributor

Summary

Fix terraphim_grep structured output on the RlmInsufficient path:

  • preserve retrieved chunks and KG concepts;
  • derive stats.chunks_returned from chunks.len();
  • derive stats.kg_hits from concepts.len();
  • add library and real CLI regressions.

This does not change the sufficiency threshold. A one-result search may remain RlmInsufficient; its statistics are now truthful.

Evidence

Strict RED→GREEN:

  • RED library: chunks_returned was 0, actual chunks 1.
  • RED CLI: stats.chunks_returned must equal chunks.len() (got 0, chunks = 1).
  • GREEN focused library: 1 passed, 0 failed.
  • GREEN CLI: 1 passed, 0 failed.

Final gates:

  • cargo test -p terraphim_grep: 61 tests passed across targets, 0 failed; one doctest ignored.
  • cargo fmt -p terraphim_grep -- --check: pass.
  • cargo clippy -p terraphim_grep --all-targets -- -D warnings: pass.
  • Branch binary smoke: chunks=1 chunks_returned=1 kg_hits=0 sufficiency=RlmInsufficient.
  • git diff --check: clean.

Tracking

Scope

No version bump, publish, threshold change, dependency update, or unrelated crate change.

@AlexMikhalev
AlexMikhalev force-pushed the task/3169-grep-truthful-stats branch 2 times, most recently from e4709cd to 8521195 Compare August 12, 2026 11:31
@AlexMikhalev
AlexMikhalev force-pushed the task/3169-grep-truthful-stats branch from 7c32870 to db19655 Compare August 12, 2026 11:50
@AlexMikhalev
AlexMikhalev merged commit 7d601b7 into main Aug 12, 2026
1 check passed
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.

1 participant