Skip to content

decode: retain incompatible wire types as unknown fields - #732

Open
vladislav-miroshnikov wants to merge 1 commit into
anthropics:mainfrom
vladislav-miroshnikov:vmiroshnikov/buffa-717
Open

vladislav-miroshnikov wants to merge 1 commit into
anthropics:mainfrom
vladislav-miroshnikov:vmiroshnikov/buffa-717

Conversation

@vladislav-miroshnikov

Copy link
Copy Markdown

When a known field shows up with an incompatible wire type, generated decoding currently fails. DynamicMessage already treats such records as unknown fields, and this makes generated code do the same. A well-formed record goes through the unknown-field path and is kept or dropped depending on the message config. An earlier value of a singular or oneof field is kept, and malformed input still errors.

This covers owned, eager, lazy and table decoding. Most of the diff is regenerated checked-in code.

I left key/value records inside map entries alone, so they keep the strict checks from #387.

Regression tests cover kept values, defaults, unknown fields, packed and unpacked input, and malformed records. Lint, tests, arbitrary and docs pass on Linux.

Fixes #717.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vladislav-miroshnikov

Copy link
Copy Markdown
Author

recheck

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

decode: keep a known field that arrives under the wrong wire type as an unknown field

1 participant