Repository navigation
fix(web_core): accept @ mixin keys as property names in Catalog.fromJson - #4558
Open
gspencergoog wants to merge 2 commits into
Open
gspencergoog wants to merge 2 commits into
gspencergoog wants to merge 2 commits into
Conversation
A flattened v1.0 validation schema declares the component envelope mixins (checks, accessibility, metadata, and catalogId, under their @-prefixed wire names) in a component's properties. parseCatalogComponents() ran the UAX 31 identifier check on those keys, so Catalog.fromJson(catalog.validationSchema, '1.0') threw A2uiCatalogError. Skip the four mixin keys before the identifier check, as Python and Dart core already do. Two shared conformance cases pin the rule: the four keys load, and any other @-prefixed name is still rejected. They showed that a2ui lint in dart/a2ui_cli and the Swift conformance harness had their own copies of the check without the exemption, so both get it too. Fixes a2ui-project#4555
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the catalog validation logic across Dart, Swift, and TypeScript implementations to allow the @-prefixed component envelope mixin keys (@CatalogId, @metadata, @accessibility, and @Checks) to be declared as component properties in v1.0 catalogs. This ensures that flattened validation schemas, which declare these mixins as properties under their wire names, can be successfully loaded and validated without failing UAX #31 identifier checks. Corresponding tests and changelog entries have been added. I have no feedback to provide as there are no review comments.
gspencergoog
marked this pull request as ready for review
December 3, 2026 17:27
josemontespg
approved these changes
Dec 3, 2026
josemontespg
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Thanks for the quick fix!
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.
Architecture & Contract Brief
@a2ui/web_core,parseCatalogComponents()runs the v1.0 identifier check on every key under a component'sproperties. A flattened validation schema declares the envelope mixins there under their wire names (@checks,@accessibility,@metadata,@catalogId), which are not UAX 31 identifiers, soCatalog.fromJson(catalog.validationSchema, '1.0')threwA2uiCatalogError.Catalog.fromJson()anda2ui lintaccept documents they used to reject, and reject nothing new. Exactly those four names are exempt, by name. No exported symbol, schema, or specification text changes.Catalog.from_jsonand DartCatalog.fromJsonalready do. One consequence needs your decision and is described under Impact & Risks:PayloadValidatorvalidates a declared@accessibilityor@checksagainst the schema the catalog declares.Fixes #4555
Summary
Let
Catalog.fromJson()in@a2ui/web_coreload a v1.0 catalog document that declares the@-prefixed envelope mixin keys as component properties, which is whatCatalog.validationSchemaproduces. The same exemption is applied to the two other copies of the property-name check that lacked it:a2ui lintindart/a2ui_cliand the Swift conformance harness.Reviewer Focus
typescript/core/web_core/src/catalog/schema_loader.ts: the one-line skip inparseCatalogComponents(). Only the identifier check changes. The conversion and mixin-layout code after it already treats these keys as the standard mixins.swift/core/Tests/A2UIConformanceTests/CatalogConformanceTests.swift: test-only code that was not compiled locally (see the brief above).conformance/core/catalog.yaml: the accepting case uses minimal typed schemas for the four keys, so it checks the name rule and nothing about the mixins' shapes.Changes
schema_loader.ts: skip keys inAT_COMPONENT_MIXIN_KEYSbeforeassertUax31Identifier()in thepropertiesloop ofparseCatalogComponents(). Any other@name is still rejected.schema_loader.test.ts: a test that reloads the v1 basic catalog'svalidationSchemawithCatalog.fromJson()and compares the reloaded catalog'svalidationSchemawith the original.conformance/core/catalog.yaml:test_v10_uax31_standard_mixin_property_names_allowed(a component declaring the four keys loads) andtest_v10_uax31_other_at_property_name_rejected(@customfails withCatalogError), both taggedF-CORE-09.dart/a2ui_cli/lib/src/analyzer/catalog_lint.dart: the v1.0 property-name lint skips the same four keys. The package's parity test compareslintCatalog()withCatalog.fromJsonfor everyfrom_jsonconformance case and failed on the new accepting case.CatalogConformanceTests.swift: the harness's own property-name check skips the same four keys. Swift product code has no catalog identifier check.CHANGELOG.mdentries for@a2ui/web_coreanda2ui_cli.Impact & Risks
@checks,@accessibility,@metadata, or@catalogIdand load inweb_core. That was already true in Python and Dart, and forweb_corecatalogs defined in code.@accessibilityor@checks,PayloadValidatorinweb_corevalidates the value against the declared schema, not against the standardAccessibilityAttributesorCheckRuleschema. This is existing behavior for catalogs defined in code, and this PR makes it reachable from a JSON catalog. For example, a JSON catalog that declares"@accessibility": {"type": "boolean"}now loads, accepts"@accessibility": true, and rejects{"label": "L"}. Before this PR that catalog failed to load. Python rejectstruefor the same catalog, because its validator always applies the standard schemas. A schema produced byCatalog.validationSchemadeclares the standard shapes, so it is not affected. This PR does not changePayloadValidator.@catalogIdand@metadataare still checked against the standard rules.@a2ui/embed/mcp/expressin the open PR feat(embed): add @a2ui/embed/mcp/express for host-authored Express #4504 carries a workaround for this issue. This PR does not touch it.Testing
web_core, before the loader fix:node --test dist/src/catalog/schema_loader.test.jsfailed the new test withInvalid UAX #31 property identifier: '@checks' in component 'Button', andnode tests/conformance/conformance_test.mjsreported 853 of 854 with the accepting case failing.web_core, after: the unit file passes 32 of 32, the conformance runner 854 of 854, andyarn workspace @a2ui/web_core testpasses 1709 tests.yarn workspace @a2ui/web_core lintreports 0 errors.uv run pytest python/a2ui_core/tests/test_conformance.py -qpasses (862 passed), with no Python change.dart test test/conformanceindart/a2ui_corepasses (875 passed), with no change toa2ui_core.dart test test/lint_command_test.dartfailed the parity test for the accepting case with fourinvalid_identifierfindings. After it,dart testpasses (115 passed) anddart analyzereports no issues.swift format lint --strictand a syntax-only parse pass on the edited file. The test target was not built or run locally.uv run --project conformance python conformance/scripts/check_feature_coverage.py --staticreports 0 findings. Prettier 3.8.4 and./scripts/fix_licenses.py --checkpass.Pre-launch Checklist
One time:
For this PR: