Docs / design / go-tier1-completion-plan · Edit on GitHub

Go Tier-1 completion plan (#46)

Status: Phase 0–3 done; high-impact Go CFG lowering landed (if/switch init, for_clause, switch case bodies). Remaining: fallthrough/goto/short-circuit/defer-unwind; Phase 4 polish.
Coverage map: go-language-coverage.md
Issue: https://github.com/sshaaf/rgctl/issues/46

Progress (2026-07-24)

ItemState
Coverage doc LF-01…LF-21done
internal/langfeatures/ fixturesdone
lf_* expected-facts + tests/go_langfeatures.rsdone
field_identifier call extractiondone
Receiver FQN + type hintsdone
Interface methods + type_elem embed promotiondone
Cross-file field-type late bind (field_type_index)done
var_spec def-use + switch/select complexitydone
Struct anonymous embed fieldsdone
Kubernetes createPodSandbox → RunPodSandboxverified
IMPLEMENTS (method-set) + embed EXTENDSdone
Import / const / TypeAlias / generics metadatadone
Tier-1 doc A6 “optional for Go” removaldone
Go CFG: if/switch initializer before conditiondone
Go CFG: for_clause init/cond/update + continue→updatedone
Go CFG: switch/select case statement_list + Return edgesdone
Go CFG: fallthrough, goto/labels, &&/|| short-circuitdone
Go CFG: labeled break/continue, defer/panic unwinddone

Goals

  1. Usable Go call graphs for idiomatic code (methods, interfaces, embeds).
  2. No Tier-1 language surface silently optional — document honesty limits only where analysis is fundamentally undecidable.
  3. Correctness enforced by graph_correctness on ecommerce-go (lf_* facts).

Phase 0 — Spec & fixtures (this PR track)

TaskDeliverableDone when
0.1 Coverage documentdocs/design/go-language-coverage.mdFeature IDs LF-01…LF-21
0.2 Fixture packagergctl-tests/ecommerce-go/internal/langfeatures/Compiles; discover indexes symbols
0.3 Expected factslf_* entries in expected-facts.jsoncargo test --test graph_correctness go exercises them
0.4 Plan + issue updatethis doc + #46Linked from issue body

Phase 1 — P0 call graph (unblocks kubelet-style paths)

TaskChangeUnlocks
1.1callee_name: accept field_identifierLF-02, LF-03, LF-04 extraction
1.2Go methods: receiver type → qualified_name (Type.Method) + metadataLF-02, LF-03, LF-18 browseability
1.3Call relations: set to_type_hint / to_qualified_hint from receiver/local types (best-effort)Cross-file same-name resolution
1.4Unit tests in rgctl-lang-go for selector + collisionPrevents silent regression
1.5Green LF-01…LF-03 (and LF-18) in graph_correctnessPhase 1 exit

Phase 2 — P0 dataflow / metrics / embedding fields

TaskChangeUnlocks
2.1def_use: walk var_spec under var_declarationLF-08
2.2Complexity: real switch/select node kinds + casesLF-11…LF-13
2.3Struct embed: record anonymous fields; emit embed relationLF-06, LF-07
2.4Green LF-06…LF-09, LF-11…LF-13Phase 2 exit

Phase 3 — P1 interfaces, imports, types

TaskChangeUnlocks
3.1Extract interface method_elem as methods / signaturesLF-04 contract
3.2Best-effort IMPLEMENTS (method-set satisfaction)LF-05
3.3Interface call → candidate impls (multi-edge or ranked)LF-04
3.4Import symbols / IMPORTS edgesLF-17
3.5Const, package var, type alias symbolsLF-10
3.6Generics: retain type param metadata; call name resolveLF-16
3.7Green LF-04, LF-05, LF-10, LF-16, LF-17Phase 3 exit

Phase 4 — CPG / CFG polish / docs

TaskChangeUnlocks
4.1Receiver field-write golden (not only free func)LF-19
4.2defer / go documented CFG semantics; call from go f()LF-14, LF-15
4.2bHigh-impact CFG: if/switch init, for_clause, case body loweringdone — see coverage “Go CFG lowering”
4.2cLabeled break/continue, defer/panic unwinddone
4.3Struct tags + multi-return (best_effort → required if cheap)LF-20, LF-21
4.4docs/tier-1-language-support.md: remove “optional for Go” on A6; point herePolicy
4.5Dashboard gate asserts min calls among langfeaturesCI

Non-goals (honesty)

  • Full points-to / reflection / any dynamic dispatch certainty
  • Cross-goroutine channel taint (may stay sequential CFG forever; must be documented)

Exit criteria for #46

  • All required lf_* facts green in graph_correctness for go
  • Kubernetes spot-check: createPodSandbox has CALLS to RunPodSandbox (name-level); blast-radius on SyncPod non-empty callees via GQL
  • Tier-1 doc updated; coverage matrix rows LF-01…LF-19 required ✅