Skip to content

Draft API: generate and verify draft Go bindings - #343

Draft
stephanos wants to merge 27 commits into
api-next-stephanosfrom
api-next-stephanos-followup
Draft

stephanos wants to merge 27 commits into
api-next-stephanosfrom
api-next-stephanos-followup

Conversation

@stephanos

Copy link
Copy Markdown
Contributor

Generates draft omission helpers from the API manifest, verifies wire compatibility with stable bindings, and checks the draft module in CI.

Builds on #331.

  1. 984631e2 Advances the proto submodule to 3a1fbac and regenerates the bindings so Response.user moves from field 6 to 3 while Request.user stays at 7. The generated Go bindings must use the wire numbers assigned by the schema.
  2. f249395b Removes Go-side schema validation that the stable proto generator already performs and keeps the checks needed for valid Go output. Putting the schema rules in one validator avoids divergent acceptance rules.
  3. ea8eafee Reads the shared classification fixtures directly from the proto/api submodule. Both generators can use the same inputs and expected results from one source.
  4. 01b4d077 Extracts per-message and per-field helpers from the OmitDraftFields emitter. It gives later omission rules a clear place to go and makes the generated behavior easier to review.
  5. f66d6cc2 Pins the expanded draft schema at b7e48eb and records explicit annotations on all seven supported placements. The Go generator needs to agree with the stable proto generator on which declarations are draft and which feature gates them.
  6. bfd4bb06 Uses payload-preview for the draft payload message and the fields that reference it. The draft schema requires each reference to use the same feature as its draft type.
  7. 4541031c Uses the nearest annotated container for omission and regenerates the Go helper fixtures. Omission needs to follow the API's single-feature inheritance rules, including oneof membership.
  8. fa40eae8 Generates omission for disabled draft enum values in singular fields and oneofs. A stable field can carry a draft enum value even when the field itself stays visible.
  9. 369caecf Checks every stable message type with empty and populated payloads and tests each declared draft gate with deterministic inputs. Stable consumers must be able to decode draft bindings with all gates off, and each gated field or enum value must honor its own feature gate.
  10. c4f319f8 Generates Nexus annotation aliases from the pinned upstream Go binding. Both modules need to share the same registered descriptors.
  11. 17baf2d0 Checks omission coverage and stable declaration sets against descriptors. An omitted generator method or extra stable declaration should fail the contract test.
  12. e98defb9 Disables each declared feature in turn and checks the result and a second omission against the descriptor-based projection. Omission must consult the correct feature gate and leave a filtered message unchanged on subsequent calls.
  13. 24558d2f Regenerates draft Go comments with the CI toolchain. The checked-in snapshot must reproduce under the versions CI uses.
  14. aec6569e Moves pinned Go plugin installation into make api-next-tools. Generation workflows can share the same plugin versions.
  15. 832b5c1c Checks the entire regenerated draft snapshot for tracked and untracked drift. Checking only selected outputs can miss stale bindings that the server consumes.
  16. 84d24e3c Adds a workflow input to select an upstream proto branch. The team can generate bindings for schema changes before those changes land.
  17. 07edb940 Runs draft regeneration and tests only when both upstream draft inputs exist. Stable-only schema revisions still need a working CI and update path.
  18. e952559c Documents generating, pinning, and consuming the nested api_next module. Callers need to select the draft module while keeping ordinary Go import paths.
  19. 1055e35c Checks field presence before asking whether a draft feature is enabled and tests the callback behavior. Callers can use the predicate to detect whether omission would change the message.
  20. 4e4074d9 Creates a file's draft output lazily on first use. Other draft helpers can share that output even when a file needs no omission methods.
  21. 1ab591c8 Generates a service lookup for RPC gates and request and response omission support. The server can gate and filter calls without walking descriptors on each dispatch.
  22. 1c764319 Generates a lookup of message types with omission support. The server can identify which typed error details need decoding.
  23. 6c20f69b Pins the proto submodule to the rewritten API head 34991b41. The submodule then follows the API draft PR after the fuzz test removal.
  24. a55f1aaf Builds the draft snapshot from explicit inputs and runs the root proxy generator against it. This removes duplicate build tooling and repository metadata while retaining the commands Temporal consumes.
  25. 0f1527c3 Consumes the resolved draft manifest from the pinned API submodule when generating Go omission helpers. The Go generator can use the API generator's feature gates and validation without repeating schema rules.
  26. 95170d37 Clears gated collections as whole fields and regenerates the draft bindings from manifest version 2. The API schema rule guarantees retained lists and maps need no per-entry filtering.
  27. aff7973f Groups test setup, descriptor traversal, and wire assertions with blank lines. The test phases are easier to scan during review.

stephanos and others added 27 commits November 24, 2026 19:28
What
Advances the proto submodule to [`3a1fbac`](temporalio/api@3a1fbac) and regenerates the bindings so `Response.user` moves from field 6 to 3 while `Request.user` stays at 7.

Why
The generated Go bindings must use the wire numbers assigned by the schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ator

What
Removes Go-side schema validation that the stable proto generator already performs and keeps the checks needed for valid Go output.

Why
Putting the schema rules in one validator avoids divergent acceptance rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Reads the shared classification fixtures directly from the `proto/api` submodule.

Why
Both generators can use the same inputs and expected results from one source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Extracts per-message and per-field helpers from the `OmitDraftFields` emitter.

Why
It gives later omission rules a clear place to go and makes the generated behavior easier to review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Pins the expanded draft schema at [`b7e48eb`](temporalio/api@b7e48eb) and records explicit annotations on all seven supported placements.

Why
The Go generator needs to agree with the stable proto generator on which declarations are draft and which feature gates them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Uses payload-preview for the draft payload message and the fields that reference it.

Why
The draft schema requires each reference to use the same feature as its draft type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Uses the nearest annotated container for omission and regenerates the Go helper fixtures.

Why
Omission needs to follow the API's single-feature inheritance rules, including oneof membership.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Generates omission for disabled draft enum values in singular fields and oneofs.

Why
A stable field can carry a draft enum value even when the field itself stays visible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Checks every stable message type with empty and populated payloads and tests each declared draft gate with deterministic inputs.

Why
Stable consumers must be able to decode draft bindings with all gates off, and each gated field or enum value must honor its own feature gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Generates Nexus annotation aliases from the pinned upstream Go binding.

Why
Both modules need to share the same registered descriptors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Checks omission coverage and stable declaration sets against descriptors.

Why
An omitted generator method or extra stable declaration should fail the contract test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Disables each declared feature in turn and checks the result and a second omission against the descriptor-based projection.

Why
Omission must consult the correct feature gate and leave a filtered message unchanged on subsequent calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Regenerates draft Go comments with the CI toolchain.

Why
The checked-in snapshot must reproduce under the versions CI uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Moves pinned Go plugin installation into `make api-next-tools`.

Why
Generation workflows can share the same plugin versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Checks the entire regenerated draft snapshot for tracked and untracked drift.

Why
Checking only selected outputs can miss stale bindings that the server consumes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Adds a workflow input to select an upstream proto branch.

Why
The team can generate bindings for schema changes before those changes land.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Runs draft regeneration and tests only when both upstream draft inputs exist.

Why
Stable-only schema revisions still need a working CI and update path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Documents generating, pinning, and consuming the nested `api_next` module.

Why
Callers need to select the draft module while keeping ordinary Go import paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Checks field presence before asking whether a draft feature is enabled and tests the callback behavior.

Why
Callers can use the predicate to detect whether omission would change the message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Creates a file's draft output lazily on first use.

Why
Other draft helpers can share that output even when a file needs no omission methods.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Generates a service lookup for RPC gates and request and response omission support.

Why
The server can gate and filter calls without walking descriptors on each dispatch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…elds

What
Generates a lookup of message types with omission support.

Why
The server can identify which typed error details need decoding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Pins the proto submodule to the rewritten API head [`34991b41`](temporalio/api@34991b4).

Why
The submodule then follows the API draft PR after the fuzz test removal.
What
Builds the draft snapshot from explicit inputs and runs the root proxy generator against it.

Why
This removes duplicate build tooling and repository metadata while retaining the commands Temporal consumes.
What
Consumes the resolved draft manifest from the pinned API submodule when generating Go omission helpers.

Why
The Go generator can use the API generator's feature gates and validation without repeating schema rules.
What
Clears gated collections as whole fields and regenerates the draft bindings from manifest version 2.

Why
The API schema rule guarantees retained lists and maps need no per-entry filtering.
What
Groups test setup, descriptor traversal, and wire assertions with blank lines.

Why
The test phases are easier to scan during review.
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