Skip to content

Fix GitHub brand casing in SDK public surface#1531

Merged
stephentoub merged 2 commits into
mainfrom
stephentoub/fix-github-casing
Jun 1, 2026
Merged

Fix GitHub brand casing in SDK public surface#1531
stephentoub merged 2 commits into
mainfrom
stephentoub/fix-github-casing

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Why

Parts of the SDK's public surface spelled the brand as "Github" instead of "GitHub" (for example AttachmentGithubReference, WorkingDirectoryContextHostType.Github, and GithubToken in docs). These names are produced by code generation from the upstream schemas, so the wrong casing showed up consistently across every language SDK.

Approach

The bad casing comes from two places: schema-derived names (titles, definition keys, $refs) and identifiers rebuilt from lowercase wire values like github_reference. Rather than hand-edit generated output, the fix lives in the codegen pipeline so it stays correct on future regenerations.

  • Shared schema normalization (scripts/codegen/utils.ts): a new loadSchemaJson corrects title/description/markdownDescription, the definition-name segment of $refs, and definitions/$defs keys, with collision detection. Wire/protocol values (github, github_reference) are deliberately left lowercase.
  • Per-language casers: TypeScript, Python, and C# wrap their identifier casers in fixBrandCasing; Rust uses normalizeSchemaBrandCasing + fixBrandCasing; Go reuses its existing identifier override map (github -> GitHub). The standalone Java generator gets local copies of the same helpers.
  • Regenerated the nodejs, dotnet, python, go, and rust outputs, plus updated the E2E tests that referenced the renamed symbols and the GitHubToken casing in docs.

Worth a careful look

  • Java attachment types: the current Java generator no longer emits the attachment union variants (it falls back to Object for the 5-branch anyOf), so those committed files are stale and the codegen change can't reach them. I hand-corrected the casing and renamed the orphaned UserMessageAttachment*/SendAttachment* GitHub-reference files so the public API is consistent. Nothing else references them.
  • Wire values unchanged: verified github and github_reference discriminators stay lowercase, so this is purely a naming/casing change with no protocol impact.
  • The companion upstream schema-title fix is being made separately in copilot-agent-runtime; this SDK-side codegen fix is robust regardless of when that lands.

Validation

Builds re-validated after rebasing on latest main: Node tsc, Go build + vet, Rust cargo check --all-targets, .NET SDK + test build, and Python py_compile all pass. A full Java mvn build was blocked locally by the JDK 25 enforcer (environment limitation); the Java changes are mechanical casing only.

Generated by Copilot

Generated identifiers and docs spelled the brand as "Github" instead of
"GitHub". The names derive from schema titles/definition keys and from
lowercase wire values, so the fix is applied in codegen rather than by
hand-editing generated output.

- scripts/codegen/utils.ts: add shared brand normalization (loadSchemaJson)
  that corrects title/description/markdownDescription, \ name segments,
  and definitions/\ keys, with collision detection. Wire values such as
  "github" and "github_reference" are left lowercase.
- Per-language casers fixed: typescript, python, csharp (fixBrandCasing),
  rust (normalizeSchemaBrandCasing + fixBrandCasing), and go via the existing
  identifier override map ("github" -> "GitHub").
- java/scripts/codegen/java.ts: local copies of the same helpers wired into
  toPascalCase/toJavaClassName and the schema load sites.
- Regenerated nodejs, dotnet, python, go, and rust outputs.
- Java attachment union types are no longer emitted by the generator (Object
  fallback for the 5-branch anyOf); hand-corrected the casing and renamed the
  stale UserMessageAttachment*/SendAttachment* GitHub reference files.
- Updated E2E tests referencing the renamed symbols (go, dotnet, python, rust)
  and corrected GitHubToken casing in docs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 1, 2026 16:31
@stephentoub stephentoub requested a review from a team as a code owner June 1, 2026 16:31
@github-actions

This comment has been minimized.

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

This PR fixes incorrect “Github” brand casing across the SDK’s generated public API surface by normalizing schema-derived names and applying brand-aware casing fixes in the codegen pipeline, then regenerating language outputs and updating tests/docs accordingly.

Changes:

  • Added schema-loading + normalization utilities to rewrite title/doc strings, definition keys, and $ref definition segments from GithubGitHub.
  • Updated per-language generators/casers (TS, Python, Go, C#, Rust, Java) to apply consistent brand casing and regenerated outputs.
  • Updated E2E/unit tests and docs that referenced the old Github* symbol names / options.
Show a summary per file
File Description
scripts/codegen/utils.ts Adds fixBrandCasing, schema brand normalization, and loadSchemaJson helper used by generators.
scripts/codegen/typescript.ts Uses normalized schema loader and brand-aware pascal casing for TS generation.
scripts/codegen/rust.ts Normalizes schema + applies brand-aware PascalCase for Rust codegen.
scripts/codegen/python.ts Uses normalized schema loader and brand-aware PascalCase for Python codegen inputs.
scripts/codegen/go.ts Uses normalized schema loader and adds Go casing override githubGitHub.
scripts/codegen/csharp.ts Uses normalized schema loader and brand-aware casing for C# identifier generation.
rust/tests/e2e/rpc_session_state.rs Updates Rust E2E test to renamed GitHub enum variant.
rust/src/generated/session_events.rs Regenerated Rust session events with corrected GitHub enum variant casing.
rust/src/generated/api_types.rs Regenerated Rust API types to GitHub* naming across affected types/enums.
python/test_event_forward_compatibility.py Updates Python test references to renamed AttachmentGitHubReferenceType.
python/copilot/generated/session_events.py Regenerated Python session events with GitHub-cased attachment types/enums.
python/copilot/generated/rpc.py Regenerated Python RPC types reflecting brand-cased schema identifiers.
nodejs/src/generated/session-events.ts Regenerated Node session events to GitHub-cased attachment types/enums.
nodejs/src/generated/rpc.ts Regenerated Node RPC types to GitHub-cased installed plugin / attachment types.
java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReferenceType.java Renames generated enum to GitHub casing.
java/src/generated/java/com/github/copilot/generated/UserMessageAttachmentGitHubReference.java Renames generated attachment class + updates referenced enum type.
java/src/generated/java/com/github/copilot/generated/UserMessageAttachment.java Updates subtype mapping to renamed UserMessageAttachmentGitHubReference.
java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReferenceType.java Renames generated enum to GitHub casing.
java/src/generated/java/com/github/copilot/generated/rpc/SendAttachmentGitHubReference.java Renames generated attachment class + updates referenced enum type.
java/src/generated/java/com/github/copilot/generated/rpc/SendAttachment.java Updates subtype mapping to renamed SendAttachmentGitHubReference.
java/scripts/codegen/java.ts Adds Java-local brand casing + schema normalization in Java generator pipeline.
go/zsession_events.go Updates Go re-export aliases to GitHub-cased names.
go/rpc/zsession_events.go Regenerates Go session-event constants to GitHub casing.
go/rpc/zrpc.go Regenerates Go RPC types/constants to GitHub casing.
go/rpc/zrpc_encoding.go Updates Go JSON encoding/dispatch for renamed attachment types.
go/internal/e2e/session_e2e_test.go Updates Go E2E attachment test references to AttachmentGitHubReference*.
go/internal/e2e/rpc_session_state_e2e_test.go Updates Go E2E host type enum reference to GitHub.
dotnet/test/E2E/SessionE2ETests.cs Updates .NET E2E attachment test name/types to GitHub casing.
dotnet/test/E2E/RpcSessionStateE2ETests.cs Updates .NET E2E host type enum reference to GitHub.
dotnet/src/Generated/SessionEvents.cs Regenerates .NET session events types/enums to GitHub casing.
dotnet/src/Generated/Rpc.cs Regenerates .NET RPC types/enums to GitHub casing.
docs/troubleshooting/debugging.md Fixes docs snippets to use GitHubToken casing.
docs/setup/github-oauth.md Fixes docs snippet to use GitHubToken casing.
docs/auth/authenticate.md Fixes docs snippet to use GitHubToken casing.
.github/agents/docs-maintenance.agent.md Updates docs-maintenance agent guidance to GitHubToken casing.

Copilot's findings

Files not reviewed (4)
  • go/rpc/zrpc.go: Language not supported
  • go/rpc/zrpc_encoding.go: Language not supported
  • go/rpc/zsession_events.go: Language not supported
  • go/zsession_events.go: Language not supported
  • Files reviewed: 17/35 changed files
  • Comments generated: 1

Comment thread java/scripts/codegen/java.ts
renameBrandDefinitionKeys compared schema fragments with JSON.stringify,
which is sensitive to object key order and could report false-positive
collisions (or miss real ones). Add a local key-sorted stableStringify
helper (mirroring scripts/codegen/utils.ts) and use it for the check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Cross-SDK Consistency Review ✅

This PR makes a consistent, comprehensive change across all SDK implementations simultaneously. Here's the consistency analysis:

Coverage: All 6 language SDKs are updated — Node.js, Python, Go, .NET, Rust (via codegen regeneration), and Java (manual correction for attachment types not yet handled by Java codegen).

Codegen pipeline: The fix is applied at the source (schema normalization in scripts/codegen/utils.ts) with per-language fixBrandCasing wrappers in all codegen scripts (typescript.ts, python.ts, csharp.ts, go.ts, rust.ts, and java/scripts/codegen/java.ts), ensuring future regenerations stay correct.

Remaining Github occurrences: The two Java files (CopilotClientOptions.java, ConfigCloneTest.java) that still contain Github are intentional — they're the deprecated backward-compatibility shims (getGithubToken()/setGithubToken()) with @Deprecated annotations pointing to the correctly-cased new methods. This is the right approach.

Wire values: The protocol discriminators (github, github_reference) are correctly left lowercase — only identifier/documentation strings are renamed.

No cross-SDK consistency issues found. The changes are thorough and well-coordinated across all language implementations.

Generated by SDK Consistency Review Agent for issue #1531 · ● 4M ·

@stephentoub stephentoub merged commit 8992ba9 into main Jun 1, 2026
52 of 53 checks passed
@stephentoub stephentoub deleted the stephentoub/fix-github-casing branch June 1, 2026 18:42
@edburns
Copy link
Copy Markdown
Collaborator

edburns commented Jun 1, 2026

I can confirm that these changes do not disrupt Java.

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