Skip to content

Seeding fix 3/4: heuristic-context-filter starvation fallback (C3) — "Who calls X?" reaches the callers #42

Closed

Description

@filipechagas

Parent

#37 — implements change C3 of the consolidated spec.

What to build

"Who calls ?" passes end-to-end: when the heuristically inferred context filter leaves the traversal with no nodes beyond the seeds (a class-node seed has no call-context edges of its own — calls attach to methods, and class-to-member edges carry no context), the query retraverses unfiltered and appends a relaxation note to the Context: header, so the answer is neither near-empty nor silently unfiltered. Explicitly requested filters are never overridden. The threshold is deliberately "zero expansion" — no tuning constant. Applies identically to both traversal modes.

Acceptance criteria

  • Red-first: the who-calls phrasing end-to-end test fails on current v8+C1 (near-empty filtered result), passes after C3
  • "Who calls ?" end-to-end: all 3 fixture callers rendered, no decoy, header carries the heuristic context plus a relaxation note
  • A heuristic filter that does expand the traversal is left in force (no fallback)
  • An explicit context filter never falls back, even when it strands the traversal
  • BFS and DFS modes behave identically under the fallback
  • All existing seeding sentinels green with zero baseline edits

Blocked by

Activity

  1. added
    ready-for-agent
    on Aug 6, 2026
  2. filipechagas commented on Aug 6, 2026

    @filipechagas
    CollaboratorAuthor

    Implemented on feat/seeding-fix-37 @ 4e8ff46 (merged at ebe7b67).

    All acceptance boxes green:

    • Red-first: on v8+C1 the who-calls phrasing renders 1 nodes found (the inferred call filter strands the class seed); after C3 it renders all 3 fixture callers — red state independently reproduced by an adversarial reviewer.
    • "Who calls ChargeCustomerService?" e2e: 3/3 callers, no decoy, header Context: call (heuristic; relaxed — no matches beyond seeds).
    • Expanding heuristic filter left in force; explicit filter never falls back (filter_source == "heuristic" gates the retry); BFS/DFS identical (traversal bound once, retry reuses it).
    • Sentinels green, zero baseline edits; production change is +25/−3 inside _query_graph_text only.

    Review hardening: the adversarial review proved the set-subset threshold (nodes <= set(start_nodes)) exactly equivalent to zero expansion (filters keep all nodes; both traversals always visit every seed) and safer than a length test under duplicated seed ids — but found no test pinned the boundary. Added test_single_node_expansion_is_not_starvation: exactly one node of expansion is NOT relaxed, mutation-verified against a len(nodes) <= len(start_nodes)+1 tuning-constant mutant (on the merged tree that mutant also trips a pre-existing test_serve.py sentinel).

    Merge integration: two C3 guard tests originally relied on the charge-term guarantee seed that C2 (#41) correctly removes; reconstructed on the merged tree around "Who invoked BillingController?" (seeds a method node on merit, guarantee-independent), with the mutation check re-run.

    Known minor corner (pre-existing input-validation gap, not C3's): the MCP entry point clamps depth only upward, so a depth=0 MCP query with a heuristic filter would vacuously "relax"; the CLI hardcodes depth 2 and is unaffected.

    Full suite on the merged head: 4,177 passed; only the 4 documented pre-existing test_ollama_retry_cap.py env failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions