Skip to content

test(services): round-trip generated protos through the wire codec - #1364

Merged
bmc08gt merged 1 commit into
code/cashfrom
test/proto-wire-format-coverage
Aug 28, 2026
Merged

test(services): round-trip generated protos through the wire codec#1364
bmc08gt merged 1 commit into
code/cashfrom
test/proto-wire-format-coverage

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Both generated proto artifacts — com.flipcash:flipcash2-client-protocol and
com.flipcash:ocp-client-protocol — arrive precompiled, built against the protobuf version their
own repos pin. The app resolves the protobuf runtime independently, from gradle/libs.versions.toml.
Nothing asserts the two agree: the RuntimeVersion gencode assertion that would catch the skew is
emitted 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 the
generated 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.

This adds a ProtoWireFormatTest to each module, five round-trips apiece, covering the paths such a
skew would break:

  • nested and repeated messages
  • enums
  • int64 at Long.MAX_VALUE, plus fixed-width float and double
  • non-ASCII strings
  • bytes across the full 0-255 range
  • map fields
  • oneofs, asserting the case survives
  • google.protobuf.Timestamp
  • unknown-field retention, by re-encoding through google.protobuf.Empty

Truncating the encoded bytes by three fails all ten tests, so none of them pass vacuously.

:services:flipcash and :services:opencode are both already in unitTestPaths, so
flipcashTestDebug picks these up with no build config change, and every future protobuf or
client-protocol bump runs them.

Split out of #1353 so the Dependabot
branch stays Dependabot-managed.

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.
@bmc08gt bmc08gt self-assigned this Aug 28, 2026
@github-actions github-actions Bot added area: network gRPC, connectivity, API, exchange rates type: test Test additions or improvements labels Aug 28, 2026
@bmc08gt
bmc08gt merged commit 5ab5111 into code/cash Aug 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: network gRPC, connectivity, API, exchange rates type: test Test additions or improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant