Repository navigation
Description
Prior art, so this is not a duplicate
- explain: silently returns one arbitrary match when a symbol name is ambiguous (no warning, no match count, no way to qualify) #3176 (closed 2026-08-29) reported the silent pick and, under "Attempted workaround (does not work)", tried
path::run_sweepand got "No node matching". The fix that closed it added the ambiguity guard and the id list. The qualifier half was not addressed, and the new message now recommends it. - explain/_find_node cannot resolve node IDs containing punctuation or non-ASCII text (concept:*, merge-graphs ::, Hangul) #2467 (fixed) repaired the other half of the same hint: the printed node id could not be fed back into
explain. This issue is the same shape for the "repo-relative path" half. - Feature request: scoped resolution for explain/query/path (monorepos, minified bundles, name collisions) #569 (open) proposes
explain --file <path> [--line N]for monorepos; that flag would also resolve this. This issue is narrower: the message today points at a form that resolves to the wrong node.
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:
- 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 whosesource_fileequals the path.#569's--fileflag is the same capability spelled as an option. - Until then, the message says what works: "Retry with one of the node ids above."
Where
graphify/cli.py,explainbranch: prints "Retry with the repo-relative path or the full node id."graphify/serve.py,_find_node_tiers:source_exactis 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
Add path::Symbol resolution for explain
Let `path` resolve path::symbol endpoints the way `explain` does
fix(affected): resolve the reference forms explain already accepts
fix(affected): resolve the reference forms explain already accepts