Skip to content

fix: honour declared packing and accept both repeated encodings - #11

Merged
kafkiansky merged 2 commits into
0.2.xfrom
fixes/repeated-packing
Sep 29, 2026
Merged

kafkiansky merged 2 commits into
0.2.xfrom
fixes/repeated-packing

Conversation

@kafkiansky

Copy link
Copy Markdown
Contributor

The reflection encoder dropped the packed flag of a repeated field, so a field declared packed: false was still written packed. It is now passed through to the wire.

The decoder chose between the packed and the unpacked form by the field's declaration. The protobuf spec requires parsers to accept both encodings of a packable repeated field whatever it is declared as, so the form is now taken from the wire type of the record: a length-delimited record of a packable element type is the packed form, anything else is one element. Strings, bytes and messages are unaffected.

OpenEnumTest no longer needs hand-written bytes for the unpacked case.

The reflection encoder dropped the `packed` flag of a repeated field, so a
field declared `packed: false` was still written packed. It is now passed
through to the wire.

The decoder chose between the packed and the unpacked form by the field's
declaration. The protobuf spec requires parsers to accept both encodings
of a packable repeated field whatever it is declared as, so the form is
now taken from the wire type of the record: a length-delimited record of
a packable element type is the packed form, anything else is one element.
Strings, bytes and messages are unaffected.

OpenEnumTest no longer needs hand-written bytes for the unpacked case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kafkiansky kafkiansky self-assigned this Sep 29, 2026
@kafkiansky kafkiansky added the bug Something isn't working label Sep 29, 2026
@kafkiansky
kafkiansky merged commit d305bf6 into 0.2.x Sep 29, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant