Skip to content

feat: unrecognized enum values null/default bug#738

Merged
anthony-swirldslabs merged 1 commit intomainfrom
737-nullEnumDefault
Feb 4, 2026
Merged

feat: unrecognized enum values null/default bug#738
anthony-swirldslabs merged 1 commit intomainfrom
737-nullEnumDefault

Conversation

@anthony-swirldslabs
Copy link
Copy Markdown
Contributor

Description:
The PR fixes a bug in the current enum implementation (after support for UNRECOGNIZED values was added) that causes PBJ to return UNRECOGNIZED instead of the "default" value as the protobuf spec prescribes.

Also, marking it as feat: to make a new minor release because I realized that the UNRECOGNIZED enum feature is a major API change because it adds an extra constant to every enum and sometimes requires modifying the client code (e.g. adding a case to a switch.)

Related issue(s):

Fixes #737

Notes for reviewer:
All tests, including the newly added one for this bug, should pass.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Anthony Petrov <anthony@swirldslabs.com>
@anthony-swirldslabs anthony-swirldslabs self-assigned this Feb 4, 2026
@anthony-swirldslabs anthony-swirldslabs requested review from a team as code owners February 4, 2026 23:11
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 4, 2026

JUnit Test Report

   78 files  ±0     78 suites  ±0   3m 23s ⏱️ -6s
1 352 tests ±0  1 348 ✅ ±0   4 💤 ±0  0 ❌ ±0 
7 229 runs  ±0  7 209 ✅ ±0  20 💤 ±0  0 ❌ ±0 

Results for commit dd3cde9. ± Comparison against base commit b8a49b0.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 4, 2026

Integration Test Report

    415 files  ±0      415 suites  ±0   15m 28s ⏱️ - 2m 34s
114 888 tests +1  114 888 ✅ +1  0 💤 ±0  0 ❌ ±0 
115 129 runs  +1  115 129 ✅ +1  0 💤 ±0  0 ❌ ±0 

Results for commit dd3cde9. ± Comparison against base commit b8a49b0.

This pull request removes 3 and adds 4 tests. Note that renamed tests count towards both.
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000075f7b0c0ace8@72afb537
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000075f7b0c0af18@3ed95c11
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000075f7b0c0b148@3fc4ecb7
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [1] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000073026bc43650@2140dc77
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [2] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000073026bc43880@6e22f1f7
com.hedera.pbj.integration.test.ParserNeverWrapsTest ‑ [3] com.hedera.pbj.integration.test.ParserNeverWrapsTest$$Lambda/0x000073026bc43ab0@2f5dae5
com.hedera.pbj.integration.test.UnrecognizedEnumTest ‑ testDefaultValue()

@anthony-swirldslabs anthony-swirldslabs merged commit c01e04e into main Feb 4, 2026
15 checks passed
@anthony-swirldslabs anthony-swirldslabs deleted the 737-nullEnumDefault branch February 4, 2026 23:20
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.

Uninitialized enum should return protoOrdinal 0

3 participants