Skip to content

chore(schema): bump ACP schema to 1.20.0 - #53

Open
lx-wnk wants to merge 3 commits into
coder:mainfrom
lx-wnk:chore/schema-1.20.0
Open

chore(schema): bump ACP schema to 1.20.0#53
lx-wnk wants to merge 3 commits into
coder:mainfrom
lx-wnk:chore/schema-1.20.0

Conversation

@lx-wnk

@lx-wnk lx-wnk commented Aug 14, 2026

Copy link
Copy Markdown

Depends on #52 — the first commit here is that PR, so this diff shrinks once it merges.

Regenerating against schema-v1.20.0 needs one generator fix first, then the bump itself.

fix(generate): emit Validate for anyOf unions

A definition carrying both properties and anyOf is emitted as a union wrapper, so the property-based validator referenced fields the wrapper does not have. Suppressing that validator alone is not enough: the request and response dispatchers call Validate unconditionally after unmarshalling, so a union without one fails to compile.

The generic union validator is now emitted for anyOf as well, requiring at least one variant rather than exactly one.

Behaviour this changes, measured against the current schema (0.13.5) with only the generator patch applied, so the effect is attributable:

  • 12 union types gain a Validate they did not have (AgentResponse, AuthMethod, AvailableCommandInput, ClientResponse, EmbeddedResourceResource, ErrorCode, McpServer, RequestId, SessionConfigSelectOptions, UnstableElicitationFormMode, UnstableElicitationUrlMode, UnstableMcpServer).
  • SetSessionConfigOptionRequest.Validate changes from return nil to the variant check. Its previous body was empty because the properties it would have validated are not on the wrapper.

A zero value now fails validation where it previously passed. A payload off the wire is unaffected: UnmarshalJSON([]byte("{}")) lands in a variant, so unmarshalled requests always validate. There is a test for that.

chore(schema): bump to 1.20.0

Three call sites needed adjusting:

  • TerminalId is now a named type, so ToolTerminalRef converts explicitly.
  • session/delete graduated from the experimental surface, so UnstableDeleteSession* became DeleteSession* and the method moved from AgentExperimental to Agent. Examples and test doubles implement it.
  • README.md and version follow schema/version, matching what make version produces.

Adds union_validate_test.go, which covers the union validators — they had no tests.

Pre-existing gap, not addressed here

A definition carrying both properties and anyOf is emitted as a union wrapper only, so its sibling scalar properties are dropped. This is not introduced by the bump. At 0.13.5 the unstable SetSessionConfigOptionRequest already declares sessionId and configId as required and neither appears on the generated struct, which is why its validator was empty. Emitting hybrid definitions faithfully needs work in emitUnion; happy to open a separate issue or PR if you want it fixed.

Verification

  • make test passes; go test -race passes.
  • treefmt reports no changes and git diff --exit-code is clean. mdsh was run separately because the version available here has an incompatible CLI; README.md is a fixpoint under it.
  • actionlint and zizmor report nothing.
  • GOOS=linux go build ./... passes.
  • Each commit builds and tests green on its own.

lx-wnk and others added 3 commits August 14, 2026 14:39
The protocol repository publishes its schema artifacts under `schema-vX.Y.Z`
tags. The Makefile still requested them from `vX.Y.Z`, so every schema target
resolved to a 404 and the generator could not be pointed at any release cut
under the new scheme.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A definition carrying both `properties` and `anyOf` is emitted as a union
wrapper, so the property-based validator referenced fields the wrapper does not
have. Suppressing that validator alone is not enough: the request and response
dispatchers call Validate unconditionally after unmarshalling, so a union
without one fails to compile.

Emit the generic union validator for anyOf as well, requiring at least one
variant rather than exactly one, which matches anyOf semantics. Types that
previously received a property validator over fields the wrapper had dropped
had an empty `return nil` body, so this replaces a validator that checked
nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Regenerated against the current schema release. Three call sites needed
adjusting:

- `TerminalId` is now a named type, so `ToolTerminalRef` converts explicitly.
- `session/delete` graduated from the experimental surface, so
  `UnstableDeleteSession*` became `DeleteSession*` and the method moved from
  `AgentExperimental` to `Agent`. Examples and test doubles implement it.
- `README.md` and `version` follow `schema/version`, matching what
  `make version` produces.

Adds tests for the union validators, which had no coverage.

A pre-existing generator gap becomes more visible with this schema: a
definition carrying both `properties` and `anyOf` is emitted as a union
wrapper only, so its sibling scalar properties are dropped. This is not new
here. At 0.13.5 the unstable `SetSessionConfigOptionRequest` already declares
`sessionId` and `configId` as required, and neither appears on the generated
struct. Emitting hybrid definitions faithfully needs work in emitUnion and is
left for a follow-up.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant