Skip to content

Stub-shadow fix 3/4: find_node_ambiguity must not collapse sourceless rivals into one group (RC3 of #46) #49

Closed

Description

@filipechagas

Parent

#46 — implements RC3 (the lookup-side guard).

What to build

find_node_ambiguity (graphify/serve.py:1382-1389) stops treating N sourceless stubs as one rival: it groups the winning tier by source_file, so all sourceless stubs share the "" bucket and N stubs count as one file — no ambiguity reported, and explain silently answers with matches[0] (graph-iteration order). Fix by not collapsing sourceless rivals into a single group, and/or excluding sourceless stubs from the exact tier when a sourced match exists.

explain and affected must agree: affected's resolve_seed (graphify/affected.py:99-143) refuses on a non-unique label match, which is the whole explain-vs-affected inconsistency in #46's symptom.

Acceptance criteria

Blocked by

None — serve-side only, independent of the extraction slices. Worth keeping even after #47/#48 land: it removes the silent-wrong-answer failure mode generally.

Activity

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

    @filipechagas
    CollaboratorAuthor

    Fixed on the fork feature branch fix/stub-shadowing-46 (commit 313a168, cherry-picked from fix/49-ambiguity-guard), headed for the single PR into v8.

    What landed (three coordinated changes):

    1. _find_node_tiers (serve.py): when the exact tier holds both sourced and sourceless nodes, the sourceless ones are dropped — the sourced declaration wins.
    2. find_node_ambiguity (serve.py): sourceless nodes are keyed per-node instead of sharing the "" source bucket, so N stubs count as N rivals — an all-sourceless tier now reports ambiguity instead of silently answering with matches[0].
    3. affected.resolve_seed (affected.py): same sourced-preference applied to the exact-label and bare-name passes, so explain and affected agree.

    Acceptance criteria:

    Review verdict: APPROVE (4 minors, all addressed in the amended commit or noted below). Known related gap kept out of scope per the issue text: graphify query/shortest_path resolve endpoints via _score_nodes, which has no sourced-preference — follow-up issue to be filed. Full suite on the integrated branch: 4310 passed / 3 skipped.

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