feat(query): exclude test paths from default seeds - #2403
Conversation
There was a problem hiding this comment.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
This PR adds a "seed-ignore" feature to the graph query functionality, allowing callers to exclude nodes matching path globs (e.g. tests/) from the set of initial seeds used to start graph traversal. It exposes this through three surfaces: a new --seed-ignore CLI flag, a GRAPHIFY_QUERY_IGNORE_PATTERNS environment variable, and a seed_ignore_patterns argument on the MCP query tool, with a default that excludes test directories. The change plumbs the new parameter through _query_graph_text and _score_query, adds pattern-resolution/matching helpers (reusing the discovery ignore matcher), includes a fallback to unfiltered scoring when no seeds remain, and updates help text and tests accordingly.
Worth a look
- MCP tool passes raw non-list seed_ignore_patterns to normalizer —
graphify/serve.py:1578· Escalate · medium- agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 592 functions depend on the 404 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
_query_graph_text()— 19 callers, 9 callees - worse:
_score_query()— 14 callers, 5 callees
Verification — 592 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 592 function(s) in the blast radius were not formally verified this run
· 1 grounded finding(s) anchored inline below; 1 more finding(s) on lines outside this diff (see the check run).
| return ignored | ||
|
|
||
|
|
||
| def _score_query( |
There was a problem hiding this comment.
_score_query()
14 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
|
Addressed the review concern in d44252b. Seed-ignore normalization now treats a scalar string as one glob and safely ignores other unexpected shapes, rather than iterating an unvalidated value. Added a regression test; |
There was a problem hiding this comment.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
This PR adds a "seed exclusion" feature to the graph query path, letting callers exclude certain node source paths (e.g. tests/) from the initial query seeds. It threads a new seed_ignore_patterns parameter through the CLI (--seed-ignore flag), the MCP server tool schema, and the _query_graph_text/_score_query functions in serve.py, adding helper functions to normalize/resolve patterns (with CLI, GRAPHIFY_QUERY_IGNORE_PATTERNS env var, and a tests/ default fallback) and to match source paths against them via the existing ignore-pattern matcher. It also includes a fallback to unfiltered scoring when filtering leaves no seeds, plus new CLI and serve tests and updated help text. The surface area spans graphify/cli.py, graphify/serve.py, graphify/__main__.py, and the test files tests/test_query_cli.py and tests/test_serve.py (with many rationale-symbol touches suggesting broader test-file edits).
No blocking issues surfaced. 5 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 593 functions depend on the 405 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
_query_graph_text()— 19 callers, 9 callees - worse:
_score_query()— 14 callers, 5 callees
Verification — 593 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 593 function(s) in the blast radius were not formally verified this run
· 1 grounded finding(s) anchored inline below; 1 more finding(s) on lines outside this diff (see the check run).
| return ignored | ||
|
|
||
|
|
||
| def _score_query( |
There was a problem hiding this comment.
_score_query()
14 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
d44252b to
48cead3
Compare
There was a problem hiding this comment.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
This PR adds a "seed-ignore" feature to the graph query functionality, allowing callers to exclude nodes matching path globs (e.g. tests/) from the initial query seeds. It wires this option through three surfaces: the CLI (--seed-ignore flag), the MCP server tool (seed_ignore_patterns argument), and an environment variable (GRAPHIFY_QUERY_IGNORE_PATTERNS), with tests/ excluded by default. When exclusions leave no matching seeds, the query falls back to an unfiltered scoring pass. The core changes live in serve.py, which gains pattern normalization/resolution helpers and reuses the discovery module's anchored ignore matcher; corresponding help text and usage strings are updated in __main__.py and cli.py. New tests cover the CLI flag, the empty-pattern default-disable behavior, and various scoring/seed-selection scenarios in test_serve.py.
No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 593 functions depend on the 405 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
_query_graph_text()— 19 callers, 9 callees - worse:
_score_query()— 14 callers, 5 callees
Verification — 593 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 593 function(s) in the blast radius were not formally verified this run
· 1 grounded finding(s) anchored inline below; 1 more finding(s) on lines outside this diff (see the check run).
| return ignored | ||
|
|
||
|
|
||
| def _score_query( |
There was a problem hiding this comment.
_score_query()
14 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
Summary
tests/and nested test paths only while choosing initial query seeds, so test rationale nodes no longer displace production symbols--seed-ignore,GRAPHIFY_QUERY_IGNORE_PATTERNS, and the MCPseed_ignore_patternsargument; explicit values replace the defaults and an empty value opts outFixes #2381
Validation
uv run --frozen pytest tests/test_serve.py tests/test_query_cli.py(140 passed)uv run --frozen --extra mcp pytest -q tests/test_serve_http.py(28 passed)uv run --frozen ruff check graphify testsuv run --frozen graphify update .