Skip to content

fix(core): stopword & rare-literal scoring noise (6F.9, A15)#51

Merged
officialCodeWork merged 1 commit into
developmentfrom
build/phase-6f/step-6f.9-stopword-scoring
Jul 15, 2026
Merged

fix(core): stopword & rare-literal scoring noise (6F.9, A15)#51
officialCodeWork merged 1 commit into
developmentfrom
build/phase-6f/step-6f.9-stopword-scoring

Conversation

@officialCodeWork

Copy link
Copy Markdown
Owner

Summary

Found while self-validating 0.4.0 on Grafana's frontend (a big real RTK codebase). Two ranking bugs, one root cause — low-specificity tokens treated as real signal:

  • find "Find silences by matcher" ranked OrderBySection (renders a bare BY) top-1 over SilencesFilter, because a lone stopword is a rare literal with high IDF.
  • find "The" returned confident matches on "the".

Fix

New isLowSignal(normalized) in core/text.ts — extends the A14 hasMatchSignal guard: true when a string is empty, punctuation-only, or entirely stopwords (the stopword set is folded through foldPlural so it compares equal to normalized text). matchComponents:

  • drops stopword-only query terms, and
  • skips stopword-only rendered-text targets (so a bare BY can't be a match target).

IDF and the combination bonus are untouched — this just sets the noise floor.

Verified on the real Grafana graph (not just the fixture)

  • Find silences by matcherSilencesFilter top-1, OrderBySection gone ✅
  • Theno-signal
  • resolve on a stopword-heavy ticket went from confidently-wrong → honest no-signal

Tests

  • New failure mode A15 + fixture a15-stopword-noise (a BY component, an exact-phrase component, a the-rendering component)
  • 5 new unit tests (2 isLowSignal, 3 matcher)
  • 221 tests green · eval 297/0/0/0, gate OK, all metrics 1.000

Follow-up (not in this PR)

Validation surfaced a separate bug — HTML-entity rendered text ( →"nbsp", "→"34") creates spurious matches; numeric entities let gibberish sharing those digits match. That's an extraction bug, not scoring, so it's filed as A16 / step 6F.10 and kept out of this PR.

🤖 Generated with Claude Code

…ng (6F.9, A15)

Self-found validating 0.4.0 on Grafana's frontend: `find "Find silences by
matcher"` ranked OrderBySection (renders a bare "BY") top-1 over
SilencesFilter, because a lone stopword is a rare literal with high IDF; and
`find "The"` returned confident matches on "the".

New isLowSignal() in core/text.ts (extends the A14 hasMatchSignal guard): true
when a normalized string is empty, punctuation-only, or entirely stopwords
(the stopword set is folded through foldPlural so it compares to normalized
text). matchComponents drops stopword-only query terms and skips stopword-only
rendered-text targets, so the exact-phrase component wins and a stopword-only
query declines no-signal.

Verified on the real Grafana graph: "Find silences by matcher" -> SilencesFilter
top-1 (OrderBySection gone), "The" -> no-signal, and resolve on a stopword-heavy
ticket went from confidently-wrong to an honest no-signal.

New failure mode A15 + fixture a15-stopword-noise; 5 unit tests. A separate
finding (HTML-entity rendered text -> junk tokens) is filed as A16/6F.10 — an
extraction bug, out of scope for a scoring PR.

Tests 221 green; eval 297/0/0/0, gate OK, all metrics 1.000.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@officialCodeWork
officialCodeWork merged commit a9b9263 into development Jul 15, 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.

2 participants