Skip to content

fix(unstable-v2): enforce elicitation scope and item discriminators - #2931

Merged
benbrandt merged 2 commits into
mainfrom
fix/v2-elicitation-discrimination
Nov 20, 2026
Merged

benbrandt merged 2 commits into
mainfrom
fix/v2-elicitation-discrimination

Conversation

@benbrandt

@benbrandt benbrandt commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Two otherwise method-specific elicitation/create validations accepted the wrong payload:

  • Scope is exclusive by key presence. Both scope IDs are invalid even when one value is null. toolCallId only belongs to session scope, including when its value is null. Unrelated extra fields remain valid.
  • Multi-select items with type: "string" must satisfy the string variant. A stray anyOf no longer turns a malformed string enum into a titled control. Titled items omit type. A genuinely unknown string type still takes the extensible branch.

This changes v2 Rust dispatch and both v2 schemas, not v1. Adds Rust regressions and keeps published-schema validation in npm. npm run test:json-schema (also in npm run check and CI) compiles all four Draft 2020-12 roots and all 966 public definitions in strict Ajv. It checks all 391 complete JSON-RPC examples across the matching protocol guides; the migration guide mixes versions and is not used. Unknown keywords and formats fail compilation unless explicitly registered. URI and date-time are asserted, with invalid-value controls; numeric formats are annotations, with limits enforced by schema bounds. The separate envelope change builds on these payload validators.

Validation: npm run generate, npm run check, the v2 no-default-feature Rust elicitation tests, and the TypeScript SDK generator and typecheck with the candidate schemas.

Stacked follow-up: #2932 uses these payloads for whole-message validation. For both v2 publications, TypeScript SDK 1db9118 generated byte-identical bindings with and without the three propertyNames constraints. Generation, typecheck and build passed. Its Zod reader accepts a request-scoped toolCallId (even null) and malformed string multi-select items with a titled anyOf; the published schema and Rust request decoder reject both. Python SDK 0459667 also emitted identical schema.py with and without the constraints. Its full Draft pipeline hit the same unrelated missing CreateOtherSessionElicitationRequest in both cases. Strict SDK readers need their own coverage for the excluded keys.

@benbrandt
benbrandt merged commit 2462b3e into main Nov 20, 2026
13 checks passed
@benbrandt
benbrandt deleted the fix/v2-elicitation-discrimination branch November 20, 2026 13:38
@acp-release-bot acp-release-bot Bot mentioned this pull request Nov 20, 2026
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