diff --git a/conformance/agent/direct_json/compiler.yaml b/conformance/agent/direct_json/compiler.yaml index 413374c044..9bc24e815f 100644 --- a/conformance/agent/direct_json/compiler.yaml +++ b/conformance/agent/direct_json/compiler.yaml @@ -58,6 +58,9 @@ # v1.0. A case states no version of its own: the version it runs under is the # one its catalog document declares. +# A compile case checks the block on its own, as `validate_payload` does: a +# surface that the block updates without creating is assumed to exist. + - name: test_compile_json_message_list description: A well formed message list compiles to those messages. action: compile diff --git a/conformance/agent/direct_json/decompiler.yaml b/conformance/agent/direct_json/decompiler.yaml index 0f9c7c8187..e04e296efe 100644 --- a/conformance/agent/direct_json/decompiler.yaml +++ b/conformance/agent/direct_json/decompiler.yaml @@ -36,6 +36,9 @@ # v1.0. A case states no version of its own: the version it runs under is the # one its catalog document declares. +# A round trip checks the recompiled block on its own, as `validate_payload` +# does: a surface that the block updates without creating is assumed to exist. + - name: test_decompile_json_messages description: Messages are written back out as the JSON a model would have emitted, and compiling that returns them. action: decompile diff --git a/conformance/agent/direct_json/response_parser.yaml b/conformance/agent/direct_json/response_parser.yaml index 569bef689b..b4b057ef82 100644 --- a/conformance/agent/direct_json/response_parser.yaml +++ b/conformance/agent/direct_json/response_parser.yaml @@ -56,6 +56,9 @@ # v1.0. A case states no version of its own: the version it runs under is the # one its catalog document declares. +# A response is parsed as one chat turn, against a renderer that holds no +# surfaces yet, so a case that updates a surface also creates it. + # --- Unwrapping a response --- - name: test_unwrap_text_before_between_and_after_blocks @@ -213,11 +216,15 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" input: |- Here is the surface. - [{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": "Hello"}]}}] + [{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}, {"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": "Hello"}]}}] Tell me if you want it changed. expect: - text: "Here is the surface." - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - version: "v1.0" updateComponents: surfaceId: "s1" diff --git a/conformance/agent/direct_json/response_streaming.yaml b/conformance/agent/direct_json/response_streaming.yaml index 6f4724a33d..9e433981fc 100644 --- a/conformance/agent/direct_json/response_streaming.yaml +++ b/conformance/agent/direct_json/response_streaming.yaml @@ -102,6 +102,11 @@ # version" run them against v0.8, v0.9 and v1.0 catalogs alike. The v0.8 and # v0.9 cases use `streaming_catalog_v0_8.json` and `streaming_catalog_v0_9.json`. +# A stream is read as one chat turn, against a renderer that holds no surfaces +# yet. A case that updates a surface it does not create starts with a block +# that creates it, since a renderer rejects an update to a surface it does not +# hold. + # --- Text as it arrives --- - name: test_chunk_text_emitted_as_it_arrives @@ -125,6 +130,13 @@ format: direct_json catalog: "test_data/catalogs/simplified_catalog_v1_0.json" steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: | Here is the surface. expect: @@ -231,6 +243,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: [] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1",' expect: [] - input: ' "components": [{"id": "root", "component": "Text", "text": "Hello"}]}}]' @@ -253,6 +272,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["greeting"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateDataModel": {"surfaceId": "s1", "value": {"greeting": "Hel' expect: - a2ui: @@ -278,6 +304,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": "Hello", "variant": "cap' expect: [] - input: 'tion"}]}}]' @@ -301,6 +334,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["value"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateDataModel": {"surfaceId": "s1", "path": "/greeting", "value": "Hel' expect: - a2ui: @@ -326,6 +366,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": "Hel' expect: [] - input: 'lo"' @@ -352,6 +399,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Card", "child": "body"}, {"id": "body", "component": "Text", "text": "Hel' expect: - a2ui: @@ -410,6 +464,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: [] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": "Hel' expect: [] - input: 'lo"}]}}]' @@ -432,6 +493,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: [] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": ""}]}}]' @@ -453,6 +521,13 @@ format: direct_json catalog: "test_data/catalogs/simplified_catalog_v1_0.json" steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: | First the greeting. expect: @@ -548,6 +623,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": {"@path": "/user' expect: [] - input: '/name"}}]}}]' @@ -571,6 +653,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Te' expect: [] - input: 'xt", "text": "Hello"}]}}]' @@ -593,6 +682,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Card", "child": "bo' expect: [] - input: 'dy"}, {"id": "body", "component": "Text", "text": "Hello"}]}}]' @@ -618,6 +714,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Column", "children": ["one", "tw' expect: [] - input: 'o"]}, {"id": "one", "component": "Text", "text": "One"}, {"id": "two", "component": "Text", "text": "Two"}]}}]' @@ -646,6 +749,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: ["text"] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Column", "children": {"componentId": "row"' expect: [] - input: ', "path": "/items"}}, {"id": "row", "component": "Text", "text": "Item"}]}}]' @@ -744,6 +854,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: [] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateDataModel": {"surfaceId": "s1", "value": {"items": {' expect: - a2ui: @@ -783,6 +900,13 @@ catalog: "test_data/catalogs/simplified_catalog_v1_0.json" progressive_keys: [] steps: + - input: '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/simplified"}}]' + expect: + - a2ui: + - version: "v1.0" + createSurface: + surfaceId: "s1" + catalogId: "conformance/simplified" - input: '[{"version": "v1.0", "updateDataModel": {"surfaceId": "s1", "value": {"title": "Top", "items": {"item1"' expect: [] - input: ': {"name": "Item 1"}}}}}]' @@ -1289,7 +1413,7 @@ root: "root" - name: test_stream_update_before_create_surface_fails_v09 - description: An updateComponents before its surface's createSurface is emitted while the block arrives, and the block raises a validation error when it closes, since the surface did not exist yet. + description: An updateComponents for a surface that does not exist yet is held back, since a renderer would reject it, and the block raises a validation error when it closes. action: parse_chunk args: format: direct_json @@ -1299,15 +1423,7 @@ - input: "[" expect: [] - input: '{"version": "v0.9", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": "hi"}]}}, ' - expect: - - a2ui: - - version: "v0.9" - updateComponents: - surfaceId: "s1" - components: - - id: "root" - component: "Text" - text: "hi" + expect: [] - input: '{"version": "v0.9", "createSurface": {"catalogId": "test_catalog", "surfaceId": "s1"}}]' expect_error: category: "ValidationError" @@ -3061,7 +3177,7 @@ path: "/name" - name: test_stream_data_model_before_create_surface_fails_v09 - description: An updateDataModel before its surface's createSurface is emitted while the block arrives, and the block raises a validation error when it closes. + description: An updateDataModel for a surface that does not exist yet is held back, since a renderer would reject it, the messages after it wait with it, and the block raises a validation error when it closes. action: parse_chunk args: format: direct_json @@ -3071,20 +3187,9 @@ - input: "[" expect: [] - input: '{"version": "v0.9", "updateDataModel": {"surfaceId": "s1", "value": {"name": "Alice"}}}, ' - expect: - - a2ui: - - version: "v0.9" - updateDataModel: - surfaceId: "s1" - value: - name: Alice + expect: [] - input: '{"version": "v0.9", "createSurface": {"catalogId": "test_catalog", "surfaceId": "s1"}}, ' - expect: - - a2ui: - - version: "v0.9" - createSurface: - surfaceId: "s1" - catalogId: "test_catalog" + expect: [] - input: '{"version": "v0.9", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Text", "text": {"path": "/name"}}]}}]' expect_error: category: "ValidationError" @@ -3428,6 +3533,13 @@ catalog: "test_data/catalogs/streaming_catalog_v0_9.json" progressive_keys: [] steps: + - input: '[{"version": "v0.9", "createSurface": {"surfaceId": "default", "catalogId": "test_catalog"}}]' + expect: + - a2ui: + - version: "v0.9" + createSurface: + surfaceId: "default" + catalogId: "test_catalog" - input: '[ {"version": "v0.9", "updateDataModel": {"surfaceId": "default", "value": {"name": "John", "incomplete": ' expect: [] - input: '"done"}}}]' @@ -3484,6 +3596,13 @@ catalog: "test_data/catalogs/streaming_catalog_v0_9.json" progressive_keys: [] steps: + - input: '[{"version": "v0.9", "createSurface": {"surfaceId": "default", "catalogId": "test_catalog"}}]' + expect: + - a2ui: + - version: "v0.9" + createSurface: + surfaceId: "default" + catalogId: "test_catalog" - input: '[ {"version": "v0.9", "updateDataModel": {"surfaceId": "default", "value": {"infoLink": "[More Info](x)", "rat' expect: [] - input: 'ing": "5 star"' @@ -3549,6 +3668,13 @@ catalog: "test_data/catalogs/streaming_catalog_v0_9.json" progressive_keys: [] steps: + - input: '[{"version": "v0.9", "createSurface": {"surfaceId": "default", "catalogId": "test_catalog"}}]' + expect: + - a2ui: + - version: "v0.9" + createSurface: + surfaceId: "default" + catalogId: "test_catalog" - input: "[" expect: [] - input: '{"version": "v0.9", "updateDataModel": {"surfaceId": "default", "value": {"title": "Top Restaurants", "items": {' @@ -3596,6 +3722,13 @@ catalog: "test_data/catalogs/streaming_catalog_v0_9.json" progressive_keys: [] steps: + - input: '[{"version": "v0.9", "createSurface": {"surfaceId": "default", "catalogId": "test_catalog"}}]' + expect: + - a2ui: + - version: "v0.9" + createSurface: + surfaceId: "default" + catalogId: "test_catalog" - input: '[ {"version": "v0.9", "updateDataModel": {"surfaceId": "default", "value": {"title": "Top Restaurants","items": {"item1": {"name": "Food", "detail": "Spicy", "imageUrl":' expect: [] - input: ' "https://example.com/food.png"}}}}}]' @@ -3633,6 +3766,13 @@ catalog: "test_data/catalogs/streaming_catalog_v0_9.json" progressive_keys: [] steps: + - input: '[{"version": "v0.9", "createSurface": {"surfaceId": "default", "catalogId": "test_catalog"}}]' + expect: + - a2ui: + - version: "v0.9" + createSurface: + surfaceId: "default" + catalogId: "test_catalog" - input: '[ {"version": "v0.9", "updateDataModel": {"surfaceId": "default", "value": {"title": "Top Restaurants","items": {"item2": {"name": "Han Dynasty", "imageUrl": "http://localhost:10002/static/mapotofu.jpeg", "broken":' expect: [] - input: '"x"}}}}}]' diff --git a/conformance/agent/express/compiler.yaml b/conformance/agent/express/compiler.yaml index f1240830fd..1424b4d8ae 100644 --- a/conformance/agent/express/compiler.yaml +++ b/conformance/agent/express/compiler.yaml @@ -101,6 +101,9 @@ # v1.0. A case states no version of its own: the version it runs under is the # one its catalog document declares. +# A compile case checks the block on its own, as `validate_payload` does: a +# surface that the block updates without creating is assumed to exist. + - name: test_compile_express_minimal_root description: A block that assigns root compiles to one createSurface carrying that component. action: compile diff --git a/conformance/agent/express/decompiler.yaml b/conformance/agent/express/decompiler.yaml index e9bced6eb9..c8261a62e8 100644 --- a/conformance/agent/express/decompiler.yaml +++ b/conformance/agent/express/decompiler.yaml @@ -50,6 +50,9 @@ # v1.0. A case states no version of its own: the version it runs under is the # one its catalog document declares. +# A round trip checks the recompiled block on its own, as `validate_payload` +# does: a surface that the block updates without creating is assumed to exist. + - name: test_decompile_express_components description: A createSurface writes back out as the surface line and the component assignments it came from. action: decompile