Repository navigation
Show diffs in the release build again - #190
Merged
Merged
Conversation
DiffOp took its JSON names from @JSON on the enum constants. Moshi reads those by reflection, and R8 drops them in the release build, so every diff of the history and of the changes since the last visit failed with "Something went wrong". The sign is now kept as text and parsed by the generated adapter. A test keeps enums with @JSON names out of the API models. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Markus saw "Something went wrong. Please try again." when he opened a history entry in release-737. It wasn't specific to agent commits: every diff failed in release builds. Debug builds worked.
Root cause:
DiffOptook its JSON names (" ","-","+") from@Jsonon the enum constants. Moshi's codegen makes no enum adapters, so the reflective enum adapter reads those annotations at runtime. R8 drops them (the release dex has no field annotations onDiffOp), so Moshi expected"CONTEXT"and threw on" ".userMessage()maps a parse error on a 200 response to the generic text. This affected the history diff and the hunks of "changed since your last visit".Fix:
DiffLineModelkeeps the sign as text (@Json(name = "op") val sign: String), which the generated adapter parses without reflection.opis computed from the sign, and an unknown sign shows as unchanged.DiffOpstays for the callers.Test:
EnumJsonNamesTestfails if an enum in the REST models takes JSON names from annotations again. It fails without the fix.Verified:
🤖 Generated with Claude Code