feat(conformance): convert express compiler tests to conformance tests (#2684) - #2685
jacobsimionato wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates various Express compiler, parser, and integration tests into language-agnostic YAML conformance test suites under conformance/inference_formats/, and introduces a new Python conformance test harness (test_inference_formats_conformance.py) to run them. The feedback highlights potential runtime issues in the test harness: first, the normalize_value helper mutates input dictionaries in-place, which can cause unexpected side-effects across tests; second, defensive checks are needed when calling .get() on keys that might explicitly map to None (such as updateDataModel or createSurface) to prevent AttributeError crashes.
# Conflicts: # agent_sdks/python/a2ui_agent/tests/express/test_compiler.py # agent_sdks/python/a2ui_agent/tests/express/test_parser_decompile.py
|
Synced with |
|
One more comment: I think the inference format conformance test YAML etc should be within the agent/ subfolder which I think already exists. So something like conformance/agent/inference_formats etc. |
Summary & Rationale
Converted the A2UI Express compiler, decompiler, round-trip, and prompt generation tests from programmatic Python-specific unit tests into platform-agnostic conformance test suites. This enables future non-Python implementations (such as TypeScript or Kotlin) to achieve full behavioral and semantic parity against a shared specification.
Key Changes
conformance/inference_formats/inference_format_schema.jsonsupportingcompile,decompile,round_trip, andgenerate_promptactions with inlined or file-based inputs and expected outputs, as well asExpectErrornegative test verification.conformance/inference_formats/round_trip.yamlcovering catalog examples and dynamic data model/component compositions across decompile -> compile cycles.conformance/inference_formats/express/compile.yaml: 30+ test cases covering basic components, data bindings, checks, format strings, actions, standalone functions, templates, surface directives, version targets (v0.9,v0.9.1,v1.0), and negative error scenarios.conformance/inference_formats/express/decompile.yaml: Decompilation tests for RPC functions, local actions, functional expressions, custom checks, surface directives, update data model, and update components.conformance/inference_formats/express/prompt_generation.yaml: Prompt generation test cases for rules, component signatures, pruning, custom rules, and examples transformation.conformance/inference_formats/express/specification_examples.yaml: Conformance tests for all 36 human-authored.a2uiexamples mapped against their JSON counterparts.conformance/tests/test_conformance_yaml.pyto validateconformance/inference_formats/**/*.yamlagainstinference_format_schema.json.agent_sdks/python/a2ui_agent/tests/conformance/test_inference_formats_conformance.pywhich executes all inference format conformance test cases.test_compiler.py,test_integration.py,test_parser_decompile.py, and removedtest_version_compliance.py, keeping only Python-specific unit and concurrency tests.conformance/README.mdwith descriptions and usage instructions for the new inference format test suites.Addressed Review Feedback
normalize_valueintest_inference_formats_conformance.pyto construct and return a new dictionary rather than mutating the input dictionary in-place.conformance/inference_formats/express/examples.yamltospecification_examples.yamland updated all test suite references andconformance/README.md.test_integration.py,test_compiler.py, andtest_parser_decompile.py.test_integration.pyas they verify Python SDK-specific API surface (ExpressParser.parse_response,ParsedPartobjects, streaming unclosed<a2ui>tags, andA2uiCompilationErrorexception structures).upstream/main, resolved merge conflicts intest_compiler.pyandtest_parser_decompile.py, and updated test harness exception mappings to align with the newA2uiCompilationErrorhierarchy.Verification & Testing
./bin/pytest conformance/tests/test_conformance_yaml.py(30/30 passed).PYTHONPATH="agent_sdks/python/a2ui_core/src:agent_sdks/python/a2ui_agent/src" ./bin/pytest agent_sdks/python/a2ui_agent/tests/conformance/test_inference_formats_conformance.py(99/99 passed).PYTHONPATH="agent_sdks/python/a2ui_core/src:agent_sdks/python/a2ui_agent/src" ./bin/pytest agent_sdks/python/a2ui_agent/tests/express/(57/57 passed).PYTHONPATH="agent_sdks/python/a2ui_core/src:agent_sdks/python/a2ui_agent/src" ./bin/pytest agent_sdks/python/a2ui_agent/tests/conformance/test_conformance.py(254 passed, 31 xfailed).Closes #2684
TAG=agy
CONV=758b56c3-d6dc-4dc6-96b5-1a0dfa903bac