Skip to content

AST "uses" edges always get INFERRED confidence_score=0.5, violating the documented rubric #2813

Closed

Description

@gsrcfinance-commits

graphify version: 0.9.45 (pipx install)

Bug

Every edge with relation: "uses" produced by the structural (AST) extractor
is marked confidence: "INFERRED" with confidence_score: 0.5 — no
exceptions. Checked across a full project graph: 21/21 "uses" edges are
flat 0.5.

This directly violates the confidence rubric in references/extraction-spec.md,
which says INFERRED edges must pick one of {0.55, 0.65, 0.75, 0.85, 0.95} and
"never 0.5, never as a default." All other relation types in the same graph
(shares_data_with, semantically_similar_to, conceptually_related_to,
produced by the semantic/LLM subagents) correctly follow the discrete rubric —
this is isolated to AST-generated uses edges specifically.

Why this is wrong, not just inconsistent

The uses edges I checked are not actually uncertain — they're structurally
certain (e.g. a function with a type-annotated parameter ledger: QuotaLedger
that calls ledger.charge(...) in its body). AST already labels imports and
calls edges as EXTRACTED with confidence_score: 1.0 for equivalent
structural certainty. uses edges from the same extractor should get the same
treatment — either EXTRACTED/1.0, or a real score from the rubric — not a
hardcoded 0.5 placeholder that makes 100%-certain relationships look like a
coin flip.

Repro

Run /graphify <path> on any Python project with class instances passed
between functions, then:

python -c "
import json
from collections import Counter
g = json.load(open('graphify-out/graph.json'))
c = Counter(e['confidence_score'] for e in g['links'] if e['relation']=='uses' and e['confidence']=='INFERRED')
print(c)
"

Expect: Counter({0.5: N}) for all N "uses" edges.

Suggested fix

In the AST extractor, either:

  1. Emit uses edges as EXTRACTED / 1.0 (matches imports/calls treatment), or
  2. Score them against the same discrete INFERRED rubric semantic subagents use.

Activity

  1. AromalBiju1 commented on Aug 17, 2026

    @AromalBiju1
    Contributor

    Traced it — bug's not in the uses extractors. resolution.py/apex.py just set confidence: "INFERRED", no score. Real culprit is export.py's fallback table:
    _CONFIDENCE_SCORE_DEFAULTS = {"EXTRACTED": 1.0, "INFERRED": 0.5, "AMBIGUOUS": 0.2}
    Anything hitting export without a confidence_score gets defaulted off this. calls/imports dodge it because they're tagged EXTRACTED already. uses never gets a real score upstream so it always lands on 0.5.
    resolution.py's uses edges resolve to one unambiguous import target — should just be EXTRACTED like calls/imports, not a fallback default. Apex's uses (trigger/SObject/DML) are murkier, probably need actual per-case INFERRED scores instead of one blanket fix.
    Can PR the resolution.py side if that's the right call

  2. safishamsi commented on Aug 19, 2026

    @safishamsi
    Member

    Fixed in v0.9.47: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.47 (AST INFERRED edges now carry a rubric confidence_score). Closing as resolved.

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