Skip to content

pxf: reject null on a (pxf.required) or @required field (full and lite) #189

Open

Description

@bfrancojr

Rule. A field with (pxf.required) or @required holds a value. A decoder rejects it when it is absent and also when it is bound to null, whatever the field's type and presence. Decided by the owner on 2026-11-04, reversing protowire#339 option 3 on this one point. Spec: trendvidia/protowire#569. Reference: trendvidia/protowire-go#268.

Measured on main (c685ff0) with the spec's nulls fixtures plus controls:

  • Full tier (check-decode --format pxf-pb): r = null on optional int32 r [(pxf.required) = true] is accepted, and so is w = null on a required Int32Value. Both must be rejected. The controls behave (absent r rejected, r = 0 accepted).
  • Lite tier (RequiredPxfCodec.unmarshal, throwaway test in lite-fixtures): r = null is accepted. The lite fixtures have no RequiredWrapper, so the wrapper case was not run.
  • The generated NULLABLE_FIELDS table also changes: protowire#569 makes protoc-gen-pxf-java-meta leave required fields out of it.

Done when

  • Both tiers reject null on a required field in a body, a nested body and a @dataset cell, naming the field (the spec asserts null is not allowed on required field "<name>").
  • The vendored corpus picks up protowire#569's fixtures once it merges.

Activity

  1. bfrancojr commented on Nov 5, 2026

    @bfrancojr
    CollaboratorAuthor

    One more place this lands: LiteTablesTest runs nullFixtureIsAccepted("required-optional.pxf"). Built against a protoc-gen-pxf-java-meta from current protowire main, which drops required fields from NULLABLE_FIELDS (protowire#569), it fails with 1:5: null is not allowed on field "r": it has no unset state, or it is required. With the pinned plugin it passes. So the next pxfJavaMeta.ref bump breaks it unless this issue's fix lands first. The fixture is err-required-optional.pxf in the corpus now, so that test case should become a reject. Measured on main and on PR #192 with the same result, so it is not caused by #192.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions