diff --git a/conformance/core/message_processor_scaling.yaml b/conformance/core/message_processor_scaling.yaml index 353c84dd48..8d5cf4cb83 100644 --- a/conformance/core/message_processor_scaling.yaml +++ b/conformance/core/message_processor_scaling.yaml @@ -66,3 +66,23 @@ - "]" sizes: [200, 800] max_ratio: 8 + +- name: test_scaling_process_single_component_messages_composition_v10 + description: Processing n messages of one component each, under a validation config and with a catalog whose components declare allowedParents and allowedChildren, takes about four times as long at 4n. A message that adds a child to a container checks the constraints the child changes, rather than every child of the container. + action: measure_growth + protocolVersion: "v1.0" + catalogPaths: + - "conformance/test_data/catalogs/composition_catalog_v1_0.json" + args: + validation_config: relaxed + operation: process_messages + payload: + - '[{"version": "v1.0", "createSurface": {"surfaceId": "s1", "catalogId": "conformance/composition"}}, {"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "root", "component": "Column", "children": [' + - repeat: '"item_{i}"' + separator: ", " + - "]}]}}, " + - repeat: '{"version": "v1.0", "updateComponents": {"surfaceId": "s1", "components": [{"id": "item_{i}", "component": "Text", "text": "Item number {i}"}]}}' + separator: ", " + - "]" + sizes: [1000, 4000] + max_ratio: 8 diff --git a/conformance/core/validator_v0_8.yaml b/conformance/core/validator_v0_8.yaml index 56a119acde..271e4d7614 100644 --- a/conformance/core/validator_v0_8.yaml +++ b/conformance/core/validator_v0_8.yaml @@ -476,6 +476,73 @@ text: literalString: Reachable +- name: test_v08_topology_plain_string_property_not_treated_as_child_ref + description: Tests that a plain string property whose value happens to match another component's ID does not make that component reachable in v0.8 strict mode. Text.usageHint is an enum, not a child reference, even when a component has the ID it names. + action: validate + protocolVersion: v0.8 + catalogPaths: + - specification/v0_8/json/standard_catalog_definition.json + strictMode: true + steps: + - messages: + - beginRendering: + surfaceId: s1 + root: root + - surfaceUpdate: + surfaceId: s1 + components: + - id: root + component: + Column: + children: + explicitList: [title] + - id: title + component: + Text: + text: + literalString: Heading + usageHint: h1 + - id: h1 + component: + Text: + text: + literalString: Still orphaned + expectError: + category: ValidationError + message: h1 + +- name: test_v08_topology_plain_string_property_does_not_close_cycle + description: Tests that a plain string property whose value happens to match an ancestor's ID is not read as a reference that closes a cycle in v0.8 strict mode. Here root -> h1 -> title is a tree, and title's usageHint names h1. + action: validate + protocolVersion: v0.8 + catalogPaths: + - specification/v0_8/json/standard_catalog_definition.json + strictMode: true + steps: + - messages: + - beginRendering: + surfaceId: s1 + root: root + - surfaceUpdate: + surfaceId: s1 + components: + - id: root + component: + Column: + children: + explicitList: [h1] + - id: h1 + component: + Column: + children: + explicitList: [title] + - id: title + component: + Text: + text: + literalString: Heading + usageHint: h1 + - name: test_v08_invalid_data_model_path_error description: Tests that a dataModelUpdate path with an invalid JSON Pointer escape ('~2') fails validation in v0.8. action: validate diff --git a/conformance/core/validator_v0_9.yaml b/conformance/core/validator_v0_9.yaml index 3b1bdbae48..5875acd4c7 100644 --- a/conformance/core/validator_v0_9.yaml +++ b/conformance/core/validator_v0_9.yaml @@ -1307,6 +1307,78 @@ category: ValidationError message: orphan_id +- name: test_v09_topology_component_id_array_dangling_reference_error + description: Tests that every item of an array property whose items are ComponentId is a child reference, whatever the property is called, so an item naming no component fails validation in v0.9 strict mode even when no other item names one. + action: validate + protocolVersion: v0.9 + catalog: + catalogId: custom + components: + Stack: + type: object + properties: + component: {const: Stack} + slots: + type: array + items: + $ref: "common_types.json#/$defs/ComponentId" + required: + - component + - slots + strictMode: true + steps: + - messages: + - version: v0.9 + createSurface: + surfaceId: s1 + catalogId: custom + - version: v0.9 + updateComponents: + surfaceId: s1 + components: + - id: root + component: Stack + slots: [missing_slot] + expectError: + category: ValidationError + message: missing_slot + +- name: test_v09_topology_component_id_array_child_reachable + description: Tests that a component named in an array property whose items are ComponentId is reachable from the root in v0.9 strict mode, whatever the property is called. + action: validate + protocolVersion: v0.9 + catalog: + catalogId: custom + components: + Stack: + type: object + properties: + component: {const: Stack} + slots: + type: array + items: + $ref: "common_types.json#/$defs/ComponentId" + required: + - component + - slots + strictMode: true + steps: + - messages: + - version: v0.9 + createSurface: + surfaceId: s1 + catalogId: custom + - version: v0.9 + updateComponents: + surfaceId: s1 + components: + - id: root + component: Stack + slots: [first] + - id: first + component: Stack + slots: [] + - name: test_v09_child_list_template_missing_path_error description: Tests that a ChildList template object missing its required 'path' property fails schema validation in v0.9. action: validate diff --git a/conformance/core/validator_v1_0.yaml b/conformance/core/validator_v1_0.yaml index 45adf2b9e5..58b1ee45ac 100644 --- a/conformance/core/validator_v1_0.yaml +++ b/conformance/core/validator_v1_0.yaml @@ -1425,6 +1425,80 @@ category: ValidationError message: orphan_id +- name: test_v10_topology_component_id_array_dangling_reference_error + description: Tests that every item of an array property whose items are ComponentId is a child reference, whatever the property is called, so an item naming no component fails validation in v1.0 strict mode even when no other item names one. + action: validate + protocolVersion: v1.0 + catalog: + catalogId: custom + components: + Stack: + type: object + properties: + id: {type: string} + component: {const: Stack} + slots: + type: array + items: + $ref: "common_types.json#/$defs/ComponentId" + required: + - component + - slots + strictMode: true + steps: + - messages: + - version: v1.0 + createSurface: + surfaceId: s1 + catalogId: custom + - version: v1.0 + updateComponents: + surfaceId: s1 + components: + - id: root + component: Stack + slots: [missing_slot] + expectError: + category: ValidationError + message: missing_slot + +- name: test_v10_topology_component_id_array_child_reachable + description: Tests that a component named in an array property whose items are ComponentId is reachable from the root in v1.0 strict mode, whatever the property is called. + action: validate + protocolVersion: v1.0 + catalog: + catalogId: custom + components: + Stack: + type: object + properties: + id: {type: string} + component: {const: Stack} + slots: + type: array + items: + $ref: "common_types.json#/$defs/ComponentId" + required: + - component + - slots + strictMode: true + steps: + - messages: + - version: v1.0 + createSurface: + surfaceId: s1 + catalogId: custom + - version: v1.0 + updateComponents: + surfaceId: s1 + components: + - id: root + component: Stack + slots: [first] + - id: first + component: Stack + slots: [] + - name: test_v10_child_list_template_missing_path_error description: Tests that a ChildList template object missing its required 'path' property fails schema validation in v1.0. action: validate diff --git a/conformance/test_data/catalogs/composition_catalog_v1_0.json b/conformance/test_data/catalogs/composition_catalog_v1_0.json new file mode 100644 index 0000000000..e65fcab540 --- /dev/null +++ b/conformance/test_data/catalogs/composition_catalog_v1_0.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://a2ui.org/conformance/test_data/catalogs/composition_catalog_v1_0.json", + "protocolVersion": "1.0", + "title": "Conformance Composition Catalog (v1.0)", + "description": "A two component catalog whose components declare allowedParents and allowedChildren, for the timing cases of core/message_processor_scaling.yaml.", + "catalogId": "conformance/composition", + "components": { + "Text": { + "type": "object", + "description": "Displays a run of text.", + "allowedParents": ["Column"], + "properties": { + "component": { "const": "Text" }, + "text": { "$ref": "common_types.json#/$defs/DynamicString" } + }, + "required": ["component", "text"] + }, + "Column": { + "type": "object", + "description": "A layout that stacks its children vertically.", + "allowedParents": ["Surface", "Column"], + "allowedChildren": ["Text", "Column"], + "properties": { + "component": { "const": "Column" }, + "children": { "$ref": "common_types.json#/$defs/ChildList" } + }, + "required": ["component", "children"] + } + }, + "$defs": { + "anyComponent": { + "oneOf": [ + { "$ref": "#/components/Text" }, + { "$ref": "#/components/Column" } + ], + "discriminator": { "propertyName": "component" } + } + } +} diff --git a/python/a2ui_core/tests/test_conformance.py b/python/a2ui_core/tests/test_conformance.py index b1bec867ef..7233862ea4 100644 --- a/python/a2ui_core/tests/test_conformance.py +++ b/python/a2ui_core/tests/test_conformance.py @@ -68,7 +68,16 @@ "1.0", } -SKIP_TEST_NAMES: set[str] = set() +SKIP_TEST_NAMES: set[str] = { + # The topology checks read a v0.8 string property as a child reference + # when it names a component the surface holds, and an array property whose + # items are ComponentId as a reference only when one of its items names a + # held component. #3326 reads both from the catalog alone. + "test_v08_topology_plain_string_property_not_treated_as_child_ref", + "test_v08_topology_plain_string_property_does_not_close_cycle", + "test_v09_topology_component_id_array_dangling_reference_error", + "test_v10_topology_component_id_array_dangling_reference_error", +} # Transition skip list containing specific test suite files or basenames to skip entirely. SKIP_TEST_SUITES: set[str] = set()