test(memory/graph): regression test for entity-graph seed stopword filter#51
Merged
Merged
Conversation
…lter The stopword filter (PR #13 / dd6f1ed) shipped with a pre-registered metric (-13.3pp -> 0pp at session-hit-rate@k=5 on single-session-preference) but no test gated it — a §3/§11 behavior-baseline gap. This closes it. Exercises the real _ENTITY_MENTION_RE + _QUERY_STARTER_STOPWORDS from memory.graph (no DB/embedder), replicating the Step-1 seed-extraction loop, and asserts: - common query starters (Can/What/How/I/...) are in the stoplist; - "Can you recommend a show like Stranger Things" -> seeds keep "Stranger Things", drop "Can" (the canonical "Can"->"Canada" false-match regression); - a query of only starters yields zero seeds; - a genuine Title-Case entity not in the stoplist survives. Mutation-verified: emptying the stoplist turns the suite red. 16 tests, no DB, ruff clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Adds the missing regression test for the entity-graph seed stopword filter (shipped in #13 /
dd6f1ed). That fix landed with a pre-registered metric but no test gated it — a §3/§11 (robustness / bench-discipline) behavior-baseline gap perdocs/DESIGN_PHILOSOPHIES.md. This closes it.Why it matters
The fix prevents sentence-initial Title-Case common words ("Can", "What", "How", "I") from being captured as entity-graph seeds, where "Can" LIKE-matched "Canada"/"Canva" and pulled spurious BFS neighbors into the top-k. Measured impact (from #13): −13.3pp → 0pp at session-hit-rate@k=5 on single-session-preference questions, +1.4pp @k=3 overall. Nothing locked that behavior until now.
What the test does
Exercises the real
_ENTITY_MENTION_RE+_QUERY_STARTER_STOPWORDSfrommemory.graph(no DB / embedder), replicating the Step-1 seed-extraction loop, and asserts:"Can you recommend a show like Stranger Things"→ seeds keepStranger Things, dropCan(the canonical false-match regression);Testing
test_entity_graph.py(52 passed together);ruffclean (§13).🤖 Generated with Claude Code