close
Skip to content

docs: clarify createSurface is an error for existing surfaces#1238

Open
jacobsimionato wants to merge 1 commit intogoogle:mainfrom
jacobsimionato:duplicate-surface-spec
Open

docs: clarify createSurface is an error for existing surfaces#1238
jacobsimionato wants to merge 1 commit intogoogle:mainfrom
jacobsimionato:duplicate-surface-spec

Conversation

@jacobsimionato
Copy link
Copy Markdown
Collaborator

Description of Changes

  • Updated specification/v0_9/docs/a2ui_protocol.md and specification/v0_10/docs/a2ui_protocol.md to state that sending createSurface for an existing surfaceId is an error.
  • Updated specification/v0_9/json/server_to_client.json and specification/v0_10/json/server_to_client.json schemas with the same clarification in the createSurface description.
  • Added a "Surface Lifecycle" note to specification/v0_9/docs/renderer_guide.md advising renderer implementations to handle duplicate createSurface messages as errors.

Rationale

The A2UI specification intended for createSurface to be a one-time initialization per surface. Re-creating a surface without deleting it first leads to ambiguous state in renderers. This change codifies that behavior as an error to ensure protocol consistency across different agent and renderer implementations.

Testing/Running Instructions

Review the updated documentation and JSON schema files to ensure the language is clear and consistent with existing protocol documentation.

  • specification/v0_9/docs/a2ui_protocol.md
  • specification/v0_10/docs/a2ui_protocol.md
  • specification/v0_9/json/server_to_client.json
  • specification/v0_10/json/server_to_client.json
  • specification/v0_9/docs/renderer_guide.md

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the A2UI protocol documentation and JSON schemas for versions 0.9 and 0.10 to explicitly state that sending a 'createSurface' message for an existing 'surfaceId' is an error. Review feedback focuses on ensuring consistency by using 'MUST' instead of 'SHOULD' for error handling in the renderer guide and aligning the JSON descriptions with the markdown documentation's phrasing and formatting.

3. The **Transport Layer** (e.g., A2A, MCP) calls `getClientDataModel()` before sending any message to the server.
4. If a non-empty data model map is returned, it is included in the transport's metadata field (e.g., `a2uiClientDataModel` in A2A metadata).

* **Surface Lifecycle**: It is an error to receive a `createSurface` message for a `surfaceId` that is already active. The processor SHOULD throw an error or report a validation failure if this occurs.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of "SHOULD" here is inconsistent with the protocol specification, which defines sending createSurface for an existing surface as a hard error. To ensure protocol compliance and consistency across implementations, this should be a "MUST" requirement, matching the adjacent "Component Lifecycle" rule.

Suggested change
* **Surface Lifecycle**: It is an error to receive a `createSurface` message for a `surfaceId` that is already active. The processor SHOULD throw an error or report a validation failure if this occurs.
* **Surface Lifecycle**: It is an error to receive a `createSurface` message for a `surfaceId` that is already active. The processor MUST throw an error or report a validation failure if this occurs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good--unless there is a deliberate reason to prefer SHOULD I am unaware of.

"createSurface": {
"type": "object",
"description": "Signals the client to create a new surface and begin rendering it. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",
"description": "Signals the client to create a new surface and begin rendering it. It is an error to send createSurface for a surfaceId that already exists. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the rest of the description and the markdown documentation, the message name createSurface should be enclosed in single quotes. Additionally, adding "without first deleting it" aligns the JSON description with the explicit wording used in the protocol documentation.

Suggested change
"description": "Signals the client to create a new surface and begin rendering it. It is an error to send createSurface for a surfaceId that already exists. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",
"description": "Signals the client to create a new surface and begin rendering it. It is an error to send 'createSurface' for a surfaceId that already exists without first deleting it. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",

"createSurface": {
"type": "object",
"description": "Signals the client to create a new surface and begin rendering it. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",
"description": "Signals the client to create a new surface and begin rendering it. It is an error to send createSurface for a surfaceId that already exists. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the rest of the description and the markdown documentation, the message name createSurface should be enclosed in single quotes. Additionally, adding "without first deleting it" aligns the JSON description with the explicit wording used in the protocol documentation.

Suggested change
"description": "Signals the client to create a new surface and begin rendering it. It is an error to send createSurface for a surfaceId that already exists. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",
"description": "Signals the client to create a new surface and begin rendering it. It is an error to send 'createSurface' for a surfaceId that already exists without first deleting it. When this message is sent, the client will expect 'updateComponents' and/or 'updateDataModel' messages for the same surfaceId that define the component tree.",

Copy link
Copy Markdown
Collaborator

@ditman ditman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification here. (I think some of the gemini comments are valid, e.g. SHOULD vs MUST)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants