Repository navigation
docs: call-graph edge kinds, and what the call graph adds to a parser (with measurements) - #3713
Merged
Merged
Conversation
…unit
Python sliced only defs, so the code a module runs at import -- app =
FastAPI(), @app.post("/items"), setup_logging(), the __main__ guard -- was
recorded nowhere, and a web app's route registration with it. The Mode C
slicer now emits Mode D's synthetic __global_context__ bucket for Python and
embedded_python (top-level module_level_unit flag): every sliced unit's span
and each `class Name` header's name are blanked, the rest is scanned for
calls (qualifiers and receiver types included, so app.post is typed
FastAPI.post).
It is calls-only: magnitude/impact 0 and flagged calls_only, which the file
mass, function-analysis report, function-impact forensics, file-archetype
function count, named-structure retention and folder function count skip, so
no file's size or classification moves because of it.
Synthetic units have no function_data row (#2691), so their calls now ride
on a synthetic_unit_data child table (FK cascade) that the state rehydrator
restores; a delta scan resolves them like a fresh scan. This also covers
Mode D's existing buckets, which were lost on delta scans.
Golden masters (both, 42 differences each): fastapi applications.py direct
downstream 44 -> 191, routing.py 13 -> 30, param_functions.py 92 -> 103
(module-level app/router construction and calls now link to the defining
file), and what those move: Composition Fit z-scores, within-repo file
clusters, network macros, three forensic top lists.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
… audit) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
…decorator A decorator's wrapper runs around every call to the function it decorates, and neither the call graph nor the module unit recorded that link. The detector now captures, per def, the contiguous decorator block directly above it (argument lines included, shielded text, bounded look-back) as decorated_by / decorated_by_qualifiers (`@app.post(...)` -> post via app); python and embedded_python opt in with a top-level decorator_edges flag. The resolver links them through the usual ladder as fcall_data kind 'decorator' -- counted in decorators_by_step, never in the call-resolution rates -- and they reach function fan-in/PageRank like COBOL transfers do. A function now also falls back to its module's receiver types (`app = FastAPI()` at top level) for a receiver it does not bind itself; a name the function binds with no known class is recorded as "" and hides the module type. Both columns persist in function_data and rehydrate. call_graph_resolution.py python (pyan3): calls-only precision 99.4% (1806 judged), recall 51.3 -> 51.4, resolution recall 96.9 -> 97.0; new, not gated: decorator edges 100% precision (575 judged, 0 wrong), recall with decorators 67.9%. Golden masters: no drift. Stacked on #3704 (module-level unit). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
…or-edges # Conflicts: # gitgalaxy/core/detector.py # gitgalaxy/standards/language_standards/languages/embedded_python.py # gitgalaxy/standards/language_standards/languages/python.py # tests/tools_recorders/test_fcall_data.py
… the file's first A function name used as a value -- Depends(get_db), key=sort_key, callback=self.on_done, return wrapper -- is a link the framework or caller invokes later, and was recorded nowhere. The detector (python and embedded_python, top-level reference_edges flag) records candidates in argument, keyword, assignment, return/yield/lambda and collection positions as references_to / references_qualifiers. Variables are excluded: the function's parameters and locals (tuple and starred targets included), every nested def's parameters, the bindings of every enclosing function (closure variables), the module's own variables (`app = FastAPI()`), and in a signature anything but a default or a call argument (so `Sequence[Depends]` is not one). Names the function also invokes are already edges. The resolver keeps a reference only when it reaches a function confidently through a scoped step (class, qualified, typed, file, import) -- `unique` is not enough for a bare name -- as fcall_data kind 'reference', counted in references_by_step and never in the call rates. A bare call or reference to a name the caller defines nested inside itself now resolves to that nested definition, not the file's first of that name (every decorator's own `wrapper`); the rehydrator restores loc for the caller's span. The module unit carries no references yet (synthetic_unit_data does not persist them). call_graph_resolution.py python (pyan3): call precision 99.4 -> 99.8 (1806 judged), recall 51.4 -> 51.6, resolution recall 97.0 -> 97.5; new, not gated: reference precision 99.7% (323 judged), recall across calls, decorators and references 77.3%. Golden masters: no drift. Stacked on #3708 (decorator edges). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
…coped to calls `return helper` now draws a reference edge o2 -> helper, which is the point of this PR; the C5 test's claim is that the nested header is not a call, so it checks call-kind rows and asserts the reference separately. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
…measurements Adds two sections to docs/function_call_graph.md: the fcall_data edge kinds (call, transfer, decorator, reference -- what each links, which languages record it, what joins the file graph) and what the resolver knows on top of a parser's callee names, each capability with its pyan3 measurement and the limits those numbers carry (one reference tool, one language, tuned on the scored corpus). Deliberately not a why_gitgalaxy_beats_ast_here.md claim: resolution is something a parser does not attempt, not something it gets wrong. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Merged
2 tasks done
Contributor
…ce-edges # Conflicts: # gitgalaxy/core/call_resolver.py # gitgalaxy/core/detector.py # gitgalaxy/core/state_rehydrator.py # gitgalaxy/recorders/record_keeper.py # gitgalaxy/standards/language_standards/languages/embedded_python.py # gitgalaxy/standards/language_standards/languages/python.py # tests/call_graph_resolution_baseline.json # tests/core_engine/test_call_resolver.py # tests/tools/call_graph_resolution.py # tests/tools/test_call_graph_resolution_gate.py # tests/tools_recorders/test_fcall_data.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Docs only. Stacked on #3712 (reference edges), which is stacked on #3708 (decorator edges); it describes both. Merge those first, then retarget this to
main.Adds two sections to
docs/function_call_graph.md:Edge kinds. The four
fcall_data.kindvalues:call;transfer(COBOLGO TO);decorator(a decorated function → each decorator);reference(a function → a function it uses as a value).For each: what it links, which languages record it, and the one asymmetry that matters when reading metrics. All four reach function fan-in and PageRank, but only
calljoins the file graph (confident_file_pairs), so file-level metrics measure calls alone. It also notes Python's calls-only__global_context__unit and its delta-scan persistence.What the call graph adds to a parser. Each resolution capability, with its pyan3 measurement on language-crucible's Python repos:
__init__.py,index.ts) — Python resolution recall 72% → 90% #3689);typedstep — resolvex.method()when the function shows x's class (Python) #3693);app = FastAPI(),@app.post(...)) in a calls-only__global_context__unit #3704);Headline: 77.3% recall of pyan's function edges across calls, decorators and references (calls alone 51.6%), at 99.7–100% precision per kind.
Deliberately not a
why_gitgalaxy_beats_ast_here.mdclaim. Resolving a call to its definition is something tree-sitter doesn't attempt, not something it gets wrong, so it doesn't meet that doc's bar of "more correct than the parser's own parse". The section says so, and it states the limits the numbers carry:Type of change
Verification
Docs only. Every number is copied from the
call_graph_resolution.pyruns recorded in #3689, #3690, #3693, #3704, #3708 and #3712, and fromtests/call_graph_resolution_baseline.jsonon #3712's head.🤖 Generated with Claude Code
https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Generated by Claude Code