Skip to content

Fix shared schema comparison for Go codegen#1304

Merged
stephentoub merged 1 commit into
mainfrom
stephentoub/fix-go-codegen
May 15, 2026
Merged

Fix shared schema comparison for Go codegen#1304
stephentoub merged 1 commit into
mainfrom
stephentoub/fix-go-codegen

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Schema definitions shared between api.schema.json and session-events.schema.json can have identical wire shapes but different documentation. With the 1.0.49-0 Copilot runtime schemas, that caused Go codegen to miss ReasoningSummary as shared and emit duplicate declarations in the rpc package.

This updates shared-definition comparison to ignore documentation-only metadata (description and markdownDescription) while preserving the existing structural comparison for refs, enum values, and object shapes. The regression test now covers a shared enum with intentionally different descriptions.

Ignore documentation-only schema metadata when comparing shared API and session-event definitions so Go codegen references common wire types instead of emitting duplicate declarations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 15, 2026 16:16
@stephentoub stephentoub requested a review from a team as a code owner May 15, 2026 16:16
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

Fixes Go codegen duplicate declarations by making shared-schema comparison ignore documentation-only fields (description, markdownDescription) so definitions with identical wire shapes but differing docs are still recognized as shared.

Changes:

  • Skip description and markdownDescription keys during normalization in normalizeDefinitionForComparison.
  • Update shared-codegen test fixtures to include intentionally divergent descriptions on a shared enum.
Show a summary per file
File Description
scripts/codegen/utils.ts Ignore doc-only metadata when comparing shared schema definitions.
nodejs/test/shared-codegen.test.ts Adds divergent descriptions to shared enum to cover the fix.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@github-actions
Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR makes changes only to shared codegen tooling (scripts/codegen/utils.ts) and its test — no public API surface is added or modified in any of the four SDK implementations (nodejs/src/, python/copilot/, go/, dotnet/src/).

Summary of changes:

  • scripts/codegen/utils.ts: normalizeDefinitionForComparison now ignores description and markdownDescription fields when comparing schema definitions for structural equivalence. This correctly treats schemas that are wire-identical (same type/enum/shape) but have different human-readable documentation as the same shared type.
  • nodejs/test/shared-codegen.test.ts: Regression test updated to cover shared enums with intentionally different descriptions.

No consistency concerns. The fix is to shared infrastructure that benefits all language code generators equally — it prevents duplicate type declarations in Go's generated RPC code when the upstream schema has the same type documented differently in api.schema.json vs. session-events.schema.json. No changes are needed in any other SDK.

Generated by SDK Consistency Review Agent for issue #1304 · ● 210.5K ·

@stephentoub stephentoub merged commit e20f5be into main May 15, 2026
24 checks passed
@stephentoub stephentoub deleted the stephentoub/fix-go-codegen branch May 15, 2026 16:21
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