Fix TinyGo JSONBody[T] type-name collision - #12
Merged
Conversation
TinyGo's generic-function monomorphization keys plugin.JSONBody[T]
instantiations by T's bare type name rather than its full declaration
site. createWebhook and updateWebhook 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 createWebhookBody / updateWebhookBody.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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]).createWebhookandupdateWebhookinbackend/webhooks.goeach declared their own locally-scopedtype body struct{...}with the same name but different fields. Under TinyGo this risksjson.Unmarshalsilently decoding one call site against the wrong struct's field layout.Fix
Renamed both to
createWebhookBody/updateWebhookBody.Verification
go test ./...andgo vet ./...pass.🤖 Generated with Claude Code