From 299cc9917650f6d621746058353cce667bf152ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20L=C3=B3pez?= <63005462+diegolopezrm@users.noreply.github.com> Date: Wed, 2 Sep 2026 22:57:24 -0500 Subject: [PATCH 1/3] style(dart): resolve the bare library directives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `unnecessary_library_directive` flags all three: a `library;` with no doc comment or annotation carries no meaning. The two libraries in a2ui_core get the doc comment they were missing — which also gives pub.dev something to show — and a2ui_agent's, which re-exports a single file, loses the directive. This clears the last analyzer infos in both packages, so the CI job added next can run `dart analyze --fatal-infos`. --- dart/a2ui_agent/lib/a2ui_agent.dart | 2 -- dart/a2ui_core/lib/a2ui_core.dart | 5 +++++ dart/a2ui_core/lib/src/primitives/reactivity.dart | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dart/a2ui_agent/lib/a2ui_agent.dart b/dart/a2ui_agent/lib/a2ui_agent.dart index b8aace0387..0f55bf00ee 100644 --- a/dart/a2ui_agent/lib/a2ui_agent.dart +++ b/dart/a2ui_agent/lib/a2ui_agent.dart @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -library; - export 'src/a2ui_agent_base.dart'; // TODO: Export any libraries intended for clients of this package. diff --git a/dart/a2ui_core/lib/a2ui_core.dart b/dart/a2ui_core/lib/a2ui_core.dart index 9a1b0d435a..b0cc1a4925 100644 --- a/dart/a2ui_core/lib/a2ui_core.dart +++ b/dart/a2ui_core/lib/a2ui_core.dart @@ -12,6 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// Core library for the A2UI protocol: messages, catalogs, reactive state +/// models, and the processor that applies incoming messages to a surface +/// group. +/// +/// Implements protocol v0.9. library; // Protocol models. diff --git a/dart/a2ui_core/lib/src/primitives/reactivity.dart b/dart/a2ui_core/lib/src/primitives/reactivity.dart index 593993a1d9..0f1d590d86 100644 --- a/dart/a2ui_core/lib/src/primitives/reactivity.dart +++ b/dart/a2ui_core/lib/src/primitives/reactivity.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +/// Reactive primitives, re-exported from `package:preact_signals`. library; export 'package:preact_signals/preact_signals.dart' From 5ab01cc3aa62a159a9bffb4644b683161a3a22aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20L=C3=B3pez?= <63005462+diegolopezrm@users.noreply.github.com> Date: Wed, 2 Sep 2026 22:57:25 -0500 Subject: [PATCH 2/3] ci(dart): analyze, format and test the packages under dart/ The Flutter workflow builds its matrix from `find samples -name pubspec.yaml`, so `dart/a2ui_core` and `dart/a2ui_agent` never enter it, and no other workflow runs `dart analyze` or `dart test`. The formatting step in fix_format.sh covers `samples/client/flutter` and `renderers/flutter`, not `dart/`. The two packages that ship to pub.dev were the only source tree in the repository with no CI at all. This adds a workflow that holds them to the same bar as the samples: formatting, `dart analyze --fatal-infos`, and the package's own tests, one matrix entry per package so a new Dart package is picked up automatically. It installs Flutter through the repository's setup-dart action rather than a Dart-only SDK, because the packages resolve through the monorepo workspace whose root pubspec declares a Flutter constraint (#2463). --- .github/workflows/dart_packages_test.yml | 100 +++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 .github/workflows/dart_packages_test.yml diff --git a/.github/workflows/dart_packages_test.yml b/.github/workflows/dart_packages_test.yml new file mode 100644 index 0000000000..6cf6529eed --- /dev/null +++ b/.github/workflows/dart_packages_test.yml @@ -0,0 +1,100 @@ +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Analyzes, formats and tests the pure Dart packages under dart/. +# +# The Flutter workflow builds its matrix from samples/, so the packages that +# ship to pub.dev were not covered by any job. This workflow holds them to the +# same bar the samples are held to: formatting, analysis with --fatal-infos, +# and the package's own tests. +name: Dart CI + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.generate_matrix.outputs.matrix }} + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + + - name: Generate testing matrix + id: generate_matrix + run: | + DIRS_TO_TEST=$(find dart -name pubspec.yaml -not -path "*/.dart_tool/*" -exec dirname {} \;) + + JSON_MATRIX="[" + FIRST=true + for dir in $DIRS_TO_TEST; do + if [ "$FIRST" = false ]; then + JSON_MATRIX="$JSON_MATRIX," + fi + FIRST=false + package_name=$(echo "$dir" | tr '/' '_') + JSON_MATRIX="$JSON_MATRIX{\"name\":\"$package_name\",\"path\":\"$dir\"}" + done + JSON_MATRIX="$JSON_MATRIX]" + + echo "matrix=$JSON_MATRIX" >> $GITHUB_OUTPUT + + analyze_and_test: + needs: matrix + name: ${{ matrix.package.name }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: ${{ fromJson(needs.matrix.outputs.matrix) }} + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + persist-credentials: false + + # The packages resolve through the monorepo workspace, whose root pubspec + # declares a Flutter SDK constraint, so a Dart-only SDK cannot resolve + # them. See https://github.com/a2ui-project/a2ui/issues/2463. + - uses: ./.github/actions/setup-dart + + - name: Install dependencies + working-directory: ${{ matrix.package.path }} + run: dart pub get + + - name: Check formatting + working-directory: ${{ matrix.package.path }} + run: dart format --output=none --set-exit-if-changed . + + - name: Analyze code + working-directory: ${{ matrix.package.path }} + run: dart analyze --fatal-infos + + - name: Run tests + working-directory: ${{ matrix.package.path }} + run: dart test From 066da15a874312a964d0fd9314d2f17d2e8d4acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20L=C3=B3pez?= <63005462+diegolopezrm@users.noreply.github.com> Date: Thu, 3 Sep 2026 17:08:16 -0500 Subject: [PATCH 3/3] style(dart): format two test files the new CI job would reject `dart format --set-exit-if-changed` over dart/ fails on validator_test.dart and message_processor_conformance_test.dart, which arrived with #2439. fix_format.sh formats samples/client/flutter and renderers/flutter, never dart/, so nothing has been holding these packages to a format until the job this PR adds. Pure `dart format` output, with the same result under --language-version=3.10, so it is not a language-version difference. --- .../conformance/message_processor_conformance_test.dart | 8 +++++--- dart/a2ui_core/test/validator_test.dart | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dart/a2ui_core/test/conformance/message_processor_conformance_test.dart b/dart/a2ui_core/test/conformance/message_processor_conformance_test.dart index 7ba11b9a51..7694ea9d72 100644 --- a/dart/a2ui_core/test/conformance/message_processor_conformance_test.dart +++ b/dart/a2ui_core/test/conformance/message_processor_conformance_test.dart @@ -157,9 +157,11 @@ void _checkComponents( List> expected, String reason, ) { - expect(surface.componentsModel.all.map((c) => c.id).toSet(), { - for (final Map entry in expected) entry['id'], - }, reason: '$reason: component ids'); + expect( + surface.componentsModel.all.map((c) => c.id).toSet(), + {for (final Map entry in expected) entry['id']}, + reason: '$reason: component ids', + ); for (final entry in expected) { final id = entry['id']! as String; diff --git a/dart/a2ui_core/test/validator_test.dart b/dart/a2ui_core/test/validator_test.dart index 2efb3849f8..b30a4a7502 100644 --- a/dart/a2ui_core/test/validator_test.dart +++ b/dart/a2ui_core/test/validator_test.dart @@ -509,9 +509,11 @@ void main() { }, }); - expect(extractComponentRefFields(inlined)['Card']!.single, { - 'child', - }, reason: 'id must not be read as a child reference'); + expect( + extractComponentRefFields(inlined)['Card']!.single, + {'child'}, + reason: 'id must not be read as a child reference', + ); final A2uiValidator validator = A2uiValidator( catalogs: [inlined],