Skip to content

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

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

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

This package had four locally-scoped type body struct{...} declarations sharing the same name across checklists.go (createChecklist, updateChecklist) and items.go (createItem, updateItem), with three distinct field shapes among them. Under TinyGo this risks json.Unmarshal silently decoding a request against the wrong struct's field layout.

Fix

Renamed all four to createChecklistBody / updateChecklistBody / createItemBody / updateItemBody — including the two that happened to share an identical shape already, since that safety was coincidental and fragile to a future edit.

Verification

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

🤖 Generated with Claude Code

pikann added 2 commits August 30, 2026 16:41
TinyGo's generic-function monomorphization keys plugin.JSONBody[T]
instantiations by T's bare type name rather than its full declaration
site. createChecklist/updateChecklist and createItem/updateItem each
declared their own `type body struct{...}` -- same name reused four
times in the package, with three distinct field shapes among them.
TinyGo could collapse these into one shared field layout, so
json.Unmarshal would silently decode some call sites against the
wrong struct.

Renamed all four to createChecklistBody / updateChecklistBody /
createItemBody / updateItemBody so every JSONBody[T] argument is
unique within the package -- including the two that happened to share
an identical shape already, since that safety was coincidental and
fragile to a future edit.

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 34dd3e8 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