docs(v0.9): split renderer guide into core SDK and UI adapter guides#1293
docs(v0.9): split renderer guide into core SDK and UI adapter guides#1293jacobsimionato wants to merge 6 commits intogoogle:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request restructures the A2UI documentation by splitting the previous unified architecture guide into two specialized documents: the Core SDK Implementation Guide and the UI Framework Adapter Implementation Guide. This separation distinguishes framework-agnostic state management from framework-specific rendering logic. Review feedback highlights the need for more precise language regarding array index handling in non-JavaScript environments, stricter boolean type coercion to avoid silent validation errors, and the restoration of critical lifecycle rules and framework-specific pseudo-code examples that were lost during the refactoring.
| 1. **Relative Paths**: A2UI extends JSON Pointer to support paths that do not start with `/` (e.g., `name`), resolving relative to the current scope. | ||
| 2. **Auto-vivification**: When setting a path like `/a/b/0/c`, create intermediate segments. If a segment is numeric, initialize as an Array `[]`, otherwise an Object `{}`. | ||
| 3. **Notification Strategy (Bubble & Cascade)**: Notify exact matches, bubble up to all parent paths, and cascade down to all nested descendant paths. | ||
| 4. **Undefined Handling**: Setting an object key to `undefined` removes it. Setting an array index to `undefined` preserves length but empties the index. |
There was a problem hiding this comment.
The term "empties the index" is specific to JavaScript's sparse arrays. In languages like Java, Kotlin, or Swift, this concept is not native. It would be clearer to specify that the value at the index is set to null or a language-specific equivalent while maintaining the array's length.
| 4. **Undefined Handling**: Setting an object key to `undefined` removes it. Setting an array index to `undefined` preserves length but empties the index. | |
| 4. **Undefined Handling**: Setting an object key to undefined removes it. Setting an array index to undefined preserves length but sets the value at that index to null (or the language's equivalent). |
| ### Type Coercion Table | ||
| | Input Type | Target Type | Result | | ||
| | :------------------------- | :---------- | :---------------------------------------------------------------------- | | ||
| | `String` ("true", "false") | `Boolean` | `true` or `false` (case-insensitive). Any other string maps to `false`. | |
There was a problem hiding this comment.
Coercing any string other than "true" or "false" to false is potentially dangerous as it can hide typos or logic errors in the protocol messages. It is safer to strictly validate boolean strings or follow a standard truthiness model.
| | `String` ("true", "false") | `Boolean` | `true` or `false` (case-insensitive). Any other string maps to `false`. | | |
| | String ("true", "false") | Boolean | "true" maps to true, "false" maps to false (case-insensitive). Other strings SHOULD result in a validation error. | |
|
|
||
| ## 6. Message Processing (`MessageProcessor`) | ||
|
|
||
| The "Controller" that accepts the raw stream, parses messages, and mutates models. |
There was a problem hiding this comment.
The normative requirements for surface and component lifecycles (e.g., handling duplicate surface IDs or component type changes) were present in the original renderer_guide.md but are missing from the descriptive text here. These should be explicitly stated as implementation requirements for the MessageProcessor.
| The "Controller" that accepts the raw stream, parses messages, and mutates models. | |
| The "Controller" that accepts the raw stream, parses messages, and mutates models. | |
| ### Lifecycle Rules | |
| * **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. | |
| * **Component Lifecycle**: If an updateComponents message provides an existing id but a different type, the processor MUST remove the old component and create a fresh one to ensure framework renderers correctly reset their internal state. |
| ``` | ||
|
|
||
| ### Strategy 3: Generic Binders (Dynamic Languages) | ||
| In languages with powerful reflection (like TypeScript), the Binder Layer can be automated. A generic factory inspects a component's schema and automatically creates data model subscriptions, allowing developers to write simple, stateless UI components. |
There was a problem hiding this comment.
The original renderer_guide.md included detailed pseudo-code examples for React and Angular adapters (Strategies 2 and 3). These examples provided essential context for how to implement the binder layer and manage framework-specific lifecycles. Removing them reduces the practical utility of this guide for developers in those ecosystems.
Description of Changes
This PR refactors the
specification/v0_9/docs/renderer_guide.mdinto two distinct, highly-focused implementation manuals:core_sdk_implementation_guide.md: Details the framework-agnostic Data Layer (State Models, DataModel, MessageProcessor, logic evaluation, and capability generation). It includes a rigorous, test-driven 7-Phase Implementation Workflow specifically targeted at building the underlying data primitives.ui_framework_adapter_implementation_guide.md: Details the View Layer (Rendering loop,buildChildrecursion, Component Implementation strategies, and framework-specific lifecycle management). It explicitly requires the developer to either adopt or build the Core SDK in Phase 1 before building the native UI bindings.The original
renderer_guide.mdhas been safely deleted.Rationale
The previous renderer guide conflated the framework-agnostic protocol mechanics (which can be written once per language) with the framework-specific rendering mechanics (which are needed for every UI framework). Splitting the documentation:
Testing/Running Instructions
Reviewers can read the new markdown files locally:
cat specification/v0_9/docs/core_sdk_implementation_guide.mdcat specification/v0_9/docs/ui_framework_adapter_implementation_guide.mdEnsure that all technical details and requirements from the original
renderer_guide.mdhave been preserved and properly distributed. You can also verify that there are no broken links in themkdocs.yamlora2ui_protocol.md(these were checked during the split).