Repository navigation
pxf-android: print nothing for a plain field whose wire value is zero - #182
Merged
Merged
Conversation
LiteWireReader read every known field with its kind's reader, whatever wire type the tag carried. A mistyped field was then misread and the rest of the message with it: 3a050d01000000, an Int64Value whose field 1 arrives as fixed32, failed with 'invalid tag (zero)' where protowire-go and the full tier print i64_w = 0. The field is now skipped as unknown, in a message, a map entry and every well-known payload. A repeated packable field still takes either the packed or the unpacked record.
A map entry that lacks its key or its value, because the encoder left it out or because the reader now skips it as mistyped (#160), came back as the string "": by_int = { "": "x" } where protobuf-go prints { 0: "x" }, and stamps = { a: "" } where it prints the epoch. The missing field is now read from a zero encoding of its kind, so an integer key is 0, a bool key false, a message value empty and a well-known value its zero literal.
…mistyped fields (#160) 62 wire messages against text.proto, each with protowire-go's pb-text output for it: every wire type arriving on a field of another kind, in a message, a repeated field, a map entry and each well-known payload, plus packed and unpacked repeated records and map entries missing a key or a value. On main's reader 58 of the 63 tests fail.
LiteWireReader turns each record it reads into text, so a plain proto3 field written as zero on the wire printed, where protowire-go and the full tier, which read the bytes into a message first, print nothing (#180). A singular field in implicitPresenceFields() whose last value is its zero value is now dropped; -0.0, optional fields and map entries keep theirs.
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.
Fixes #180
When the lite tier reads PB bytes into text, it now prints nothing for a plain proto3 field whose wire value is zero, as protowire-go and the full tier do. For example,
2800used to printf_int32 = 0and now prints nothing.Stacked on #181 (same file,
LiteWireReader). The base is #181's branch, so the diff shows this change alone. Merge #181 first, and GitHub moves this PR onto main.What changes
PxfMeta.implicitPresenceFields()(the table pxf: write protowire-go's bytes from PXF text, and run the write gate in CI #172 added) whose last value on the wire is its zero value is left out.2807 2800prints nothing), as Go does.-0.0,optionalfields, and map entries' key and value.Evidence
check_decode --format pb-text): the 7 plain-zero rows,-0.0, two last-wins orders, a nested and a list-element message, andoptionaland map-entry controls.ImplicitZeroLiteTest: 13 tests, each expected text copied from Go's output. All pass../gradlew buildwith the plugin fetched at main's pin: 793 tests, 0 failures, 0 skipped.