@@ -95,10 +95,39 @@ committed spec is the full transcript: `docs/design/specs/v2-l1-emission.md`. |
95 | 95 | - **`k_limit`** (envelope, L3+ only) = `--graph-field-depth` (default 3), the access-path |
96 | 96 | bound of the syntactic `ddg` (`x.f.g.h` → `x.f.g.*`); `ddg.prov` is `["ssa"]` (parity). |
97 | 97 |
|
98 | | -### Deferred (not this train) |
99 | | -- L4 (SDG param edges) — reuses Group A ids/spans and the L3 vocabulary unchanged. Designed in |
100 | | - `docs/design/specs/v2-l3-l4-dataflow.md`. A Go-specific `select` cfg kind was not added |
101 | | - (`select` is a `switch` with `switch_case` edges). |
| 98 | +### L4 SDG (`-a 4`; spec `docs/design/specs/v2-l3-l4-dataflow.md` §4.6–§4.16, §6) |
| 99 | +Reuses Group A ids/spans and the L3 vocabulary unchanged; every L4 fact is an addition |
| 100 | +(`-a 3` ⊆ `-a 4`, gated). Leaves: |
| 101 | +- **Vertices** (body nodes, span-less, no `callee`): `@formal_in:<i>`, `@formal_out[:<i>]`, |
| 102 | + `<call-key>/actual_in:<i>`, `<call-key>/actual_out[:<i>]` (Python's `IdentityMap` indexing: |
| 103 | + `formal_in`/`actual_in` always indexed; an out is bare iff its group has one vertex). Actuals |
| 104 | + carry `parent` = the call key (a non-call capture site: the literal's host). **`of`** (D6, |
| 105 | + Python spelling, which the SDK's resolver reads): the param/receiver name; unnamed or `_` param |
| 106 | + `_<i>` (declared index, receiver excluded); unnamed or `_` receiver **`_recv`**; results |
| 107 | + `<return>` / **`<return>:<i>`** (never user result names; `:<i>` is a Go leaf); |
| 108 | + `<capture>:<name>`; `<global>:<pkgpath>::<Name>`. The SDK reads `of`, never |
| 109 | + `parameters[]` (`formal_in:0` is a method's receiver). |
| 110 | +- **Edges:** application `param_in[]` / `param_out[]` `{src, dst, var}` (global ids, `var` = the |
| 111 | + callee formal's `of`); callable `summary[] {src, dst}` (local keys, actual_in → actual_out); |
| 112 | + port wiring in `ddg` with `prov: ["reaching-defs"]` (Python precedent; coarse host wiring: |
| 113 | + host → every actual_in, every actual_out → host); may-alias `ddg` with `prov: ["points-to"]`. |
| 114 | +- **Dispatch:** VTA over the project's functions (library targets in the set); `call_graph` |
| 115 | + gains VTA-only edges `prov: ["vta"]`, weight 1 (an L2 edge is never changed). **D7:** an |
| 116 | + interface call binds the interface method (pass-through summary) *and* every VTA target. |
| 117 | +- **Stand-ins:** `external_symbols[].receiver {name, type}` and `.body` (formal vertices only, |
| 118 | + ids `<external-id>@formal_in:<i>`); summary all-to-all unless `--library-models` overrides it |
| 119 | + (keys `<import-path>/<sig>`, values `[in, out]` `of` pairs). A model changes summaries, not |
| 120 | + statement-level reachability; sanitizer semantics are the SDK's [user, 2026-10-27; |
| 121 | + codellm-devkit/.github#103]. |
| 122 | +- **`degraded[]`** envelope leaf `{code, detail?, packages[]?, callables[]?}`, absent when |
| 123 | + nothing degraded; codes `no_ssa | no_vta | no_cha | partial_ssa | partial_types | unmapped_ssa | |
| 124 | + l3_skipped | range_func` (open vocabulary). `--strict` exits non-zero on any. |
| 125 | +- **Rulings:** global → global summary edges are omitted [user, 2026-10-26; #30]; memory is |
| 126 | + measured and reported per app, not gated (D3) [user, 2026-10-26]; range-over-func is not |
| 127 | + modelled, degraded `range_func` (D8); `-a 4 -t` is an error and `--emit neo4j -t` projects |
| 128 | + at L3 with a warning (D9). |
| 129 | +- A Go-specific `select` cfg kind was not added (`select` is a `switch` with `switch_case` |
| 130 | + edges). |
102 | 131 |
|
103 | 132 | ## Neo4j-projection decisions |
104 | 133 |
|
@@ -185,11 +214,17 @@ shared neutral vocabulary verbatim; never rename a sibling's shared name). Spec: |
185 | 214 | It carries `call_node` (JSON `parent` verbatim — the **local** key, see § Flattened |
186 | 215 | properties) and `var` (JSON `of`; L4 — absent at L3). `GO_HAS_BODY_NODE` may originate at `:GoExternal` (L4 stand-ins). |
187 | 216 |
|
188 | | -### Reserved L4 overlay (declared now, emits nothing until L4 lands) |
189 | | -- `schema.go` still declares `GO_PARAM_IN`, `GO_PARAM_OUT`, `GO_SUMMARY` (`Reserved`) with |
190 | | - parity-correct names; the projector emits **zero rows** for them. When L4 lands they fill |
191 | | - with **no schema-contract change**. (`--emit neo4j` is "full-depth = max implemented" — |
192 | | - L3 today; the graph grows additively.) |
| 217 | +### L4 overlay (live; `--emit neo4j` runs at L4, D4) |
| 218 | +- `GO_PARAM_IN {var}`, `GO_PARAM_OUT {var}` and `GO_SUMMARY` are live (no longer `Reserved`; |
| 219 | + same names as declared, no contract change). One row per JSON `param_in[]` / `param_out[]` / |
| 220 | + `summary[]` entry; endpoints are `:GoBodyNode` global ids. Port and points-to ddg ride |
| 221 | + `GO_DDG {var, prov}` (`_k = var|prov`). |
| 222 | +- Vertices are `:GoBodyNode`s with `var` (= JSON `of`) and `call_node` (actuals); stand-in |
| 223 | + vertices hang off their `:GoExternal` via `GO_HAS_BODY_NODE`. `:GoApplication.degraded_json` |
| 224 | + carries the envelope's `degraded[]`. |
| 225 | +- **Lazy push (D5):** every L4 row is upserted on every push (L4 facts are non-local); stale L4 |
| 226 | + rows need `--eager`. A stored `max_level` below the push's (or unreadable) forces a full |
| 227 | + upsert; a lower-level push leaves old L4 rows. `--emit neo4j -t` projects at L3 (D9). |
193 | 228 |
|
194 | 229 | ### SDK facade (`GoAnalysisBackend`, on the `python-sdk` fork — frontend rung) |
195 | 230 | - **Type-centric surface** (Go is the SDK's first class-less facade; no C precedent exists |
@@ -202,10 +237,13 @@ shared neutral vocabulary verbatim; never rename a sibling's shared name). Spec: |
202 | 237 | getters + `get_source`. Slicing / CFG / CDG / DDG / reachability are **omitted** (they |
203 | 238 | need L3/L4 the analyzer does not produce) per the ABC contract. (2026-10-24: L3 is now |
204 | 239 | emitted at `-a 3` — per-callable `cfg`/`cdg`/`ddg` and `GO_CFG_NEXT`/`GO_CDG`/`GO_DDG` — |
205 | | - so L3 accessors are supportable now; interprocedural slicing and taint still need L4: |
206 | | - `param_in`/`param_out`/`summary` and the points-to `ddg`.) |
| 240 | + so L3 accessors are supportable now. 2026-10-27: L4 is emitted at `-a 4` and by |
| 241 | + `--emit neo4j` — `param_in`/`param_out`/`summary` and the points-to `ddg` — so |
| 242 | + interprocedural slicing and taint are supportable too.) |
207 | 243 |
|
208 | 244 | ### Deferred (not this train) |
209 | | -- SDK consumer slicing/taint surface and L3/L4 facade methods — arrive with the L3/L4 |
210 | | - analyzer train, reusing this graph vocabulary unchanged. |
| 245 | +- SDK consumer slicing/taint surface and L3/L4 facade methods — the analyzer now emits L4; |
| 246 | + the SDK side reuses this graph vocabulary unchanged. |
211 | 247 | - Struct-tag modeling. (`defer_resume` landed with L3; see § L3 body and edges.) |
| 248 | +- `GO_EMBEDS` / `GO_SATISFIES` resolution: `base_types[]` holds raw type strings and |
| 249 | + `interfaces[]` is never computed (#31, pre-existing). |