Commit f2b9f99
fix(ast): uncap L6 symbol/edge ingestion; surface file-import chain
Two unrelated caps were silently strangling the cortex viz at the L6
phase. With the Cortex repo indexed (4115 files, 200K AP nodes), L6 was
emitting only 2,007 symbols and 4,121 imports — at most ~3% of the data
AP holds. This commit lifts both caps and adds the missing rel tables.
Cap 1 — workflow_graph_source_ast.py:_MAX_SYMBOLS_PER_FILE
- The LIMIT clause scaled with len(paths). The L6 caller passes paths=[]
for full-graph load, so max(0, 1) = 1 capped every per-label query at
500 symbols. 6 labels × 6 projects ≈ 18K theoretical, ~2K observed
after AP's per-table sparseness — vs 91,648 after the fix.
- Drop the LIMIT entirely in load-all mode (paths=[]); keep it only when
the caller specifies an explicit path filter.
Cap 2 — mcp_client.py:line_limit
- Asyncio stream-buffer cap of 10 MB on the JSON-RPC stdio frame. AP
responses with 100K+ symbols + edges legitimately exceed this and
trigger LimitOverrunError, truncating L6 output mid-stream. Bumped to
1 GB so realistic workloads never hit the cap; OS pipe buffering
still provides backpressure.
Missing edge kinds — workflow_graph_source_ast.py:_load_edges_async
- Hardcoded a narrow set of (src, dst) label pairs for the rel-table
enumeration. Files imported into Class/Interface/TypeAlias/Macro etc.
were silently dropped because their tables (e.g. Imports_File_Class)
were never queried. Calls from Macro and member-of from JVM/Swift
containers had the same issue.
- Replaced with the full Cartesian product over the appropriate label
sets. AP returns empty rows for missing rel tables, so over-
enumeration is safe — costs extra round-trips, no correctness risk.
Import nodes — _SYMBOL_LABELS + _NON_QUALIFIED_LABELS
- AP exposes every `import` statement as an Import node and links it
via Defines_File_Import; that table alone holds 36,637 edges per
project, vs the ~5K Imports_File_* set the loader was querying.
- Add Import to _SYMBOL_LABELS and a _NON_QUALIFIED_LABELS set so
_load_symbols_async knows to read s.id / s.path instead of
s.qualified_name / s.name (Import nodes don't carry the latter).
- Patch _run_edge to select dst.id when dst_lbl is non-qualified.
- Wire Defines_File_Import as an "imports"-kind edge in the loader.
Uses_* edges
- Type-usage edges (Method/Function uses Struct/Class/etc.) were never
captured. Adding them yields +6,774 edges across the full roster.
Net effect on the live Cortex graph (6 AP projects):
symbols 2,007 → 91,648 (45.7×)
imports 4,121 → 41,846 (10.2×)
uses 0 → 6,774 (new kind)
defined_in 54,889 → 91,648 (1.7×; Imports become symbol nodes)
total nodes 305,669 → 342,849
total edges 397,382 → 479,109
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent df141f5 commit f2b9f99
3 files changed
Lines changed: 94 additions & 130 deletions
File tree
- .claude-plugin
- mcp_server/infrastructure
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
189 | 190 | | |
190 | 191 | | |
191 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
192 | 199 | | |
193 | 200 | | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
194 | 206 | | |
195 | 207 | | |
196 | 208 | | |
| |||
337 | 349 | | |
338 | 350 | | |
339 | 351 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
346 | 374 | | |
347 | 375 | | |
348 | 376 | | |
| |||
510 | 538 | | |
511 | 539 | | |
512 | 540 | | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
532 | 560 | | |
533 | 561 | | |
534 | 562 | | |
| |||
557 | 585 | | |
558 | 586 | | |
559 | 587 | | |
| 588 | + | |
| 589 | + | |
560 | 590 | | |
561 | 591 | | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
562 | 600 | | |
563 | 601 | | |
564 | | - | |
| 602 | + | |
565 | 603 | | |
566 | 604 | | |
567 | 605 | | |
568 | 606 | | |
569 | | - | |
| 607 | + | |
570 | 608 | | |
571 | 609 | | |
572 | 610 | | |
| |||
629 | 667 | | |
630 | 668 | | |
631 | 669 | | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
632 | 691 | | |
633 | 692 | | |
634 | 693 | | |
| |||
0 commit comments