Quick Task 1: Fix 6 TS Generator Bugs Summary
Fixed enum/repeated query param generation, duplicate URL const, and unused req parameter across protoc-gen-ts-client and protoc-gen-ts-server
Performance#
- Duration: 6 min
- Started: 2026-02-27T14:37:41Z
- Completed: 2026-02-27T14:43:41Z
- Tasks: 2
- Files modified: 11
Accomplishments#
- Fixed all 6 TypeScript generation bugs affecting enum query params, repeated fields, duplicate URL declarations, and unused parameters
- Added TSEnumUnspecifiedValue helper and updated TSZeroCheckForField for enum/repeated field awareness
- Added test proto cases (Region enum, SearchAdvancedRequest, EmptyRequest) exercising all bug scenarios
- Updated golden files across all 5 generators (httpgen, clientgen, tsclientgen, tsservergen, openapiv3)
Task Commits#
Each task was committed atomically:
- Task 1: Add enum/repeated query param test cases and helper functions -
cadce9b(feat) - Task 2: Fix all 6 bugs in ts-client and ts-server generators -
a7627b3(fix)
Plan metadata: (pending final commit)
Files Created/Modified#
internal/tscommon/types.go- Added TSEnumUnspecifiedValue, updated TSZeroCheckForField for enum+repeated, added "enum" case to TSZeroCheckinternal/tsclientgen/generator.go- Bug #4 (repeated forEach+append), Bug #6 (unused _req prefix)internal/tsservergen/generator.go- Bug #2 (enum cast+default), Bug #3 (repeated getAll), Bug #5 (no duplicate const url)internal/httpgen/testdata/proto/query_params.proto- Added Region enum, SearchAdvancedRequest, EmptyRequest, two new RPCsinternal/tsclientgen/testdata/golden/query_params_client.ts- New methods for SearchAdvanced + GetDefaultsinternal/tsservergen/testdata/golden/query_params_server.ts- New handlers for SearchAdvanced + GetDefaultsinternal/tsclientgen/testdata/golden/http_verbs_comprehensive_client.ts- Existing enum field now uses UNSPECIFIED checkinternal/tsservergen/testdata/golden/http_verbs_comprehensive_server.ts- Existing enum field now uses UNSPECIFIED castinternal/clientgen/testdata/golden/query_params_client.pb.go- Updated for new RPCsinternal/httpgen/testdata/golden/query_params_http.pb.go- Updated for new RPCsinternal/openapiv3/testdata/golden/yaml/QueryParamService.openapi.yaml- Updated for new RPCsinternal/openapiv3/testdata/golden/json/QueryParamService.openapi.json- Updated for new RPCs
Decisions Made#
- Enum zero-check uses the first enum value name (the UNSPECIFIED variant) from the proto definition, with custom enum_value annotation support
- Repeated fields in client use
forEach+params.appendfor multi-value URL params (notparams.setwith join) - Repeated fields in server use
params.getAll()which returnsstring[]matching the TS interface type - Server reuses existing
urlvariable when path params already declared it (checkslen(cfg.pathParams) > 0)
Deviations from Plan#
Auto-fixed Issues#
1. [Rule 3 - Blocking] Updated golden files for all 5 generators
- Found during: Task 2 (golden file update)
- Issue: Adding new RPCs to query_params.proto affected all generators that symlink to it (httpgen, clientgen, openapiv3), not just tsclientgen and tsservergen
- Fix: Ran UPDATE_GOLDEN=1 for all affected test packages
- Files modified: clientgen, httpgen, openapiv3 golden files
- Verification:
go test ./...all pass - Committed in: a7627b3 (Task 2 commit)
2. [Rule 3 - Blocking] Applied lint auto-fix for fmt.Fprintf
- Found during: Task 2 (lint run)
- Issue: golangci-lint auto-fixed
sb.WriteString(fmt.Sprintf(...))tofmt.Fprintf(&sb, ...)in tscommon/types.go - Fix: Accepted lint auto-fix (correct and more efficient)
- Files modified: internal/tscommon/types.go
- Verification: Tests pass, lint clean (only pre-existing gosec issues in httpgen remain)
- Committed in: a7627b3 (Task 2 commit)
Total deviations: 2 auto-fixed (2 blocking) Impact on plan: Both auto-fixes necessary for test correctness. No scope creep.
Issues Encountered#
- Xcode license not agreed to on this machine, preventing
make buildandmake lint-fixfrom working. Worked around by callinggo buildandgolangci-lintdirectly. - Pre-existing gosec warnings in httpgen/generator.go (integer overflow conversion) unrelated to this task.
User Setup Required#
None - no external service configuration required.
Next Phase Readiness#
- All TS generators now produce correct TypeScript for enum query params, repeated fields, mixed path+query routes, and empty requests
- Ready for Phase 8+ language work
Quick Task: 1-fix-6-ts-generator-bugs-enum-query-param Completed: 2026-02-27
