Skip to content

feat(conformance): convert express compiler tests to conformance tests (#2684) - #2685

Open
jacobsimionato wants to merge 4 commits into
a2ui-project:mainfrom
jacobsimionato:fix-issue-2684
Open

jacobsimionato wants to merge 4 commits into
a2ui-project:mainfrom
jacobsimionato:fix-issue-2684

Conversation

@jacobsimionato

@jacobsimionato jacobsimionato commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

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 Schema: Added conformance/inference_formats/inference_format_schema.json supporting compile, decompile, round_trip, and generate_prompt actions with inlined or file-based inputs and expected outputs, as well as ExpectError negative test verification.
  • Format-Independent Round-Trip Suite: Added conformance/inference_formats/round_trip.yaml covering catalog examples and dynamic data model/component compositions across decompile -> compile cycles.
  • Express Test Suites:
    • 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 .a2ui examples mapped against their JSON counterparts.
  • Schema Validation: Updated conformance/tests/test_conformance_yaml.py to validate conformance/inference_formats/**/*.yaml against inference_format_schema.json.
  • Python SDK Test Harness: Implemented agent_sdks/python/a2ui_agent/tests/conformance/test_inference_formats_conformance.py which executes all inference format conformance test cases.
  • Test Streamlining: Removed redundant programmatic tests from test_compiler.py, test_integration.py, test_parser_decompile.py, and removed test_version_compliance.py, keeping only Python-specific unit and concurrency tests.
  • Documentation: Updated conformance/README.md with descriptions and usage instructions for the new inference format test suites.

Addressed Review Feedback

  • Feedback Item 1: Updated normalize_value in test_inference_formats_conformance.py to construct and return a new dictionary rather than mutating the input dictionary in-place.
  • Feedback Items 2 & 3: Retained standard validation checks per review consensus, ensuring malformed payloads without required dictionary structures fail as intended.
  • Feedback Item 4: Renamed conformance/inference_formats/express/examples.yaml to specification_examples.yaml and updated all test suite references and conformance/README.md.
  • Feedback Item 5: Removed historical migration comments/placeholders from test_integration.py, test_compiler.py, and test_parser_decompile.py.
  • Feedback Item 6: Retained remaining tests in test_integration.py as they verify Python SDK-specific API surface (ExpressParser.parse_response, ParsedPart objects, streaming unclosed <a2ui> tags, and A2uiCompilationError exception structures).
  • Upstream Sync: Synced branch with upstream/main, resolved merge conflicts in test_compiler.py and test_parser_decompile.py, and updated test harness exception mappings to align with the new A2uiCompilationError hierarchy.

Verification & Testing

  • Validated all YAML test files against schemas:
    ./bin/pytest conformance/tests/test_conformance_yaml.py (30/30 passed).
  • Ran the new Python conformance test harness:
    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).
  • Ran all Express unit and parser tests:
    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).
  • Ran standard conformance suite:
    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

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

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.

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.

Comment thread conformance/inference_formats/express/specification_examples.yaml
Comment thread agent_sdks/python/a2ui_agent/tests/express/test_integration.py Outdated
Comment thread agent_sdks/python/a2ui_agent/tests/express/test_integration.py
@jacobsimionato jacobsimionato added coding-agent-working An issue that is currently being fixed by a coding agent. and removed coding-agent-ready labels Sep 22, 2026
@jacobsimionato jacobsimionato added coding-agent-ready coding-agent-working An issue that is currently being fixed by a coding agent. and removed coding-agent-working An issue that is currently being fixed by a coding agent. coding-agent-ready labels Sep 22, 2026
# Conflicts:
#	agent_sdks/python/a2ui_agent/tests/express/test_compiler.py
#	agent_sdks/python/a2ui_agent/tests/express/test_parser_decompile.py
@jacobsimionato

Copy link
Copy Markdown
Collaborator Author

Synced with upstream/main, resolved conflicts in test_compiler.py and test_parser_decompile.py, aligned exceptions with the new A2uiCompilationError hierarchy, verified all local tests pass, and pushed updates.

@jacobsimionato jacobsimionato removed the coding-agent-working An issue that is currently being fixed by a coding agent. label Sep 22, 2026
@jacobsimionato

Copy link
Copy Markdown
Collaborator Author

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.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Convert A2UI express compiler tests to conformance tests

1 participant