Skip to content

Fix TinyGo JSONBody[T] type-name collision - #7

Merged
pikann merged 2 commits into
masterfrom
fix/jsonbody-tinygo-collision
Aug 30, 2026
Merged

Fix TinyGo JSONBody[T] type-name collision#7
pikann merged 2 commits into
masterfrom
fix/jsonbody-tinygo-collision

Conversation

@pikann

@pikann pikann commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of the fix for Paca-AI/paca#445 — see Paca-AI/paca-plugin-github#24 for the full root-cause writeup (TinyGo generic-function monomorphization silently collapsing same-named-but-different-shape local types passed to plugin.JSONBody[T]).

updatePanelLayoutForView and previewQuery in backend/panels.go each declared their own locally-scoped type body struct{...} with the same name but unrelated fields (a []panelLayoutEntry slice vs a single Query string). Under TinyGo this risks json.Unmarshal silently decoding one call site against the wrong struct's field layout.

Fix

Renamed both to updatePanelLayoutBody / previewQueryBody. The package-level panelBody type (declared once, intentionally shared by createPanelForView and updatePanelForView) was already safe and is untouched.

Verification

go test ./... and go vet ./... pass.

🤖 Generated with Claude Code

pikann added 2 commits August 30, 2026 16:42
TinyGo's generic-function monomorphization keys plugin.JSONBody[T]
instantiations by T's bare type name rather than its full declaration
site. updatePanelLayoutForView and previewQuery each declared their
own `type body struct{...}` with the same name but unrelated fields
(a []panelLayoutEntry slice vs a single Query string) -- TinyGo could
collapse them into one shared field layout, so json.Unmarshal would
silently decode one call site against the wrong struct.

Renamed both to updatePanelLayoutBody / previewQueryBody. The
package-level panelBody type (shared intentionally by
createPanelForView and updatePanelForView, declared once, not
per-handler) was already safe and is untouched.

Part of a coordinated fix across all first-party plugins; see
Paca-AI/paca#445 and Paca-AI/paca-plugin-github#24 for the full
root-cause writeup and verification.
@pikann
pikann merged commit 87623b5 into master Aug 30, 2026
3 checks passed
@pikann
pikann deleted the fix/jsonbody-tinygo-collision branch August 30, 2026 16:52
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.

1 participant