Fix TinyGo JSONBody[T] type-name collision - #6
Merged
Conversation
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.
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]).createTimeLog,updateTimeLog, andupdateTimeLogGlobalinbackend/timelogs.goeach declared their own locally-scopedtype body struct{...}sharing the same name —createTimeLog's shape differed from the other two. Under TinyGo this risksjson.Unmarshalsilently 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 ./...andgo vet ./...pass.🤖 Generated with Claude Code