Fix GitHub brand casing in SDK public surface#1531
Conversation
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>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
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$refdefinition segments fromGithub→GitHub. - 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 github → GitHub. |
| 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
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>
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 Remaining Wire values: The protocol discriminators ( No cross-SDK consistency issues found. The changes are thorough and well-coordinated across all language implementations.
|
|
I can confirm that these changes do not disrupt Java. |
Why
Parts of the SDK's public surface spelled the brand as "Github" instead of "GitHub" (for example
AttachmentGithubReference,WorkingDirectoryContextHostType.Github, andGithubTokenin 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 likegithub_reference. Rather than hand-edit generated output, the fix lives in the codegen pipeline so it stays correct on future regenerations.scripts/codegen/utils.ts): a newloadSchemaJsoncorrectstitle/description/markdownDescription, the definition-name segment of$refs, anddefinitions/$defskeys, with collision detection. Wire/protocol values (github,github_reference) are deliberately left lowercase.fixBrandCasing; Rust usesnormalizeSchemaBrandCasing+fixBrandCasing; Go reuses its existing identifier override map (github->GitHub). The standalone Java generator gets local copies of the same helpers.GitHubTokencasing in docs.Worth a careful look
Objectfor the 5-branchanyOf), so those committed files are stale and the codegen change can't reach them. I hand-corrected the casing and renamed the orphanedUserMessageAttachment*/SendAttachment*GitHub-reference files so the public API is consistent. Nothing else references them.githubandgithub_referencediscriminators stay lowercase, so this is purely a naming/casing change with no protocol impact.Validation
Builds re-validated after rebasing on latest
main: Nodetsc, Go build + vet, Rustcargo check --all-targets, .NET SDK + test build, and Pythonpy_compileall pass. A full Javamvnbuild was blocked locally by the JDK 25 enforcer (environment limitation); the Java changes are mechanical casing only.Generated by Copilot