Commit d15da2a
authored
feat(extract): call-graph edge extractor (caller->callee) + Tier-1 calls gate (#26)
Add the sixth deterministic extractor — the deterministic foundation
under the future business-process extractor (DESIGN §14 item 2).
One `call_edge` artifact per RESOLVED caller->callee pair
(call:{caller_fq}->{callee_fq}; call-site lines aggregated in the
payload, the import-edge precedent). Three deterministic resolution
tiers, precision-first (only first-party-resolved edges are emitted,
never a wrong guess): same-module calls; imported-name calls —
CROSS-FILE, `from x import f [as g]` and `import x[.y] [as z];
x.y.f()` module-attribute forms via per-module import tables (incl.
relative imports, with the package-vs-module base handled for
non-__init__ modules); and `self.method()` to a method of the same
class. Documented gaps, surfaced by the gate: obj.method(...), getattr/
dynamic, super(), inherited self-calls, star imports, re-export
indirection, decorator/default-arg expressions, class-body calls.
Grounding: the caller def span (role `caller`; the module span for
module-level calls) + the callee def span (role `callee`, cross-file).
Direct recursion is a single-span artifact (one edge row — the
(artifact_id, span_id) PK); mutual recursion yields two distinct
artifacts (identity rule v2 — the collision class fixed in #24, now
regression-tested at the extractor level). Body-only scanning excludes
a def's own decorators/parameter defaults by construction; nested defs
attribute calls to the innermost function (no-descend traversal).
framework_versions deliberately empty (the import-graph rationale).
New Tier-1 HARD gate `tier1_calls_test` (hand-labeled oracle, 11 edges,
10 tests): set equality; mutual-recursion identity regression;
cross-file provenance; module-caller + merged lines; instantiation
edges (callee_kind=class); six known gaps asserted. Headline HARD
gates: twelve -> thirteen. Registered in default_extractors();
summarize/embed_text gained call_edge branches. 94 eval tests pass.1 parent aa17843 commit d15da2a
8 files changed
Lines changed: 666 additions & 14 deletions
File tree
- src/kb
- daemon
- embed
- eval
- extract/deterministic
- mcp
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
10 | 31 | | |
11 | 32 | | |
12 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
257 | 263 | | |
258 | 264 | | |
259 | 265 | | |
| |||
357 | 363 | | |
358 | 364 | | |
359 | 365 | | |
360 | | - | |
| 366 | + | |
361 | 367 | | |
362 | 368 | | |
363 | 369 | | |
| |||
404 | 410 | | |
405 | 411 | | |
406 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
407 | 417 | | |
408 | 418 | | |
409 | 419 | | |
| |||
442 | 452 | | |
443 | 453 | | |
444 | 454 | | |
445 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
446 | 458 | | |
447 | 459 | | |
448 | 460 | | |
| |||
0 commit comments