Skip to content

Draft API: simplify stable proto generation and tests - #912

Open
stephanos wants to merge 18 commits into
api-nextfrom
api-next-stephanos
Open

stephanos wants to merge 18 commits into
api-nextfrom
api-next-stephanos

Conversation

@stephanos

@stephanos stephanos commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Small refactors, fixture cleanup, and build safeguards for draft-to-stable proto generation.

The remaining draft API changes are in #921.

  1. e89b89d7 Marks the stable proto tree as generated in GitHub. This collapses regenerated diffs so reviewers can focus on source changes.
  2. ed9a2a9e Makes stable-tree readers wait for the stable-api target. Parallel builds can then lint and compile the freshly projected schemas.
  3. 2f347111 Moves the demo response user field to tag 3 and clarifies both demo comments. The draft response can use its next available tag without changing the stable schema.
  4. 33f185a4 Documents where to edit, annotate, and regenerate the schemas. Contributors need to know which tree owns the source.
  5. f93b9502 Passes the caller's context into the projection generator. Tests and callers can now control cancellation.
  6. 7bc8f17d Puts each draft option extendee on its own line. Each supported placement is easier to review in a diff.
  7. 1d19a9ec Extracts loading and validation from draft stripping. Tests can validate source schemas without generating output.
  8. dd7bd5ca Rephrases generator comments as full sentences and uses declaration names in Go doc comments. Consistent comment style makes the generator easier to read.
  9. 5d0850dc Removes stale opener caller names and documents file indexing and the legacy formatter. The comments should explain the current implementation and its constraints.
  10. 75d047ff Returns sorted paths from stripDrafts for import organization and comment validation. Both passes process the same files, so the generator only needs to sort them once.
  11. 088ad8b7 Renames jErr to errs in output verification. The new name identifies the accumulated errors.
  12. 06e19078 Runs isolated generator tests and subtests in parallel. Their temporary directories allow concurrent execution.
  13. 1b691f3d Compares accepted annotations with each fixture's expected classification. The tests can now catch a declaration classified under the wrong feature.
  14. ee227281 Consolidates fixture validation, output, and golden checks in TestFixtures. Every fixture runs through the same assertions.
  15. 5af8d3e3 Installs protoc in the stable-generation CI job. The descriptor oracle and compatibility tests invoke protoc.
  16. 90633b1b Extracts token-level comment splitting from commentWords. Import pruning can reuse the same tokenization.
  17. 19e603fb Preserves the original quote style when rewriting imports. Changing the quotes can change import order on the next generation pass.
  18. 5504bbcc Documents the separate proto trees and checks that each Buf module excludes the other. Compiling both trees together produces duplicate declarations.

@stephanos
stephanos force-pushed the api-next-stephanos branch 4 times, most recently from c698c02 to 29b45c5 Compare November 20, 2026 15:12
@stephanos stephanos changed the title generate-stable-protos: assert classified draft annotations generate-stable-protos: assert draft annotations, plus small cleanups Nov 20, 2026
@stephanos
stephanos force-pushed the api-next-stephanos branch 2 times, most recently from d1f7fcb to 463aa28 Compare November 20, 2026 16:16
@stephanos
stephanos added this pull request to stack #917 November 21, 2026 01:51
stephanos and others added 18 commits November 21, 2026 09:22
What
Marks the generated `temporal/api/` tree as generated in `.gitattributes`.

Why
GitHub collapses the generated diffs so reviewers can focus on changes to the source schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Adds `stable-api` as an order-only prerequisite for targets that read `temporal/api/`.

Why
Parallel builds need the generated schema to be ready before linting, checking compatibility, or generating downstream artifacts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Moves the draft `Response.user` field to tag 3 and clarifies the comments on both draft user fields.

Why
The examples need usable tags and a clear description of the user who triggered the update before any draft bindings are published.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Documents where to edit the source schema, how to regenerate the stable tree, and what the draft annotations do.

Why
Contributors need a valid path and regeneration workflow when changing the protobuf schema.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Passes a caller-supplied context into `stableProtosGenerator`.

Why
Tests and other callers can control the lifetime of generator work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Lists each draft option on its own line in the extendee table.

Why
Adding or removing an option becomes a one-line diff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Extracts schema loading and annotation validation into `loadAPINext`.

Why
Tests can load and validate a tree without generating stable files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Rephrases generator comments as full sentences and uses declaration names in Go doc comments.

Why
Consistent comment style makes the generator easier to read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Removes stale opener caller names and documents file indexing and the legacy formatter.

Why
The comments should explain the current implementation and its constraints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Derives sorted paths from the projected proto map in stripDrafts and reuses that order for import organization and comment validation.

Why
Both passes process the same files, so the generator can sort them once and give callers the complete order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Renames the verification error slice from `jErr` to `errs`.

Why
The name reflects that the slice holds individual errors until they are joined.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Runs generator tests and subtests in parallel.

Why
The tests use independent temporary directories, so they can run concurrently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Collects accepted draft annotations and compares their declarations and feature names against the fixtures.

Why
A validator can accept valid input while still classifying a declaration under the wrong feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Runs projection, classification, and rejection fixtures through one test runner.

Why
Every fixture gets the same checks for expected annotations, deterministic output, and failure behavior.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Installs `protoc` in the stable generator CI job using the same setup action as the main CI job.

Why
The descriptor oracle and breaking-change tests compile protos with `protoc`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Extracts comment token normalization into `commentTokenWords`.

Why
Import pruning can reuse the same word parsing when it matches source comments to imports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Preserves the original quote style when rewriting temporal import paths.

Why
The printer sorts by the raw import token, so preserving quotes keeps repeated generation from changing import order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
Documents compiling one schema tree at a time and checks that each Buf module lists only its own tree.

Why
The stable and draft trees share protobuf package names, so compiling both produces duplicate symbols.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@stephanos
stephanos force-pushed the api-next-stephanos branch 2 times, most recently from b7e48eb to 34991b4 Compare November 23, 2026 15:42
@stephanos
stephanos force-pushed the api-next-stephanos branch 10 times, most recently from 4a0a814 to 7c79b3d Compare November 24, 2026 19:30
@stephanos stephanos changed the title generate-stable-protos: assert draft annotations, plus small cleanups Draft API: prepare stable schema generation Nov 24, 2026
@stephanos
stephanos marked this pull request as ready for review November 24, 2026 20:56
@stephanos
stephanos requested review from a team November 24, 2026 20:56
@stephanos stephanos changed the title Draft API: prepare stable schema generation Draft API: simplify stable proto generation and tests Nov 24, 2026
@stephanos
stephanos requested a review from mavemuri November 24, 2026 20:56
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