Skip to content

refactor(dart/a2ui_core)!: align renderer/agent names, EventSource.subscribe, and PayloadValidator APIs - #3194

Merged
gspencergoog merged 9 commits into
mainfrom
dart_core_c1_api_alignment
Oct 14, 2026
Merged

gspencergoog merged 9 commits into
mainfrom
dart_core_c1_api_alignment

Conversation

@gspencergoog

Copy link
Copy Markdown
Collaborator

Summary

Refines the a2ui_core public API surface across renderer/agent naming, event subscriptions, DataContext resolution methods, and PayloadValidator:

  • Renderer and agent naming:
    • Rename A2uiClientAction and A2uiClientError to A2uiRendererAction and A2uiRendererError.
    • Rename MessageProcessor.groupModel to MessageProcessor.model and remove the MessageProcessor.process alias for processMessages.
    • Rename DataContext.resolveSync, resolveListenable, and resolveListenableWithPending to resolveDynamicValue, resolveSignal, and resolveSignalWithPending.
    • Type DataContext.protocolVersion as A2uiProtocolVersion? and replace DataContext.isV10 with DataContext.usesDirectives.
  • Subscription-based event and data listeners:
    • Rename EventListenable<T> to EventSource<T> and replace addListener / removeListener with EventSource.subscribe(void Function(T) listener), returning a Subscription with an idempotent unsubscribe() method.
    • Add DataModel.subscribe<T>(String path, void Function(T?) onChange), returning a DataSubscription<T> that implements Subscription.
  • Validation, catalog, and conformance alignment:
    • Derive PayloadValidator rules and common_types.json definitions directly from catalog.protocolVersion, removing protocolVersion, commonTypesSchema, checkVersion, and PayloadValidator.forVersion.
    • Remove MessageProcessor.commonTypesSchema, the version parameter of MessageProcessor.validatorFor(catalog), A2uiValidationError.details, and MinimalCatalog from lib/ (moving the test catalog helper to test/support/test_catalog.dart as TestCatalog).
    • Raise A2uiIntegrityError (INTEGRITY_ERROR) instead of A2uiRecursionError (RECURSION_ERROR) on self-referential and cyclic component references, reserving A2uiRecursionError for exceeding maxDepth or maxFunctionCallDepth.
    • Enforce UAX 31 identifier syntax on createSurface.metadata.extensions keys when parsing CreateSurfaceMessage.
    • Preserve FunctionApi.description in BasicCatalog and a2ui_agent payload validation, localize common_types.json#/$defs/... references inside function argument schemas when building Catalog.catalogSchema, and enforce import isolation for lib/src/basic_catalog/.
    • Align the a2ui_core conformance test runners (validator_conformance_test.dart, message_processor_conformance_test.dart, expressions_conformance_test.dart, multi_catalog_conformance_test.dart) with validate step routing, catalog_schema fixture loading, node resolution, and template-expanded ComponentNode indexing.

Testing

  • dart analyze --fatal-infos across dart/a2ui_core, dart/a2ui_agent, dart/a2ui_agent/e2e_test, and dart/a2ui_cli
  • dart test across dart/a2ui_core (1,595 tests), dart/a2ui_agent (510 tests), and dart/a2ui_cli (31 tests)

🤖 Agent-generated

… skip unsubscribed listeners in EventNotifier.emit
…ignment

# Conflicts:
#	dart/a2ui_agent/CHANGELOG.md
#	dart/a2ui_core/CHANGELOG.md
#	dart/a2ui_core/lib/src/basic_catalog/basic_catalog.dart
#	dart/a2ui_core/lib/src/basic_catalog/function_support.dart
#	dart/a2ui_core/lib/src/core/catalog.dart
#	dart/a2ui_core/lib/src/validation/validator.dart
#	dart/a2ui_core/test/basic_catalog_test.dart
…ion keys, rename MinimalCatalog to TestCatalog

@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 introduces several breaking changes to align MessageProcessor and PayloadValidator usage with a2ui_core, including renaming A2uiClientAction/A2uiClientError to A2uiRendererAction/A2uiRendererError, renaming MessageProcessor.groupModel to MessageProcessor.model, and replacing EventListenable with EventSource and Subscription-based event handling. Feedback on these changes highlights a potential bug in EventNotifier when unsubscribing duplicate listeners, a type-checking issue with generic maps in MessageReader, and an inconsistency in fallback protocol versions between RpcHandler and ComponentContext.

…ns, RPC version fallback, and catalog combinators
@gspencergoog
gspencergoog requested a review from nan-yu October 14, 2026 15:02
…yped signals, and make subscribeDynamicValue generic
…ignment

# Conflicts:
#	dart/a2ui_core/CHANGELOG.md
#	dart/a2ui_core/lib/src/core/contexts.dart
#	dart/a2ui_core/lib/src/processing/processor.dart
#	dart/a2ui_core/lib/src/rendering/binder.dart
#	dart/a2ui_core/lib/src/validation/validator.dart
#	dart/a2ui_core/test/conformance/catalog_schema_conformance_test.dart
#	dart/a2ui_core/test/conformance/message_processor_conformance_test.dart
#	dart/a2ui_core/test/contexts_test.dart
#	dart/a2ui_core/test/processor_test.dart
#	dart/a2ui_core/test/validator_test.dart
@gspencergoog
gspencergoog merged commit ca43793 into main Oct 14, 2026
36 checks passed
@gspencergoog
gspencergoog deleted the dart_core_c1_api_alignment branch October 14, 2026 19:30
@github-project-automation github-project-automation Bot moved this from Todo to Done in A2UI Oct 14, 2026
andrewkolos added a commit that referenced this pull request Oct 14, 2026
…r-basic-catalog

Main now has the adapter core (#3084, squash-merged) and a2ui_core's
generated basic catalogs (#2998, #3129) and renderer renames (#3194).

- Drop this branch's a2ui_core change, BasicCatalog.v0_9Api(): main's
  BasicCatalog.v0_9() now carries the components, so the basic catalog
  reads its schemas from there.
- Pass the catalog's shared definitions along with its components. The
  generated component schemas reference #/$defs/CatalogComponentCommon,
  which a catalog without them cannot resolve. The README's custom
  catalog sample needs the same line.
- Adopt the #3194 renames in write_back.dart, the test harness and the
  README.
- Read Icon.name from the allOf envelope in icon_test.

⚠️ Agent-generated
nan-yu pushed a commit that referenced this pull request Oct 14, 2026
* 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
andrewkolos added a commit that referenced this pull request Oct 15, 2026
* 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
andrewkolos added a commit that referenced this pull request Oct 18, 2026
#3194 renamed A2uiClientError to A2uiRendererError and
MessageProcessor.groupModel to model, and replaced EventSource.addListener
with subscribe, so the gallery no longer analyzed against main.

The demo catalog also passes the basic catalog's definitions, which the
generated component schemas reference as #/$defs/CatalogComponentCommon.
Without them every example failed to resolve its schemas and rendered
nothing.

⚠️ Agent-generated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants