Purpose: Cross-generator consistency cannot be verified if each generator tests against different proto definitions. The httpgen test protos are the canonical source; clientgen and tsclientgen already symlink to them. OpenAPI has independent protos that must be replaced with symlinks. The exhaustive test proto must also be expanded to include missing coverage (int64/uint64 query params, enums in messages, optional fields, all unwrap variants) so the audit in subsequent plans has a complete basis for comparison. Per user decision "Fix everything immediately", any generator bugs exposed by the expanded proto are fixed in this plan, not deferred.
Output: Shared test proto infrastructure with symlinks, expanded exhaustive proto, updated golden tests, and any generator bugfixes needed to make expanded coverage pass.
<execution_context> @/Users/sebastienmelki/.claude/get-shit-done/workflows/execute-plan.md @/Users/sebastienmelki/.claude/get-shit-done/templates/summary.md </execution_context>
- int64/uint64 query params -- Add fields with
int64,uint64types annotated with(sebuf.http.query)to test 64-bit query parameter handling. Add these to theListResourcesRequestmessage (or create a new RPC with a request that has int64/uint64 query params). - float/double query params -- Add
floatanddoublequery param fields. - Enum fields in messages -- Add an enum type (e.g.,
ResourceStatus) and use it as a field in request/response messages. The Resource message should have a status enum field. - Optional fields -- Add
optional stringandoptional int32fields to at least one message (e.g., addoptional string descriptiontoGetResourceRequestor an optional field onResource). - Nested messages -- The Resource message already has maps but add a nested message field (e.g.,
ResourceMetadata metadata_objwith sub-fields likecreated_by,version). - Repeated message fields -- Already has
repeated Resourcein ListResourcesResponse. Verify that's sufficient. Add repeated enum if missing.
Keep all existing messages and RPCs unchanged to avoid breaking existing golden files unnecessarily. ADD new fields/messages/RPCs for the missing coverage. Specifically:
- Add
ResourceStatusenum with values:RESOURCE_STATUS_UNSPECIFIED,RESOURCE_STATUS_ACTIVE,RESOURCE_STATUS_INACTIVE,RESOURCE_STATUS_ARCHIVED - Add
ResourceMetadatamessage with fields:string created_by,int64 created_at_unix,int32 version - Add
status(ResourceStatus) andmetadata_detail(ResourceMetadata) fields to theResourcemessage (use field numbers 7 and 8) - Add
optional string tagfield toResource(field number 9) - Add int64/uint64/float/double query params to
ListResourcesRequest(field numbers 5-8):int64 since_timestamp,uint64 max_id,float min_score,double max_score-- all with(sebuf.http.query)annotations - Add a new RPC
SearchResources(SearchResourcesRequest) returns (ListResourcesResponse)with GET method and path/resources/searchthat uses a request with aResourceStatus status_filterquery param (field number 1, query name "status") plusstring query(field number 2, query name "q")
Do NOT change existing field numbers, message names, or RPC signatures. Only ADD new items.
CRITICAL: Fix-immediately policy. After expanding the proto, run ALL 4 generators' tests (not just httpgen). If the expanded proto reveals generator bugs (e.g., a generator crashes on int64 query params, fails to handle enum fields, or produces incorrect code for optional fields), you MUST fix those generator bugs immediately in this plan. Do not leave broken tests for later plans. The user decision is "Fix everything immediately: Every inconsistency found gets fixed in this phase." If fixes touch generator source files (generator.go, types.go, etc.), that is expected and acceptable. Document what was found and fixed.
go build ./... to verify proto imports are valid. Then run ALL 4 generators' tests:
UPDATE_GOLDEN=1 go test ./internal/httpgen/ -run TestExhaustiveGoldenFiles -count=1to update httpgen golden files.go test ./internal/httpgen/ -count=1to confirm httpgen passes.UPDATE_GOLDEN=1 go test ./internal/clientgen/ -count=1thengo test ./internal/clientgen/ -count=1UPDATE_GOLDEN=1 go test ./internal/tsclientgen/ -count=1thengo test ./internal/tsclientgen/ -count=1UPDATE_GOLDEN=1 go test ./internal/openapiv3/ -count=1thengo test ./internal/openapiv3/ -count=1
If any test fails with a compilation error or generator crash (not just golden file mismatch), fix the underlying generator bug before proceeding. After fixing, re-run the full test suite. All 4 generators must produce valid output for the expanded proto.
-
Create symlinks in
internal/openapiv3/testdata/proto/pointing to the canonical httpgen test protos. Create these symlinks (using the same relative path pattern as clientgen/tsclientgen):http_verbs_comprehensive.proto -> ../../../httpgen/testdata/proto/http_verbs_comprehensive.protoquery_params.proto -> ../../../httpgen/testdata/proto/query_params.protobackward_compat.proto -> ../../../httpgen/testdata/proto/backward_compat.protounwrap.proto -> ../../../httpgen/testdata/proto/unwrap.proto
Note: The OpenAPI testdata already has its own
unwrap.protoand other protos. Do NOT delete the existing OpenAPI-specific protos -- they test OpenAPI-specific features that the shared protos don't cover (likeheaders.proto,validation_constraints.proto). But DO replaceunwrap.protowith a symlink since the httpgen version is more comprehensive (has root-level unwrap variants). -
Update the OpenAPI golden test (
exhaustive_golden_test.go) to ALSO run against the newly symlinked shared protos. The test should generate OpenAPI specs for the shared protos' services and compare against new golden files. Read the existing test to understand the pattern, then add the shared protos to its test list. -
Generate initial golden files by running
UPDATE_GOLDEN=1 go test ./internal/openapiv3/ -run TestExhaustiveGoldenFiles -count=1. This creates the baseline golden files for the shared protos' OpenAPI output. -
Verify all OpenAPI tests pass (both the existing tests with existing protos AND the new tests with shared protos).
IMPORTANT: The OpenAPI generator generates one file per service. The shared protos may contain multiple services (e.g., http_verbs_comprehensive.proto has both RESTfulAPIService and BackwardCompatService). The golden test must handle multiple services per proto file.
IMPORTANT: The existing OpenAPI-specific protos (headers.proto, validation_constraints.proto, simple_service.proto, etc.) and their golden files must continue to work. This task ADDS shared protos, it does not replace existing coverage.
go test ./internal/openapiv3/ -count=1 -- all tests must pass including both existing and new golden file tests. Verify symlinks exist: ls -la internal/openapiv3/testdata/proto/http_verbs_comprehensive.proto should show symlink. Verify golden files exist for the shared protos' services.
<success_criteria>
- All 4 generators share the same canonical test proto files (httpgen is the source, others symlink)
- The exhaustive test proto covers: all HTTP verbs, all scalar query param types (including int64/uint64/float/double), enums, optional fields, nested messages, maps, repeated fields, headers, unwrap variants, backward compat
- All golden file tests pass across all 4 generators
- No existing test coverage is lost (OpenAPI-specific protos still tested)
- Any generator bugs exposed by the expanded proto are fixed (not deferred) </success_criteria>
