Skip to content

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

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

Fix TinyGo JSONBody[T] type-name collision#10
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]).

createHello and updateHello in backend/plugin.go each declared their own locally-scoped type body struct{...} with the same name but different fields. Under TinyGo this risks json.Unmarshal silently decoding one call site against the wrong struct's field layout.

Since this is the reference/example plugin other authors copy from, getting this pattern right here matters beyond just this repo.

Fix

Renamed both to createHelloBody / updateHelloBody.

Verification

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

🤖 Generated with Claude Code

pikann added 2 commits August 30, 2026 16:43
TinyGo's generic-function monomorphization keys plugin.JSONBody[T]
instantiations by T's bare type name rather than its full declaration
site. createHello and updateHello each declared their own
`type body struct{...}` with the same name but different fields --
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 createHelloBody / updateHelloBody.

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 88bf16e 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