[Bug]: markdown mentions: a bare lowercase word in a code span links to an unrelated method that carries that name · Issue #4609 · Graphify-Labs/graphify · GitHub
Skip to content

[Bug]: markdown mentions: a bare lowercase word in a code span links to an unrelated method that carries that name #4609

Description

@saad-siddique

What happened?

resolve_markdown_mentions links a bare code span (no (), no qualifier) to the corpus's single _callable that carries that label, and methods qualify. A word that is prose, not a reference, then becomes heading --references--> SomeClass.word() at INFERRED 0.95.

Expected: no edge. A parenthesis-less lowercase word in a code span (redis the server, data, message, request, current) is not evidence of a reference to a method on whichever unrelated class happens to define it.

On a real corpus (about 1,400 classes, 12 READMEs) 44 of 1,906 resolved mention edges were words of this kind: data, message, request, previous, current, integrations, signature, moved.

Steps to reproduce

d=$(mktemp -d)
printf 'class Cache:\n    def redis(self):\n        return "connection"\n' > $d/cache.py
printf '# Queue\n\nJobs run on `redis` (the server, not our code).\n' > $d/README.md
python - <<PY
from pathlib import Path
from graphify.extract import extract
d = Path("$d")
r = extract([d / "cache.py", d / "README.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"])
PY

Error output or graph output

[('Queue', '.redis()', 'INFERRED')]

Proposed fix

In the bare branch of resolve_markdown_mentions (graphify/markdown_resolution.py), when the span has no trailing () and no qualifiers and the candidate is a method (not _callable_class), keep the match only if the method's owner class (the method edge's source) is itself the target of a mention in the same document. successWithWarnings written next to HandlerResult keeps its edge; redis with no owner cited does not. The raw call already carries the span text in context, so the resolver can tell redis from redis().

A stricter alternative is to require parentheses for any method match.

I have this running downstream as a post-pass and can open a PR with a regression test if you prefer that to a patch from the maintainers.

Related: #3561 (the feature that added code-span mentions).

Graphify version 0.9.93 (also 0.9.92), macOS, Python 3.14, installed with uv tool.

Activity

  1. github-actions commented on Oct 20, 2026

    @github-actions

    Thanks for opening this issue, @saad-siddique. 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.

  2. lab1207 commented on Oct 21, 2026

    @lab1207

    Claiming this one — opened #4616: #4616

    I went with your primary proposal: a bare, qualifier-less mention keeps a method candidate only when one of the method's owner classes is named in the same document, so successWithWarnings written beside HandlerResult keeps its edge while redis with no owner cited does not. The span text in context separates redis from redis(), so a real call site is unaffected, and a bare word still resolves to a free function or a class. Two regression tests cover both directions.

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