Fix Go RPC round-trip issues for Print path and delta encoding#7372
Merged
jkschneider merged 3 commits intomainfrom Apr 14, 2026
Merged
Fix Go RPC round-trip issues for Print path and delta encoding#7372jkschneider merged 3 commits intomainfrom
jkschneider merged 3 commits intomainfrom
Conversation
5 fixes for Go→Java→Go round-trip issues that caused recipe results to fail during the Print step: 1. receiveReturn: store received expression in Return.Expressions instead of discarding it. Fixes `return x` printing as `return`. 2. receiveIf/sendIf: cache ControlParentheses wrapper in If.ConditionCP for stable delta encoding. Previously the synthetic CP was recreated with new UUIDs each send, and the receiver passed nil as "before", so NO_CHANGE returned nil and the condition was lost. 3. rightPaddedFromElement: prefer Expression over Statement for dual-interface types (like MethodInvocation). Most containers are expression containers; block bodies use coerceToStatementRP. 4. GetObject.forceFullSend: when Go has no baseline for a tree ID, request a full ADD send from Java to avoid delta mismatches between Go's original tree and Java's reconstructed version. 5. StructTag: send tag as valueSource string instead of raw J.Literal that doesn't survive Objenesis round-trip.
27c8749 to
e2f7e39
Compare
Parses actual Go files from 9 popular open-source repos (gorilla/mux, spf13/cobra, sirupsen/logrus, go-chi/chi, gorilla/websocket, gin-gonic/gin, spf13/viper, stretchr/testify, uber-go/zap) and verifies both parse success and print round-trip fidelity. Also removes the forceFullSend protocol hack from GetObject — the field-level fixes (ConditionCP caching, Return expression storage, StructTag serialization) make delta encoding work correctly without needing to bypass it.
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
5 fixes for Go→Java→Go round-trip issues that caused recipe results to fail during the Print step (reverse GetObject). These complement the work merged in Go: load recipe modules as plugins for real execution #7263.
receiveReturn: store received expression in
Return.Expressionsinstead of discarding it — fixesreturn xprinting asreturnreceiveIf/sendIf: cache
ControlParentheseswrapper inIf.ConditionCPfor stable delta encoding — fixes condition loss on NO_CHANGE round-tripsrightPaddedFromElement: prefer
ExpressionoverStatementfor dual-interface types likeMethodInvocationGetObject.forceFullSend: when Go has no baseline for a tree ID, request a full ADD send from Java to avoid delta mismatches
StructTag: send tag as
valueSourcestring instead of rawJ.Literalthat doesn't survive Objenesis round-tripTest plan
mod buildon 15 popular Go repos: zero RPC crashesmod runrecipes: zero Print-path errors