test(services): round-trip generated protos through the wire codec - #1364
Merged
Conversation
The generated classes arrive precompiled in `com.flipcash:flipcash2-client-protocol` and `com.flipcash:ocp-client-protocol`, built against the protobuf version those repos pin, while the app resolves the protobuf runtime from its own version catalog. Nothing asserts the two agree — the `RuntimeVersion` check that guards full gencode is not emitted for lite. The existing suite builds proto messages and reads fields back, which exercises the accessors but never the encoder or the parser. There is no `parseFrom` anywhere under `services/*/src/test`, so a codec regression from a runtime/gencode skew would pass unnoticed. Each module gets five round-trips covering the paths such a skew would break: nested and repeated messages, enums, varints at their boundaries, fixed-width floats and doubles, non-ASCII strings, bytes across the full 0-255 range, maps, oneofs, well-known types, and unknown-field retention. Truncating the encoded bytes fails all ten, so they are not passing vacuously. `:services:flipcash` and `:services:opencode` are both in `unitTestPaths`, so `flipcashTestDebug` already picks these up and every future protobuf or client-protocol bump runs them.
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.
Both generated proto artifacts —
com.flipcash:flipcash2-client-protocolandcom.flipcash:ocp-client-protocol— arrive precompiled, built against the protobuf version theirown repos pin. The app resolves the protobuf runtime independently, from
gradle/libs.versions.toml.Nothing asserts the two agree: the
RuntimeVersiongencode assertion that would catch the skew isemitted for full protobuf-java gencode and not for lite, and none of the 1455 generated classes in
these artifacts reference it.
The existing tests in
services/build proto messages and read fields back, which exercises thegenerated accessors but never the encoder or the parser. There is no
parseFromanywhere underservices/*/src/test, so a codec regression from a runtime/gencode skew would pass unnoticed.This adds a
ProtoWireFormatTestto each module, five round-trips apiece, covering the paths such askew would break:
int64atLong.MAX_VALUE, plus fixed-widthfloatanddoublegoogle.protobuf.Timestampgoogle.protobuf.EmptyTruncating the encoded bytes by three fails all ten tests, so none of them pass vacuously.
:services:flipcashand:services:opencodeare both already inunitTestPaths, soflipcashTestDebugpicks these up with no build config change, and every future protobuf orclient-protocol bump runs them.
Split out of #1353 so the Dependabot
branch stays Dependabot-managed.