Commit 91a3c6a
committed
feat(extract): model Go native channels as gochan Channel topology
Go's own concurrency primitives were invisible: the Go channel
extractor only classified gorilla/nhooyr WebSocket send/receive, so a
channel-plumbed event pipeline (250 make(chan ...), ~710 send/receive
sites on the measured repo) produced zero Channel nodes and trace_path
stopped dead at every send site.
v1, extraction-only - the existing per-file materializer
(create_channel_edges_for_file and its parallel twin) already builds
Channel nodes and EMITS/LISTENS_ON edges from CBMChannel records:
- send_statement (x <- v) -> EMIT, unary <- -> LISTEN. Both are channel
operations BY GRAMMAR, so no type inference is needed for precision -
unlike the WebSocket name heuristics. select comm clauses are covered
for free (they contain the same node kinds).
- Channel identity: the package-qualified tail identifier
(module_qn + '.' + field/var name), transport "gochan" - distinct
from "websocket", whose classifier is untouched. Same-package
cross-file producer/consumer pairs join on one node.
- Deliberately deferred (documented in #1930): element types on the
node, go statements (CROSS_ASYNC), and for-range receives - range
needs the operand's TYPE to know it is a channel, and a name-shape
guess would be the #1932 anti-pattern.
Also fixes a latent gap this exposed: enclosing_function_qn returned a
BARE name, which never matches any def QN, so every channel edge (the
WebSocket ones included) silently degraded to the file node through
find_channel_source's fallback. It now returns module_qn.name, with
the file-node fallback preserved for shapes it cannot express.
Reproduce-first (RED with extract_channels.c stashed):
extract_go_native_channels (EMIT+LISTEN records, package-qualified
names, unary minus not mistaken for a receive) and
pipeline_go_native_channel_topology (one gochan Channel node,
EMITS from Produce and LISTENS_ON from Drain across files). 643 green
across extraction/pipeline/registry.
Part of #1930
Signed-off-by: Ilya Brykau <ilya.brykau@orca.security>1 parent 5fbab7b commit 91a3c6a
3 files changed
Lines changed: 219 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
200 | 206 | | |
201 | 207 | | |
202 | 208 | | |
| |||
625 | 631 | | |
626 | 632 | | |
627 | 633 | | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
628 | 692 | | |
629 | 693 | | |
630 | 694 | | |
631 | 695 | | |
632 | 696 | | |
633 | 697 | | |
634 | 698 | | |
635 | | - | |
| 699 | + | |
| 700 | + | |
636 | 701 | | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
637 | 706 | | |
638 | 707 | | |
639 | 708 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3015 | 3015 | | |
3016 | 3016 | | |
3017 | 3017 | | |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
3018 | 3064 | | |
3019 | 3065 | | |
3020 | 3066 | | |
| |||
6752 | 6798 | | |
6753 | 6799 | | |
6754 | 6800 | | |
| 6801 | + | |
6755 | 6802 | | |
6756 | 6803 | | |
6757 | 6804 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4693 | 4693 | | |
4694 | 4694 | | |
4695 | 4695 | | |
| 4696 | + | |
| 4697 | + | |
| 4698 | + | |
| 4699 | + | |
| 4700 | + | |
| 4701 | + | |
| 4702 | + | |
| 4703 | + | |
| 4704 | + | |
| 4705 | + | |
| 4706 | + | |
| 4707 | + | |
| 4708 | + | |
| 4709 | + | |
| 4710 | + | |
| 4711 | + | |
| 4712 | + | |
| 4713 | + | |
| 4714 | + | |
| 4715 | + | |
| 4716 | + | |
| 4717 | + | |
| 4718 | + | |
| 4719 | + | |
| 4720 | + | |
| 4721 | + | |
| 4722 | + | |
| 4723 | + | |
| 4724 | + | |
| 4725 | + | |
| 4726 | + | |
| 4727 | + | |
| 4728 | + | |
| 4729 | + | |
| 4730 | + | |
| 4731 | + | |
| 4732 | + | |
| 4733 | + | |
| 4734 | + | |
| 4735 | + | |
| 4736 | + | |
| 4737 | + | |
| 4738 | + | |
| 4739 | + | |
| 4740 | + | |
| 4741 | + | |
| 4742 | + | |
| 4743 | + | |
| 4744 | + | |
| 4745 | + | |
| 4746 | + | |
| 4747 | + | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
| 4751 | + | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
| 4758 | + | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
| 4763 | + | |
| 4764 | + | |
| 4765 | + | |
| 4766 | + | |
| 4767 | + | |
| 4768 | + | |
| 4769 | + | |
| 4770 | + | |
| 4771 | + | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
| 4779 | + | |
| 4780 | + | |
| 4781 | + | |
| 4782 | + | |
| 4783 | + | |
| 4784 | + | |
| 4785 | + | |
| 4786 | + | |
| 4787 | + | |
| 4788 | + | |
| 4789 | + | |
| 4790 | + | |
| 4791 | + | |
| 4792 | + | |
| 4793 | + | |
| 4794 | + | |
| 4795 | + | |
4696 | 4796 | | |
4697 | 4797 | | |
4698 | 4798 | | |
| |||
13115 | 13215 | | |
13116 | 13216 | | |
13117 | 13217 | | |
| 13218 | + | |
13118 | 13219 | | |
13119 | 13220 | | |
13120 | 13221 | | |
| |||
0 commit comments