Skip to content

Explain synthetic init wrappers in go/ssa and their impact on blank-import edge propagation - #10

Closed
bubunyo with Copilot wants to merge 1 commit into
feat/support-sideeffect-importsfrom
copilot/sub-pr-9
Closed

Explain synthetic init wrappers in go/ssa and their impact on blank-import edge propagation#10
bubunyo with Copilot wants to merge 1 commit into
feat/support-sideeffect-importsfrom
copilot/sub-pr-9

Conversation

Copilot AI commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Addressed a question about what "synthetic init wrappers" means in the context of the sideeffect imports feature and why they matter for impact propagation.

Context

In go/ssa, pkg.Func("init") returns a synthetic package initializer — a function generated entirely by the SSA builder with fn.Synthetic = "package initializer" and no source position (fn.Pos() == token.NoPos). It is not the user-written func init(). Instead, it orchestrates initialization by calling the real user-defined init functions (init#1, init#2, …) in order.

Problem

synthesiseBlankImportEdges builds edges using these synthetic init wrappers, but BuildGraph skips synthetic functions during call-graph traversal (isSynthetic() check). This breaks the propagation chain:

user change → init#1 → [synthetic init] → [synthetic importer init] → importer init#1
                              ↑ skipped by isSynthetic                ↑ skipped

A change to init#1 is tracked against its own key, but the call edge from init#1 into the synthetic wrapper is invisible to the graph walker — so impact never flows through blank-import edges into dependent services.

Resolution

Replied to the review comment with the above explanation. The underlying propagation gap (using non-synthetic init#N functions or explicitly including synthetic init→init edges in the reverse index) remains open for follow-up.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] [WIP] Address feedback on synthetic init wrappers in sideeffect imports feature Explain synthetic init wrappers in go/ssa and their impact on blank-import edge propagation Mar 20, 2026
Copilot AI requested a review from bubunyo March 20, 2026 05:14
@bubunyo bubunyo closed this Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants