Skip to content

feat(query): exclude test paths from default seeds - #2403

Open
zrh805 wants to merge 2 commits into
Graphify-Labs:v8from
zrh805:codex/filter-query-test-seeds
Open

feat(query): exclude test paths from default seeds#2403
zrh805 wants to merge 2 commits into
Graphify-Labs:v8from
zrh805:codex/filter-query-test-seeds

Conversation

@zrh805

@zrh805 zrh805 commented Aug 2, 2026

Copy link
Copy Markdown

Summary

  • exclude tests/ and nested test paths only while choosing initial query seeds, so test rationale nodes no longer displace production symbols
  • add repeatable --seed-ignore, GRAPHIFY_QUERY_IGNORE_PATTERNS, and the MCP seed_ignore_patterns argument; explicit values replace the defaults and an empty value opts out
  • preserve reachable test context and retry unfiltered only when every match was excluded

Fixes #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 tests
  • uv run --frozen graphify update .

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 normalizergraphify/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).

Comment thread graphify/serve.py
return ignored


def _score_query(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression_score_query()

14 callers depend on it (afferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

@zrh805

zrh805 commented Aug 2, 2026

Copy link
Copy Markdown
Author

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; tests/test_serve.py + tests/test_query_cli.py pass (141), MCP HTTP tests pass (28), and ruff check graphify tests is clean.

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread graphify/serve.py
return ignored


def _score_query(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression_score_query()

14 callers depend on it (afferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

@zrh805
zrh805 force-pushed the codex/filter-query-test-seeds branch from d44252b to 48cead3 Compare August 3, 2026 01:42

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread graphify/serve.py
return ignored


def _score_query(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Health regression_score_query()

14 callers depend on it (afferent coupling).

Grounded coupling-delta finding (deterministic), not an LLM guess.

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.

query seeds can be hijacked by test/doc rationale nodes — make seed-path exclusion configurable with tests/ as the default

1 participant