Skip to content

Consolidate Go initialism casing#1527

Merged
stephentoub merged 5 commits into
github:mainfrom
qmuntal:go-initialisms-consolidation
Jun 1, 2026
Merged

Consolidate Go initialism casing#1527
stephentoub merged 5 commits into
github:mainfrom
qmuntal:go-initialisms-consolidation

Conversation

@qmuntal
Copy link
Copy Markdown
Contributor

@qmuntal qmuntal commented Jun 1, 2026

Summary

Consolidates Go identifier initialism casing across the Go code generator, generated RPC/session types, public Go SDK APIs, docs, and tests so the SDK uses one idiomatic naming path. The generator now routes Go identifier words through a shared helper, adds plural casing overrides, and aligns hand-written connection APIs with the same casing.

Initialism changes

  • Api -> API for generated API wrapper types, fields, and registration helpers.
  • Rpc -> RPC for generated RPC wrapper types, constructors, and session fields.
  • Mcp -> MCP for MCP-related generated types, events, hooks, config fields, permissions, and tool helpers.
  • Sse -> SSE for SSE transport enum names.
  • Ado -> ADO for ADO working-directory host type enum names.
  • Sdk -> SDK for SDK protocol version and extension SDK path symbols.
  • Fs -> FS for session filesystem provider/config/adapter/error/RPC types.
  • Url/Urls -> URL/URLs for URL-bearing generated identifiers.
  • Uri/Uris -> URI/URIs, including UriConnection -> URIConnection.
  • Id/Ids -> ID/IDs through the shared helper and plural override.
  • Tcp -> TCP, including TcpConnection -> TCPConnection.
  • Adds consolidated recognition for CLI, HMAC, and UTC so future generated names use idiomatic Go casing.

Validation

Ran npm run generate:go and git diff --check. Tests not run, per request.

@qmuntal qmuntal requested a review from a team as a code owner June 1, 2026 09:52
Copilot AI review requested due to automatic review settings June 1, 2026 09:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR standardizes Go identifier casing to follow Go initialism conventions (e.g., MCP, RPC, SDK, GitHub, URL, FS) across the code generator, generated RPC bindings, SDK types, and tests.

Changes:

  • Updated Go codegen casing rules (initialisms + explicit overrides like GitHub) and regenerated code accordingly.
  • Renamed many exported Go SDK/RPC symbols to initialism-correct forms (e.g., SessionFS, ServerRPC, UIInputOptions, SDKProtocolVersion).
  • Updated unit and E2E tests plus documentation to match the new exported names.
Show a summary per file
File Description
scripts/codegen/go.ts Enhances identifier casing logic (initialisms + overrides) to drive consistent Go symbol generation.
go/types.go Renames exported SDK types/fields to initialism-correct forms (e.g., SessionFS, MIMEType, UIInputOptions).
go/client.go Updates client wiring to new RPC/type names and new Session FS registration types.
go/session_fs_provider.go Renames FS provider interfaces/types to SessionFS* and updates RPC handler adapter signatures.
go/rpc/z*.go Regenerates RPC types/encoding to match new casing (MCP*, GitHub*, URLs, etc.).
go/.go tests + go/internal/e2e/ Renames tests/usages to match new exported symbols and RPC shape changes.
go/README.md + docs/setup/multi-tenancy.md Updates docs to reflect renamed exported API surfaces.

Copilot's findings

Comments suppressed due to low confidence (3)

go/types.go:1

  • Renaming exported fields/types (e.g., ClientOptions.SessionFsSessionFS) is a breaking change for SDK consumers. If backward compatibility is required, consider providing a compatibility shim (mandatory if the Go SDK API is expected to be stable): keep the old SessionFs field as deprecated and map it internally to SessionFS, and add type aliases for renamed exported types where possible (e.g., type SessionFsConfig = SessionFSConfig).
    go/types.go:1
  • Renaming exported fields/types (e.g., ClientOptions.SessionFsSessionFS) is a breaking change for SDK consumers. If backward compatibility is required, consider providing a compatibility shim (mandatory if the Go SDK API is expected to be stable): keep the old SessionFs field as deprecated and map it internally to SessionFS, and add type aliases for renamed exported types where possible (e.g., type SessionFsConfig = SessionFSConfig).
    go/sdk_protocol_version.go:1
  • Renaming exported symbols SdkProtocolVersion/GetSdkProtocolVersion to SDKProtocolVersion/GetSDKProtocolVersion is a breaking API change. To preserve source compatibility, consider adding deprecated wrappers/aliases (e.g., an exported const SdkProtocolVersion = SDKProtocolVersion and func GetSdkProtocolVersion() int { return GetSDKProtocolVersion() }) while keeping the new names as the preferred API.
  • Files reviewed: 46/47 changed files
  • Comments generated: 2

Comment thread go/client_test.go Outdated
Comment thread go/client.go Outdated
@stephentoub stephentoub added this pull request to the merge queue Jun 1, 2026
Merged via the queue into github:main with commit c01a9ee Jun 1, 2026
23 checks passed
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.

3 participants