Skip to content

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

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

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

createTimeLog, updateTimeLog, and updateTimeLogGlobal in backend/timelogs.go each declared their own locally-scoped type body struct{...} sharing the same name — createTimeLog's shape differed from the other two. Under TinyGo this risks json.Unmarshal silently decoding at least one call site against the wrong struct's field layout.

Fix

Renamed all three to createTimeLogBody / updateTimeLogBody / updateTimeLogGlobalBody — 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:43
TinyGo's generic-function monomorphization keys plugin.JSONBody[T]
instantiations by T's bare type name rather than its full declaration
site. createTimeLog, updateTimeLog, and updateTimeLogGlobal each
declared their own `type body struct{...}` sharing the same name --
createTimeLog's shape differed from the other two, risking TinyGo
collapsing all three into one shared field layout under the wrong
struct for at least one call site.

Renamed all three to createTimeLogBody / updateTimeLogBody /
updateTimeLogGlobalBody 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 659e028 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