feat(extract): model Go native channels as gochan Channel topology - #1949
Draft
ilyabrykau-orca wants to merge 1 commit into
Draft
feat(extract): model Go native channels as gochan Channel topology#1949ilyabrykau-orca wants to merge 1 commit into
ilyabrykau-orca wants to merge 1 commit into
Conversation
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 DeusData#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 DeusData#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 DeusData#1930 Signed-off-by: Ilya Brykau <ilya.brykau@orca.security>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
This was referenced Aug 30, 2026
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.
Part of #1930 — draft implementation-proposal per the extraction points sketched in the issue body; will mark ready on a maintainer design ack.
What
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 zeroChannelnodes andtrace_pathstopped dead at every send site.How (v1, extraction-only — the existing materializer does the rest)
create_channel_edges_for_fileand its parallel twin already buildChannelnodes +EMITS/LISTENS_ONedges fromCBMChannelrecords, so the whole change lives in the Go extractor:x <- v(send_statement) →EMITS;<-x(unary) →LISTENS_ON. Both are channel operations by grammar — no type inference needed for precision, unlike the WebSocket name heuristics.selectcomm clauses are covered for free (same node kinds).module_qn.field-or-var), transportgochan— distinct fromwebsocket, whose classifier is untouched. Same-package cross-file producer/consumer pairs join on one node.gostatements (CROSS_ASYNC), andfor range chreceives — range needs the operand's type to know it's a channel, and a name-shape guess would be the exact anti-pattern Meta: Go / cgo / Go+C extraction — tracking issue #1932 catalogues.Also fixes a latent gap this exposed:
enclosing_function_qnreturned a bare name, which never matches any def QN — so every channel edge (the WebSocket ones included) silently degraded to the file node viafind_channel_source's fallback. It now returnsmodule_qn.name, fallback preserved.Tests (reproduce-first — RED with
extract_channels.cstashed)extract_go_native_channels: EMIT+LISTEN records, package-qualified names, unary minus is not a receive.pipeline_go_native_channel_topology: onegochanChannel node with"transport":"gochan",EMITSfromProduceandLISTENS_ONfromDrainacross files (RED:cc == 0, expected 1).scripts/test.shvenue leg green; clang-format clean.Field census
Pending (live-daemon rendezvous conflict blocks isolated-HOME one-shots right now); expected on the measured repo: the ~210 sends + ~500 receives materialize as gochan topology over the event pipeline. Will follow up as a PR comment.
#1932 tracks the family. Related: #1114.