Repository navigation
Description
What happened?
resolve_markdown_mentions links a bare code span to the only _callable in the corpus that carries that label. #4609 fixed this for methods in 0.9.94: a bare, parenthesis-less method name now needs its owner class cited in the same document. Free functions were left out on purpose. Pass 2a in graphify/markdown_resolution.py keeps them because "a class or free function label is specific enough to keep matching".
In practice a lowercase free-function name is as weak as a method name. A field name, a query parameter or an ordinary word in a code span lands on whichever function shares that name, in any language and any directory, at INFERRED 0.95.
Expected: no edge. In "sends the API key as the token query parameter", token is not a reference to token() in an unrelated JavaScript file.
On a real corpus all 17 edges this resolver produced were false. The corpus is an Elixir app whose ADRs, role docs and agent skills sit beside a few JS/TS helper scripts. None of the 17 landed on Elixir code.
- 12 were bare, parenthesis-less words that matched a free JS/TS function:
raw(4),fail(2),token,config,at,run,gitandcontext. In one,raw, a JSON field in a data-ingest ADR, linked toraw()in a TypeScript CLI helper. In another,token, a query parameter, linked to a chart-theme functiontoken(). - 3 were bare
now, which matched the methodWatchClock.now(). The 0.9.94 fix covers these. - 2 were
now()with parentheses, citing an expression function in the docs, which also matchedWatchClock.now(). The trailing()sends them through pass 1, so the owner check never runs.
Steps to reproduce
d=$(mktemp -d)
mkdir -p "$d/web" "$d/docs"
printf 'export function token(name) {\n return getComputedStyle(document.documentElement).getPropertyValue(name);\n}\n' > "$d/web/charts.js"
printf '# Quote feed\n\nThe client sends the API key as the `token` query parameter.\n' > "$d/docs/feed.md"
python - <<PY
from pathlib import Path
from graphify.extract import extract
d = Path("$d")
r = extract([d / "web/charts.js", d / "docs/feed.md"], parallel=False, cache_root=d / "cache", root=d)
labels = {n["id"]: n["label"] for n in r["nodes"]}
print([(labels[e["source"]], labels[e["target"]], e["confidence"]) for e in r["edges"] if e.get("relation") == "references"])
PYError output or graph output
[('Quote feed', 'token()', 'INFERRED')]
Proposed fix
Hold a bare, parenthesis-less free-function match to the test #4609 applies to methods, with the defining file in place of the owner class. Keep the match only when the same document also cites another symbol from that file, through a path-qualified mention, a dotted mention, a trailing () or another resolved mention. Then token with nothing else from charts.js cited gets no edge, while a doc that walks through charts.js, mentions palette() and then token keeps both.
On the corpus above this rule would remove all 12 free-function edges and no correct edge, because no correct edge of that kind existed. I checked that against the edge list, not by patching graphify.
Classes can keep matching as they do today. None of the false edges landed on a class.
The two now() edges show that a trailing () is also weak evidence when the name is a common word. I am not proposing a rule for that here.
Graphify version
Reproduced on 0.9.96 (the output above) and on 0.9.93.
On 0.9.96 I also checked the method case with export class Clock { now() {...} } and a doc citing now under one heading and now() under another. The bare now gets no edge, as #4609 intended. The now() heading still links to .now() at INFERRED, with no owner class cited.
Operating System
macOS (Darwin 25.6)
Python Version
3.14
Installation Method
uv tool
Additional context
Related: #4609 (the method case, fixed in 0.9.94) and #3561 (the feature that added code-span mentions).
Activity
github-actions commentedon Oct 26, 2026
Thanks for opening this issue, @dwinders. 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(markdown): a bare free function name needs its file cited (Graphi…
fix(markdown): a bare free function name needs its file cited (Graphi…
fix(markdown): a bare free function name needs its file cited (#4804)
safishamsi commentedon Nov 9, 2026
Fixed in 0.9.105 (now on PyPI) via #4806: a bare free-function mention in Markdown now binds only when its defining file is cited in the heading's section chain, not to any same-named callable in the corpus.
feat(markdown): reference files named by backticked paths (Graphify-L…
feat(markdown): reference files named by backticked paths (Graphify-L…