Repository navigation
fix(python/core,agent): treat custom checks/accessibility params as props - #4529
Open
jacobsimionato wants to merge 1 commit into
Open
jacobsimionato wants to merge 1 commit into
jacobsimionato wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request resolves an issue where declared accessibility and required or optional checks macro parameters collided with v1.0 envelope mixins. It updates the schema helper and catalog validation logic to treat bare accessibility properties without an inlined id and required bare checks properties as custom component properties rather than standard mixins. Additionally, the macro expander has been updated to handle cases where checks are consumed by macro parameters, and comprehensive end-to-end tests have been added. There are no review comments, so no further feedback is provided.
jacobsimionato
force-pushed
the
macros/2-checks-a11y-params
branch
from
December 3, 2026 12:04
1038deb to
6dd00f1
Compare
jacobsimionato
marked this pull request as ready for review
December 3, 2026 12:04
…s from mixins Signed-off-by: Jacob Simionato <jsimionato@google.com>
jacobsimionato
force-pushed
the
macros/2-checks-a11y-params
branch
from
December 3, 2026 12:24
6dd00f1 to
6da8db3
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: 6/11 (overview) · previous: #4528 · next: #4562
Reviewer guide: A2UI Python macros: reviewer guide explains how the whole stack fits together.
Problem
In v1.0, every component can carry envelope fields:
@checks(validation rules),@accessibility(screen-reader labels),@metadata, and@catalogId. They come from two shared schema mixins:ComponentCommon(id,accessibility,metadata,catalogId) andCheckable(checks). Components and macros (Python functions that expand into A2UI components server-side) may also declare their own parameter with the bare name, meaning the name without the@prefix, such aschecksoraccessibility. The Python SDK confused the two: a declaredaccessibility, or a requiredchecks, was taken for the envelope field and dropped or moved. So a macro such asFormCard(label: str, checks: Sequence[CheckRule])(CheckRuleis one{condition, message}validation rule) could not be called correctly from A2UI Express or Direct JSON (the SDK's LLM output formats).metadataandcatalogIdgo through the same classification, so the fix covers all four names.After this PR, this Express call compiles, expands, and passes strict validation, with the rule landing as
@checkson the macro's innerTextField:Summary
a2ui-coreuses one rule to decide whether a bare envelope-named property is the standard field or the component's own prop (table below).requiredlists are followed throughallOfand local$refs.CatalogSchemaHelperin the agent SDK drops its own copy of this rule and calls the core functions, so inference formats andPayloadValidatoragree.?check(...)results into a component's ownchecksproperty when that property is aCheckRulearray.MacroExpanderbinds a v1.0@checksarray to an optionalchecks: Sequence[CheckRule]macro parameter when barechecksis omitted, and does not also copy it onto the expanded root.idin the samepropertiesblock?accessibility,metadata,catalogIdaccessibility,metadata,catalogIdchecksCheckableor aCheckRulearray, else custom@-prefixed keys stay standard when their shape matches. Neither mixin marks these keys as required, which is why "required" means custom.Breaking changes: None for the standard catalogs. Python SDK users with custom catalogs see different results where a schema marks one of these four names as required, or declares a bare
accessibility,metadata, orcatalogIdwithout an inlinedid: those are now custom props. BothCHANGELOG.mdfiles note this.New and changed API
is_component_checkableandget_custom_envelope_properties(already public ina2ui.core.catalog) now follow the table above.?check(...)on a component whose ownchecksdoes not takeCheckRuleitems raisesExpressValidationError("Component 'X' declares a 'checks' property that does not take CheckRule checks, so it cannot take ?check(...)."). Giving checks both ways raisesExpressDuplicatePropertyErrorforchecks.Where to review
Start here:
python/a2ui_core/src/a2ui/core/catalog/catalog.py:_is_standard_mixin_property_schemaand_collect_conjunctive_required. Verify that v0.9 and v1.0 standard components are still checkable.python/a2ui_agent/src/a2ui/utils/_schema_helper.py: verify nothing relied on the removed local checks (including thecatalogIddescription match).python/a2ui_agent/src/a2ui/inference_formats/express/compiler.py: verify which key gets compiled checks (checksor@checks) and when a customcheckskeeps its positional slot.python/a2ui_agent/src/a2ui/transformers/macros/expander.py: verify@checksis bound only for an optional, exactlySequence[CheckRule]parameter.Implementation details
_declared_property_blocksand_schema_references_checkablenow yield or pass(properties, required)pairs and use immutablefrozensetvisited sets, so a$defvisited in oneanyOf/oneOfbranch is still followed in a sibling branch.Catalog._flatten_validation_componentsgathersrequiredfrom all pieces and passesis_requiredto the mixin check.CatalogSchemaHelper.has_custom_check_rules(name)(internal) reports a custom barechecksproperty whose items areCheckRule. Express uses it to decide whether a customcheckskeeps its positional slot (it does not when?check(...)fills it) and which key receives compiled checks.processor._is_standard_check_rule_sequence_typeaccepts exactlySequence[CheckRule](optionally| None, throughAnnotatedand type aliases). Unions with other types stay custom, matching schema synthesis.checks_consumed_by_paramflag, and the macrosREADME.mddocuments this exception.Verification
Measured at the stack tip (all 11 commits applied):
This PR adds
test_custom_accessibility_and_required_checks_without_inline_idandtest_get_custom_envelope_properties_scopes_visited_defs_per_branch(python/a2ui_core/tests/test_catalog.py),test_inline_id_and_required_checks_parity_with_core(python/a2ui_agent/tests/test_catalog_schema_helper.py), andtest_v10_macros_declaring_checks_and_accessibility_work_in_express_and_direct_json(python/a2ui_agent/tests/test_macros.py).