Skip to content

explain: the ambiguity message says retry with the repo-relative path, but a path resolves to the file node, not the symbol; there is no path-scoped symbol form #3485

Closed

Description

@rilkerfc

Prior art, so this is not a duplicate

Repro

src/components/Widget.tsx
  export function Widget({ label }: { label: string }) { return <span>{label}</span>; }
  export function helper(n: number): number { return n + 1; }

src/screens/Home.tsx
  import { Widget, helper } from '../components/Widget';
  function Widget() { return <div>local</div>; }
  export function HomeScreen(flag: boolean) {
    const a = flag ? helper(1) : helper(2);
    const jobs = [];
    if (flag) jobs.push(helper(3));
    return a + jobs.length;
  }

git init && git add -A && git commit -m init && GRAPHIFY_FORCE=1 graphify update . --force

What happens

$ graphify explain Widget --graph graphify-out/graph.json
Ambiguous: 'Widget' matches 2 nodes in different files.
  src/screens/Home.tsx
    id: src_screens_home_widget
  src/components/Widget.tsx
    id: src_components_widget_widget
Retry with the repo-relative path or the full node id.

$ graphify explain "src/components/Widget.tsx::Widget" --graph graphify-out/graph.json
No node matching 'src/components/Widget.tsx::Widget' found.

$ graphify explain "src/components/Widget.tsx:Widget" --graph graphify-out/graph.json
No node matching 'src/components/Widget.tsx:Widget' found.

$ graphify explain "src/components/Widget.tsx" --graph graphify-out/graph.json
Node: Widget.tsx
  ID:        src_components_widget
  ...

The bare path does resolve, but to the file node: serve._find_node_tiers has a source_exact tier that matches the tokenized query against source_file, and no tier that combines a path with a label. So the message's first suggestion yields either "No node matching" or a different node than the one asked about. Only the id: works, and an id is not something a reader types from memory.

Expected

Either, ideally both:

  1. A path-scoped symbol form in _find_node, e.g. path::Symbol (the form explain: silently returns one arbitrary match when a symbol name is ambiguous (no warning, no match count, no way to qualify) #3176 already tried), restricting the label match to nodes whose source_file equals the path. #569's --file flag is the same capability spelled as an option.
  2. Until then, the message says what works: "Retry with one of the node ids above."

Where

  • graphify/cli.py, explain branch: prints "Retry with the repo-relative path or the full node id."
  • graphify/serve.py, _find_node_tiers: source_exact is a file-node tier.

Why it matters

The guard from #3176 is good: it stops a same-named local symbol (Home.tsx declares its own Widget) from silently answering for the exported one. The follow-up advice sends the reader one call sideways in exactly the situation the guard was built for.

Version: graphify 0.9.57 (graphifyy on PyPI), Python 3.12.3, Linux.

Activity

  1. added a commit that references this issue on Sep 12, 2026
    f9b6f21
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions