fix(go): model and resolve embedded type relationships - #835
Open
merlincat11 wants to merge 3 commits into
Open
Conversation
code-review-graph reviewOverall risk: 0.40 (MEDIUM) — 23 changed function(s)/class(es), 0 affected flow(s), 13 test gap(s) Risk-scored changes
Test gaps
Token savings: this graph-backed report used ~255,556 fewer tokens (~98%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
merlincat11
marked this pull request as ready for review
August 8, 2026 03:54
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.
Closes #834
Summary
type_specor alias as its own graph node, including grouped declarationsgo.modevidence_test.godeclarations from imported-package resolution so external test packages cannot shadow production typestype_elemrelationships asINHERITSonly when they resolve to interfaces; represent concrete or unresolved constraint terms asREFERENCESREFERENCESsemanticsRoot cause
The parser treated a whole
type_declarationas one type and expected embedded identifiers at the wrong AST depth. Its raw relationship targets also lacked enough package evidence for graph queries, while a single interfacetype_elemis syntactically ambiguous between interface composition and a concrete type-set term. Imported resolution additionally treated declarations from external_test.gopackages as normal package exports, creating false ambiguity when production and test packages defined the same type name.Impact
Go embedding and composition now participate in canonical graph traversal without making false inheritance claims for resolved concrete constraints. Grouped declarations and aliases are no longer silently omitted. Qualified imports resolve to production declarations even when a same-directory external test package shadows the type name.
On Terraform main at
da3a115efef0de2e817a8c3ef57c5df9297c99ce:inheritors_of Vertexreturns all 12 embedding sites, including the nine formerly disconnecteddag.Vertexrelationshipsinheritors_of GraphNodeConfigResourcereturns all five embedding sitesValidation
uv run pytest -q— 2,402 passed, 5 skipped, 2 xpasseduv run ruff check code_review_graph/ tests/test_multilang.pyuv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optionalVertexinheritors and 5GraphNodeConfigResourceinheritors