Fix TinyGo JSONBody[T] type-name collision - #16
Merged
Conversation
TinyGo's generic-function monomorphization keys plugin.JSONBody[T]
instantiations by T's bare type name rather than its full declaration
site. createScenario and updateScenario each declared their own
`type body struct{...}` with the same name but different fields
(string vs *string) -- TinyGo collapsed them into one shared field
layout, so json.Unmarshal could decode against the wrong struct
(differing field sizes here, not just differing field counts).
Renamed both to createScenarioBody / updateScenarioBody.
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]).createScenarioandupdateScenarioinbackend/scenarios.goeach declared their own locally-scopedtype body struct{...}with the same name but different field types (stringvs*string, for create vs partial-update semantics). Under TinyGo this is exactly the collision pattern:json.Unmarshalcould silently decode a request against the wrong struct's field layout — worse here than a simple zeroing, sincestringand*stringhave different in-memory sizes.Fix
Renamed both to
createScenarioBody/updateScenarioBody.Verification
go test ./...andgo vet ./...pass.🤖 Generated with Claude Code