Skip to content

reflect: preserve closed enum unknowns#304

Open
fallintoplace wants to merge 1 commit into
anthropics:mainfrom
fallintoplace:agent/preserve-closed-enum-unknowns
Open

reflect: preserve closed enum unknowns#304
fallintoplace wants to merge 1 commit into
anthropics:mainfrom
fallintoplace:agent/preserve-closed-enum-unknowns

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

What this does

DynamicMessage now consults the linked enum descriptor before materializing binary enum values. Unknown values for closed proto2 and editions enums are routed to unknown fields instead of becoming Value::EnumNumber values. Open enums keep their existing behavior.

The handling covers singular fields, oneofs, extensions, unpacked repeated fields, packed repeated fields, and map values. Closed-enum map entries follow last-value-wins semantics: an entry whose final enum value is unknown is preserved as one length-delimited unknown field, while a later known value inserts the entry.

The reflection regression coverage also makes the runtime-pool behavior explicit when generated code has a field-level open-enum override but the linked enum remains closed.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
  • cargo check --workspace --all-features

@github-actions

Copy link
Copy Markdown

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

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.

1 participant