Repository navigation
Description
Version: graphifyy 0.9.94 (also 0.9.47). OS: Windows 11, Python 3.12.
What happens
graphify affected <path> answers No unique node match for <path> for a file whose basename is shared with another file and which has a second node on L1 (for example, a module docstring, which becomes a rationale node). Asking by the file node's id works, so the graph is fine; only the path lookup misses.
In our real repository, this affects 404 of 4,771 files (about 1 in 12). Every per-agent callbacks/before_tool.py-style file with a docstring falls into it. Callers that script affected <path> get an error that reads like "this file is not in the graph".
Minimal repro
app/__init__.py
app/main.py from app.alpha.hooks import check
def handle(request): return check(request)
app/alpha/__init__.py
app/alpha/hooks.py """Checks a request before it runs."""
(two blank lines)
def check(request): return bool(request)
app/beta/__init__.py
app/beta/hooks.py same as app/alpha/hooks.py
graphify update . --force
graphify affected app/alpha/hooks.py # -> No unique node match for app/alpha/hooks.py
graphify affected app_alpha_hooks # -> lists main.py and handle(), as expected
Controls (same layout, each one changed):
| Case | affected app/alpha/hooks.py |
|---|---|
| shared basename + docstring | No unique node match |
shared basename, # comment instead of a docstring |
works |
unique basename (no app/beta) + docstring |
works |
Why
resolve_seed matches the path against source_file, which correctly finds every node of app/alpha/hooks.py, then calls _prefer_file_node to pick the file node. All three of its passes miss:
- The label equals the basename and is on L1. Label disambiguation has renamed the file node's label to
alpha/hooks.py, so it no longer equalshooks.py. - The only node on L1. The file node and the docstring's
rationalenode (app_alpha_hooks_rationale_1) are both onL1. - The label equals the basename. This misses for the same reason as the first pass.
Nodes for the file:
app_alpha_hooks | alpha/hooks.py | L1 | code
app_alpha_hooks_rationale_1 | Checks a request before it runs. | L1 | rationale
app_alpha_hooks_check | check() | L4 | code
Suggested fix
In _prefer_file_node, also accept a label that is a path suffix of the query, so a disambiguated label still counts as the file's own name:
query_norm = _normalize_label(query)
def _is_file_label(label: str) -> bool:
label = _normalize_label(label)
return label == query_basename or query_norm == label or query_norm.endswith("/" + label)
exact_file_nodes = [
node_id for node_id in node_ids
if str(graph.nodes[node_id].get("source_location", "")) == "L1"
and _is_file_label(str(graph.nodes[node_id].get("label", "")))
]A smaller alternative is to leave rationale nodes out of the l1_nodes fallback. The suffix match seems more robust, though, because any other L1 node (a decorator, a one-line import-time call) would cause the same tie.
The same _prefer_file_node logic is on main today.
Activity
github-actions commentedon Oct 23, 2026
Thanks for opening this issue, @karsan8119. A maintainer will take a look soon.
If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.
To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.
fix: resolve affected <path> for disambiguated file labels (#4698)
test: affected <path> on a shared basename with a second L1 node (#4698)
safishamsi commentedon Oct 23, 2026
Fixed in 0.9.95 by #4713. Thanks @karsan8119 for the report. Live on PyPI: https://pypi.org/project/graphifyy/0.9.95/
chore: [HIMMEL-7394] sync to upstream 0.9.95 and carry the himmel del…