fix(metrics): use per-domain matching for knowledge miss/gap rates#145
Merged
Conversation
All doc chunk texts were merged into one blob, causing every finding to overlap and knowledge_miss_rate to always return 1.00. Now doc chunks are grouped by domain for per-domain word-set matching, so a finding is only "covered" when its words overlap with a specific domain's docs. Fixes #130 Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Assigned-by: decko
This was referenced Apr 21, 2026
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.
Summary
All doc chunk texts were merged into one blob, causing every finding's
issue words to overlap and
knowledge_miss_rateto always return 1.00.Now doc chunks are grouped by domain for per-domain word-set matching.
A finding is only "covered" when its significant words overlap with a
specific domain's doc chunk words, not the entire merged corpus.
Fixes #130
Changes
src/raki/metrics/protocol.py: Addeddoc_chunksfield to MetricConfigsrc/raki/metrics/knowledge/_common.py: Addedbuild_domain_word_sets()andis_finding_covered_by_chunks()src/raki/metrics/knowledge/miss_rate.py: Domain-aware path with legacy fallbacksrc/raki/metrics/knowledge/gap_rate.py: Same structure as miss_ratesrc/raki/cli.py: Passes doc_chunks to MetricConfigtests/test_metrics_knowledge.py: 8 new testsReview
Assisted-by: Claude Opus 4.6 (1M context) noreply@anthropic.com
Assigned-by: decko