Repository navigation
feat(dart/a2ui_core): complete v1.0 conformance, module layout, and 0.3.0 release - #3192
Conversation
37f66c1 to
d4da303
Compare
4a547a5 to
9cf856b
Compare
9cf856b to
86eadc1
Compare
… catalog function name checks
86eadc1 to
b80bb5e
Compare
nan-yu
left a comment
There was a problem hiding this comment.
Thanks for addressing all the comments. Approving, with two minor follow-ups (one inline):
@-prefixed parameter names now differ between SDKs. Because isValidUax31Identifier / is_valid_uax31_identifier no longer strip a leading @, TypeScript and Python reject a catalog function parameter such as '@offset' (Invalid UAX #31 argument identifier: '@offset' in function 'f'). Dart still checks argument names with allowLeadingAt: true (dart/a2ui_core/lib/src/core/catalog.dart:760-765), so the same catalog loads in Dart. Function names already agree, since Dart rejects @ names separately. Rejecting looks consistent with @ being reserved for system functions. If we go that way, we'd drop allowLeadingAt: true for arguments in Dart and add a shared case to conformance/core/catalog.yaml, e.g. a function with an @offset parameter → CatalogError.
- Collect function argument subschemas recursively, resolving local document references (`#/`) and recursing into `allOf`. - Merge required fields and property shapes across all collected subschemas. - Fall back to passthrough validation if a referenced schema cannot be resolved or contains open combiners (`anyOf`, `oneOf`). - Check UAX #31 parameter names across referenced definitions under `rootDoc`. - Add test coverage in schema_loader.test.ts and payload-validator.test.ts.
…se URL - Update a2ui_core dependency constraint to ^0.3.0. - Update a2ui_flutter tests to use A2uiRendererAction, A2uiRendererError, EventSource.subscribe, and MessageProcessor.model. - Change Apache 2.0 license URLs in dart/a2ui_flutter/LICENSE to http to pass license checks.
# Conflicts: # dart/a2ui_flutter/test/a2ui_surface_test.dart # dart/a2ui_flutter/test/node_view_test.dart # dart/a2ui_flutter/test/support/surface_harness.dart
# Conflicts: # dart/a2ui_agent/CHANGELOG.md
…bspec The package now depends on a2ui_core ^0.3.0 (#3192), but the install sample still showed ^0.2.2.⚠️ Agent-generated
* feat(a2ui_flutter): add the framework adapter core A2uiSurface renders a SurfaceModel through a NodeResolver, and NodeView renders each ComponentNode through its catalog entry, rebuilding when the node's props change. ComponentImplementation pairs a component schema with a widget builder, WidgetCatalog is a catalog of them, and ComponentProps reads a node's resolved properties, bindings and actions. A component that has not arrived shows a small progress indicator. * feat(a2ui_core): expose the v0.9 basic catalog's API BasicCatalog.v0_9Api() returns the published v0.9 basic catalog document parsed with Catalog.fromJson: its components, function signatures and theme schema, so a framework adapter can read the component schemas without embedding its own copy of the document. * feat(a2ui_flutter): add the v0.9 basic catalog package:a2ui_flutter/basic_catalog.dart implements the 18 components of the v0.9 basic catalog with Material widgets, with their schemas from a2ui_core's BasicCatalog.v0_9Api() and the functions of BasicCatalog.v0_9(). basicCatalog() builds the whole catalog under the basic catalog's id; BasicComponents holds each component for a catalog of the app's own. The components apply the surface theme's primaryColor as the primary color, and every specification example renders in a test. * fix(a2ui_flutter): key a node's subtree by its implementation A component whose catalogId changes is recreated with the same instance id, like one whose type changes. Keying the subtree by the type name kept the old implementation's state when only the catalog changed. Keying by the resolved implementation resets it in both cases. * test(a2ui_flutter): cover A2uiSurface.of and maybeOf * fix(a2ui_flutter): forward the basic catalog's protocol version and instructions * refactor(a2ui_flutter): rename WidgetCatalog to CatalogImplementation Pairs it with CatalogApi in a2ui_core, as ComponentImplementation and FunctionImplementation pair with ComponentApi and FunctionApi. 🤖 Agent-generated * refactor(a2ui_flutter): use CatalogImplementation in the basic catalog 🤖 Agent-generated * feat(a2ui_flutter): apply a component's accessibility label and description NodeView wraps every resolved component in a Semantics that carries the component's accessibility label as its label and its description as its hint, so basic and custom components both get them. Without either attribute the Semantics adds no node, and it stays in the tree so that adding one later keeps the component's state. 🤖 Agent-generated * fix(a2ui_flutter): adopt a2ui_core's renderer renames #3194 renamed A2uiClientAction and A2uiClientError to A2uiRendererAction and A2uiRendererError, MessageProcessor.groupModel to model and getClientDataModel to getRendererDataModel, and replaced EventSource.addListener with subscribe. The adapter's tests and README still used the old names, so the package's tests no longer compiled on main.⚠️ Agent-generated * fix(a2ui_flutter): use the http Apache license URL #3205 standardized LICENSE files on http://www.apache.org/licenses/ and made the license check enforce it. a2ui_flutter's LICENSE, added in #3084, used https, so the static-checks job fails on main.⚠️ Agent-generated * docs(a2ui_flutter): match the README's a2ui_core constraint to the pubspec The package now depends on a2ui_core ^0.3.0 (#3192), but the install sample still showed ^0.2.2.⚠️ Agent-generated * docs(a2ui_flutter): drop accessibility from the README's unsupported list NodeView applies a component's accessibility label and description, the two attributes v0.9 defines, since effca52.⚠️ Agent-generated
Prepares the first publish of a2ui_core since 0.2.2 and of a2ui_agent since 0.0.1-wip004. Neither 0.3.0 nor 0.0.1-wip005 reached pub.dev when their pubspecs were bumped (a2ui-project#3192, a2ui-project#2890), so this folds each package's `## Unreleased` section into that version's section instead of opening a third one. While folding, the entries were checked against lib/ and corrected: - a2ui_core: `PayloadValidator.protocolVersion`, `commonTypesSchema`, `checkVersion`, `forVersion` and `MessageProcessor.commonTypesSchema` were described as removed but still exist. `DataContext.isV10`, `A2uiCompileError`, `Catalog.protocolVersion` as a `String?` and the flattened `ComponentApi.schema` were never in a published version, so they are described in their final form rather than as renames or removals. `DataContext.dispose` does not exist. The new `intl` and `logging` dependencies are listed. Notes about tests and tooling are dropped and overlong lines are wrapped. - a2ui_agent: payload checks go through `MessageProcessor.forAgent`, not `Catalog.withFunctions`. Entries that revised unpublished wip005 entries are merged into them, including the v1.0 entries from a2ui-project#3242. No code changes. The versions in pubspec.yaml were already set.
## Why `a2ui_core` is `0.3.0` on `main`, but pub.dev still has `0.2.2`: the version bump in #3192 was never followed by a publish, and later PRs stacked a new `## Unreleased` section on top. This PR is the release PR described in [docs/contributing/release.md](https://github.com/a2ui-project/a2ui/blob/main/docs/contributing/release.md#pubdev-publishing-steps): it folds `## Unreleased` into `## 0.3.0`, the version that will actually ship, so the changelog has one section per published version. Relative to the published 0.2.2, 0.3.0 is a minor bump that covers the breaking renames (`A2uiClientAction` to `A2uiRendererAction`, `EventListenable.addListener` to `EventSource.subscribe`, `MessageProcessor.groupModel` to `model`, `DataPath` and `MinimalCatalog` removed, and so on). `a2ui_agent` is not part of this release: its `-wip` versions are published only by exception, when someone needs to try the package outside the repo, so its changelog is left as it is on `main`. ## What changed While folding, each entry was checked against `lib/`, and the ones that did not match were corrected: - `PayloadValidator.protocolVersion`, `commonTypesSchema`, `checkVersion`, `PayloadValidator.forVersion`, `MessageProcessor.commonTypesSchema` and the `version` parameter of `validatorFor` were described as removed. They all still exist; the entry now lists only `A2uiValidationError.details` and `MinimalCatalog` as removed, and mentions `PayloadValidator.commonTypesFor`. - `DataContext.isV10`, `A2uiCompileError`, `Catalog.protocolVersion` as a `String?`, `ComponentNode.props` before `ResolvedBinding`, and the flattened `ComponentApi.schema` were never in a published version. They are described once, in their final form, instead of as renames, removals or breaking changes; two entries that contradicted each other (`isV10` to `usesDirectives` vs. `atLeastV10`; `allOf` flattened vs. kept as written; `dispatchAction` emitting only `event` vs. `event` and `name`) are resolved in favor of what the code does. - `DataContext.dispose` does not exist and is no longer mentioned; `resolveListenableWithPending` was not in 0.2.2, so `resolveSignalWithPending` is listed as added. - The new `package:intl` and `package:logging` dependencies get an entry. - Three duplicate additions of `Catalog.protocolVersion` are merged into one. - Notes about tests, conformance runners, a private `_subscribe` helper and `tool/generate_basic_catalogs.dart` are dropped, and single-line bullets of up to 1689 characters are wrapped. No code changes. The version in `pubspec.yaml` was already set. ## Testing - `dart pub publish --dry-run` in `dart/a2ui_core`: 0 warnings. - `yarn dlx [email protected] --config .prettierrc --check dart/a2ui_core/CHANGELOG.md` passes. - Every symbol named in the corrected entries was located in `dart/a2ui_core/lib`.
Summary
Completes v0.9 and v1.0 conformance and module layout alignment for
dart/a2ui_core. Synchronizes reserved@-prefix function rules across TypeScript, Python, and Dart. Resolves parameter$refschemas in TypeScriptweb_coreand bumpsa2ui_coreto0.3.0.Reviewer Focus
typescript/core/web_core/src/catalog/schema_loader.ts, parameter schemas resolve local$refpointers and unwrapallOfcompositions. Unresolvable schemas fall back to permissive validation.uax31modules enforce UAX 31 without stripping leading@characters. This reserves@for system functions like@index.schema_loader.tsandcatalog.pyreject@-prefixed function names. They also guard shorthand parameter detection against JSON Schema keywords and combiners.DataContextandComponentContextmove tolib/src/resolution/, keepingcreateSurfaceDataContextinternal.Changes
Cross-SDK Function and Identifier Validation
allowLeadingAtflag (defaultfalse) toisValidUax31Identifierin TypeScript andis_valid_uax31_identifierin Python.Catalog.fromJsonin TypeScript andCatalog.from_jsonin Python to reject@-prefixed function names withA2uiCatalogError.$ref,allOf,oneOf,anyOf, ornot.convertFunctionArgsJsonSchemaToZodinweb_coreto recursively resolve local#/$defs/pointers and unwrapallOfcompositions. Validation falls back topassthrough()for open combiners.PayloadValidatorin TypeScript and Python to permit@indexsystem function calls while checking user function names against UAX 31.Conformance and Example Fixtures
content-gridtocontent_gridincatalogs/basic/v1/examples/31_incremental-dashboard.json.Buttoncomponents inmessage_processor_v1_0.yamltest cases, updating IDs totext1andtext_childfor text tests.test_v10_catalog_from_json_uax31_validationincatalog.yaml. Added cases verifying rejection of@-prefixed function names incatalog.yamlandreserved_keys.yaml.dart/a2ui_core/test/conformance/. All non-v0.8 suites pass.Dart Core Module Layout and Exports
lib/src/processing/expressions.darttolib/src/expressions/expression_parser.dart.lib/src/rendering/binder.darttolib/src/resolution/generic_binder.dartand removedlib/src/rendering/.lib/src/core/contexts.dartintolib/src/resolution/data_context.dartandlib/src/resolution/component_context.dart.FormatStringFunctiontolib/src/basic_catalog/basic_catalog.dartand removedlib/src/processing/basic_functions.dart.GenericBinder,Behavior,BehaviorNode,ExpressionParser,FormatStringFunction,resolveSchemaRefs, andinlineLocalRefsfromlib/a2ui_core.dart.Documentation, Blueprints, and Versioning
blueprints/codebases/dart/a2ui_core/codebase.blueprint.mdtracking compliance against the core module blueprint.dart/a2ui_core/README.mdwith updated examples for v1.0 syntax, signal subscriptions, and renderer event patterns.dart/a2ui_coreto0.3.0and updated dependent packages (a2ui_agent,a2ui_cli, anda2ui_flutter) to depend on^0.3.0.Impact & Risks
isValidUax31Identifierandis_valid_uax31_identifierreject leading@characters unless explicitly allowed.Catalog.fromJsonandCatalog.from_jsonreject@-prefixed function names.$refpointers. Calls omitting required fields or supplying unexpected properties in strict mode fail validation.a2ui_core0.3.0: Internallib/src/file paths were reorganized. All supported public APIs are exported frompackage:a2ui_core/a2ui_core.dart.Testing
Run Dart analysis, tests, doc link validation, and dry-run publishing:
Run dependent Dart package tests:
Run TypeScript
@a2ui/web_corebuild, unit tests, and conformance suite:yarn workspace @a2ui/web_core build yarn workspace @a2ui/web_core test node typescript/core/web_core/tests/conformance/conformance_test.mjsRun Python
a2ui_coreunit and conformance tests:🤖 Agent-generated