Skip to content

fix(cel): read protobuf defaults for unset message fields - #47

Merged
jrandolf merged 1 commit into
mainfrom
fix/cel-protobuf-defaults
Sep 4, 2026
Merged

fix(cel): read protobuf defaults for unset message fields#47
jrandolf merged 1 commit into
mainfrom
fix/cel-protobuf-defaults

Conversation

@jrandolf

@jrandolf jrandolf commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

CEL field reads must match protobuf defaults: an unset Timestamp reads as Unix epoch, an unset Duration reads as zero, and an unset nested message exposes its default instance. Presence remains false for has(). The previous as_option()? emission skipped entire rules, incorrectly accepting unguarded comparisons.

Use Buffa's default-instance dereference for message field selection and remove the skip-on-unset closures. Keep the existing presence guard for rules attached to an absent field, matching upstream Protovalidate.

Follow-up to #45 and discussion #44, originally reported by @LuKev. The release remains paused until this correction is included.

Validated expected semantics directly against protovalidate-go commit 573e8070aa030baf4d4f574293364b998a133a52 using the same protobuf descriptors. Three new regressions fail before the correction and pass afterward, covering owned messages and borrowed views. All 185 workspace tests pass.

The workspace build and Clippy with all features and warnings denied pass. The official protovalidate-conformance v1.2.2 harness reports PASS (failed: 0, skipped: 0, passed: 2872, total: 2872).

@jrandolf
jrandolf enabled auto-merge (squash) September 4, 2026 23:34
@jrandolf
jrandolf merged commit 32742d4 into main Sep 4, 2026
8 checks passed
@jrandolf
jrandolf deleted the fix/cel-protobuf-defaults branch September 4, 2026 23:38
@jrandolf jrandolf mentioned this pull request Sep 4, 2026
jrandolf added a commit that referenced this pull request Sep 4, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>protoc-gen-protovalidate-buffa: 0.7.2</summary>

##
[0.7.2](protoc-gen-protovalidate-buffa-v0.7.1...protoc-gen-protovalidate-buffa-v0.7.2)
(2026-09-04)


### Bug Fixes

* **cel:** Preserve timestamp and duration values across bindings
([#45](#45))
([94037da](94037da))
* **cel:** Read protobuf defaults for unset message fields
([#47](#47))
([32742d4](32742d4))
</details>

<details><summary>0.7.1</summary>

##
[0.7.1](v0.7.0...v0.7.1)
(2026-09-04)


### Bug Fixes

* **cel:** Preserve timestamp and duration values across bindings
([#45](#45))
([94037da](94037da))
</details>

<details><summary>protovalidate-buffa-conformance: 0.0.15</summary>

### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * protovalidate-buffa bumped from 0.7.0 to 0.7.1
  * build-dependencies
    * protoc-gen-protovalidate-buffa bumped from 0.7.1 to 0.7.2
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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