Repository navigation
feat(genui): add AsynchronousClientFunction base class - #1041
Merged
Merged
Conversation
gspencergoog
force-pushed
the
async-client-function
branch
from
September 23, 2026 18:37
ddd770a to
6192bf3
Compare
gspencergoog
force-pushed
the
async-client-function
branch
from
September 23, 2026 18:43
6192bf3 to
75607e6
Compare
gspencergoog
force-pushed
the
async-client-function
branch
from
September 23, 2026 19:21
75607e6 to
48b9745
Compare
AsynchronousClientFunction base class
Add `AsynchronousClientFunction` to complement `SynchronousClientFunction` and provide a symmetrical implementation pattern for asynchronous client functions in GenUI without breaking changes. - Added `AsynchronousClientFunction implements ClientFunction` with lazy `async*` execution calling `Future<Object?> executeAsync(JsonMap args, ExecutionContext context)`. - Added default `returnType => ClientFunctionReturnType.any` on both `SynchronousClientFunction` and `AsynchronousClientFunction`. - Updated documentation in `docs/contributing/design.md` and added release notes to `CHANGELOG.md`. - Bumped `pubspec.yaml` to 0.10.6 to match `CHANGELOG.md`. - Added comprehensive unit tests in `packages/genui/test/model/client_function_test.dart` including lazy evaluation verification. Addresses a2ui-project/a2ui#2066
gspencergoog
force-pushed
the
async-client-function
branch
from
September 30, 2026 20:55
48b9745 to
413d7ad
Compare
sunamo
added a commit
to sunamo/genui
that referenced
this pull request
Oct 2, 2026
* build: task dev pousti flutter pres FlutterAutoHotReload (auto hot reload) * Submodule URL na SSH Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs: replace CoreCatalogItems with BasicCatalogItems in READMEs (flutter#966) * fix(genui): show a literal CheckBox value (flutter#1038) `CheckBox.value` is a `booleanReference`: a literal, a `{"path": ...}` binding and a `{"call": ...}` are all valid. The widget bound to a data model path and never read the literal, so a component that said the setting was on rendered unchecked and announced itself unchecked, with nothing logged to say the value had been dropped. `Slider` and `TextField` already fall back to the literal until the path holds something. This does the same, so the three inputs of the basic catalog now treat their value the same way. * Fix/email validation regex (flutter#1026) Fix the email validation function by correcting the regex escape pattern. The previous implementation used an escaped `$` in a raw string, which caused the regex to match a literal `$` character instead of the end-of-string anchor. Update the regex pattern to properly validate email formats. # Description This PR fixes an issue in the email validation function where the regular expression pattern did not correctly handle the end-of-string anchor. The previous implementation incorrectly escaped the `$` character inside a Dart raw string. As a result, the regex engine treated it as a literal character instead of the end-of-string matcher, causing valid email addresses to fail validation. This change updates the regex pattern to use the correct `$` anchor and ensures email validation behaves as expected. ## Related Issues Fixes a2ui-project/a2ui#2854 * fix: fix validation checks and preserve error messages in basic catalog (flutter#1045) * Add RESUME.cs.md project summary and remove tracked build output * Add GitHub origin section to RESUME.cs.md * Upgrade RESUME.cs.md to schema version 3 * Add README and rewrite RESUME.cs.md description and origin * Add deletion recommendation reason to RESUME.cs.md * Add commit history to RESUME.cs.md * feat(genui): add `AsynchronousClientFunction` base class (flutter#1041) ## Summary Introduces `AsynchronousClientFunction` in `packages/genui`, establishing a symmetrical base class for asynchronous client-side functions returning a `Future` (via `executeAsync`), complementing the existing `SynchronousClientFunction` (`executeSync`) without breaking changes. Resolves a2ui-project/a2ui#2066 ## Changes - **`packages/genui/lib/src/model/client_function.dart`**: - Added `abstract class AsynchronousClientFunction implements ClientFunction` requiring `Future<Object?> executeAsync(JsonMap args, ExecutionContext context)` and wrapping it lazily using an `async*` generator (`yield await executeAsync(args, context)`). - Added default `@override ClientFunctionReturnType get returnType => ClientFunctionReturnType.any;` to both `SynchronousClientFunction` and `AsynchronousClientFunction`. - Updated dartdoc comments to cross-reference `SynchronousClientFunction`, `AsynchronousClientFunction`, and the streaming `ClientFunction` interface. - **`packages/genui/pubspec.yaml`**: - Bumped version to `0.10.6` to match `CHANGELOG.md` and satisfy Firehose publish validation. - **`docs/contributing/design.md`**: - Documented `ClientFunction`, `SynchronousClientFunction`, and `AsynchronousClientFunction` under Section 3 (UI Model Layer). - **`packages/genui/CHANGELOG.md`**: - Added `0.10.6` release entry noting the addition of `AsynchronousClientFunction`. - **`packages/genui/test/model/client_function_test.dart`**: - Added unit tests covering synchronous/asynchronous execution, lazy evaluation, exception propagation into stream errors, null returns, and Catalog/DataContext integration. ## Impact & Risks - **Zero breaking changes**: 100% backward-compatible. Existing implementations of `SynchronousClientFunction` (all basic catalog functions) and `ClientFunction` (such as `FormatStringFunction`) remain completely unaffected. * fix: make Slider continuous by default (flutter#1039) ## Summary Makes `Slider` continuous (`divisions: null`) by default, resolving assertion crashes on sub-unit ranges and eliminating 2-position switch behavior over the standard `[0.0, 1.0]` range. Note that once v1.0 is implemented, the `steps` argument will provide the `divisions` settings again. Fixes a2ui-project/a2ui#2737 ## Changes - **Continuous default**: Removed `divisions: (sliderData.max - sliderData.min).toInt()` in favor of continuous movement (`divisions: null`), as specified in A2UI v0.9 / v0.9.1. - **Value clamping**: Added defensive `.clamp(sliderData.min, sliderData.max)` on slider value binding. - **Display value & literal fallback**: Updated the thumb label to use `currentVal` (which is clamped to `[min, max]`, ensuring the label matches the visual thumb position) and formatted values via `_formatSliderValue` with 6-decimal precision to present whole numbers cleanly (`"10"`) and preserve fractional decimals (`"0.5"`, `"0.005"`) rather than truncating with `toStringAsFixed(0)`. - **Tests**: Expanded `packages/genui/test/catalog/core_widgets/slider_test.dart` with tests for default continuous behavior (`divisions: null`), sub-unit ranges (`min: 0, max: 0.5`), literal value fallback, number formatting, and out-of-bounds label clamping. - **Linter fixes**: Resolved 80-character line limit and added explicit type annotations required by `flutter analyze`. ## Impact & Risks - **Breaking changes**: None. In A2UI v0.9.1, `Slider` does not specify discrete steps; continuous movement is the expected default. - **Risk**: Low. All 347 tests in `packages/genui` pass. * fix: address review feedback on validation checks and truthiness (flutter#1047) * Add announcement about package replacement. (flutter#1046) * Update README and RESUME summary to schema 6 * Fill build and test status fields in RESUME --------- Co-authored-by: smutekutek <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Victor Eronmosele <[email protected]> Co-authored-by: Diego López <[email protected]> Co-authored-by: cubegao <[email protected]> Co-authored-by: jacobsimionato <[email protected]> Co-authored-by: Greg Spencer <[email protected]> Co-authored-by: Polina Cherkasova <[email protected]>
sunamo
added a commit
to sunamo/genui
that referenced
this pull request
Oct 4, 2026
* build: task dev pousti flutter pres FlutterAutoHotReload (auto hot reload) * Submodule URL na SSH Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs: replace CoreCatalogItems with BasicCatalogItems in READMEs (flutter#966) * fix(genui): show a literal CheckBox value (flutter#1038) `CheckBox.value` is a `booleanReference`: a literal, a `{"path": ...}` binding and a `{"call": ...}` are all valid. The widget bound to a data model path and never read the literal, so a component that said the setting was on rendered unchecked and announced itself unchecked, with nothing logged to say the value had been dropped. `Slider` and `TextField` already fall back to the literal until the path holds something. This does the same, so the three inputs of the basic catalog now treat their value the same way. * Fix/email validation regex (flutter#1026) Fix the email validation function by correcting the regex escape pattern. The previous implementation used an escaped `$` in a raw string, which caused the regex to match a literal `$` character instead of the end-of-string anchor. Update the regex pattern to properly validate email formats. # Description This PR fixes an issue in the email validation function where the regular expression pattern did not correctly handle the end-of-string anchor. The previous implementation incorrectly escaped the `$` character inside a Dart raw string. As a result, the regex engine treated it as a literal character instead of the end-of-string matcher, causing valid email addresses to fail validation. This change updates the regex pattern to use the correct `$` anchor and ensures email validation behaves as expected. ## Related Issues Fixes a2ui-project/a2ui#2854 * fix: fix validation checks and preserve error messages in basic catalog (flutter#1045) * Add RESUME.cs.md project summary and remove tracked build output * Add GitHub origin section to RESUME.cs.md * Upgrade RESUME.cs.md to schema version 3 * Add README and rewrite RESUME.cs.md description and origin * Add deletion recommendation reason to RESUME.cs.md * Add commit history to RESUME.cs.md * feat(genui): add `AsynchronousClientFunction` base class (flutter#1041) ## Summary Introduces `AsynchronousClientFunction` in `packages/genui`, establishing a symmetrical base class for asynchronous client-side functions returning a `Future` (via `executeAsync`), complementing the existing `SynchronousClientFunction` (`executeSync`) without breaking changes. Resolves a2ui-project/a2ui#2066 ## Changes - **`packages/genui/lib/src/model/client_function.dart`**: - Added `abstract class AsynchronousClientFunction implements ClientFunction` requiring `Future<Object?> executeAsync(JsonMap args, ExecutionContext context)` and wrapping it lazily using an `async*` generator (`yield await executeAsync(args, context)`). - Added default `@override ClientFunctionReturnType get returnType => ClientFunctionReturnType.any;` to both `SynchronousClientFunction` and `AsynchronousClientFunction`. - Updated dartdoc comments to cross-reference `SynchronousClientFunction`, `AsynchronousClientFunction`, and the streaming `ClientFunction` interface. - **`packages/genui/pubspec.yaml`**: - Bumped version to `0.10.6` to match `CHANGELOG.md` and satisfy Firehose publish validation. - **`docs/contributing/design.md`**: - Documented `ClientFunction`, `SynchronousClientFunction`, and `AsynchronousClientFunction` under Section 3 (UI Model Layer). - **`packages/genui/CHANGELOG.md`**: - Added `0.10.6` release entry noting the addition of `AsynchronousClientFunction`. - **`packages/genui/test/model/client_function_test.dart`**: - Added unit tests covering synchronous/asynchronous execution, lazy evaluation, exception propagation into stream errors, null returns, and Catalog/DataContext integration. ## Impact & Risks - **Zero breaking changes**: 100% backward-compatible. Existing implementations of `SynchronousClientFunction` (all basic catalog functions) and `ClientFunction` (such as `FormatStringFunction`) remain completely unaffected. * fix: make Slider continuous by default (flutter#1039) ## Summary Makes `Slider` continuous (`divisions: null`) by default, resolving assertion crashes on sub-unit ranges and eliminating 2-position switch behavior over the standard `[0.0, 1.0]` range. Note that once v1.0 is implemented, the `steps` argument will provide the `divisions` settings again. Fixes a2ui-project/a2ui#2737 ## Changes - **Continuous default**: Removed `divisions: (sliderData.max - sliderData.min).toInt()` in favor of continuous movement (`divisions: null`), as specified in A2UI v0.9 / v0.9.1. - **Value clamping**: Added defensive `.clamp(sliderData.min, sliderData.max)` on slider value binding. - **Display value & literal fallback**: Updated the thumb label to use `currentVal` (which is clamped to `[min, max]`, ensuring the label matches the visual thumb position) and formatted values via `_formatSliderValue` with 6-decimal precision to present whole numbers cleanly (`"10"`) and preserve fractional decimals (`"0.5"`, `"0.005"`) rather than truncating with `toStringAsFixed(0)`. - **Tests**: Expanded `packages/genui/test/catalog/core_widgets/slider_test.dart` with tests for default continuous behavior (`divisions: null`), sub-unit ranges (`min: 0, max: 0.5`), literal value fallback, number formatting, and out-of-bounds label clamping. - **Linter fixes**: Resolved 80-character line limit and added explicit type annotations required by `flutter analyze`. ## Impact & Risks - **Breaking changes**: None. In A2UI v0.9.1, `Slider` does not specify discrete steps; continuous movement is the expected default. - **Risk**: Low. All 347 tests in `packages/genui` pass. * fix: address review feedback on validation checks and truthiness (flutter#1047) * Add announcement about package replacement. (flutter#1046) * Update README and RESUME summary to schema 6 * Fill build and test status fields in RESUME * Add article source fields to RESUME.cs.md * Update repository type in RESUME.cs.md to sample * Fill origin_checked date in RESUME.cs.md * Replace n/a with found/not found/not run in RESUME.cs.md (schema 10) * Set repository type to notmine_sample in RESUME.cs.md * Set repository type to forked_notmine_sample in RESUME.cs.md * Rename type values in RESUME.cs.md to hyphenated form * Add file extension counts to RESUME (schema 11) --------- Co-authored-by: smutekutek <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Victor Eronmosele <[email protected]> Co-authored-by: Diego López <[email protected]> Co-authored-by: cubegao <[email protected]> Co-authored-by: jacobsimionato <[email protected]> Co-authored-by: Greg Spencer <[email protected]> Co-authored-by: Polina Cherkasova <[email protected]>
sunamo
added a commit
to sunamo/genui
that referenced
this pull request
Nov 3, 2026
* build: task dev pousti flutter pres FlutterAutoHotReload (auto hot reload) * Submodule URL na SSH Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs: replace CoreCatalogItems with BasicCatalogItems in READMEs (flutter#966) * fix(genui): show a literal CheckBox value (flutter#1038) `CheckBox.value` is a `booleanReference`: a literal, a `{"path": ...}` binding and a `{"call": ...}` are all valid. The widget bound to a data model path and never read the literal, so a component that said the setting was on rendered unchecked and announced itself unchecked, with nothing logged to say the value had been dropped. `Slider` and `TextField` already fall back to the literal until the path holds something. This does the same, so the three inputs of the basic catalog now treat their value the same way. * Fix/email validation regex (flutter#1026) Fix the email validation function by correcting the regex escape pattern. The previous implementation used an escaped `$` in a raw string, which caused the regex to match a literal `$` character instead of the end-of-string anchor. Update the regex pattern to properly validate email formats. # Description This PR fixes an issue in the email validation function where the regular expression pattern did not correctly handle the end-of-string anchor. The previous implementation incorrectly escaped the `$` character inside a Dart raw string. As a result, the regex engine treated it as a literal character instead of the end-of-string matcher, causing valid email addresses to fail validation. This change updates the regex pattern to use the correct `$` anchor and ensures email validation behaves as expected. ## Related Issues Fixes a2ui-project/a2ui#2854 * fix: fix validation checks and preserve error messages in basic catalog (flutter#1045) * Add RESUME.cs.md project summary and remove tracked build output * Add GitHub origin section to RESUME.cs.md * Upgrade RESUME.cs.md to schema version 3 * Add README and rewrite RESUME.cs.md description and origin * Add deletion recommendation reason to RESUME.cs.md * Add commit history to RESUME.cs.md * feat(genui): add `AsynchronousClientFunction` base class (flutter#1041) ## Summary Introduces `AsynchronousClientFunction` in `packages/genui`, establishing a symmetrical base class for asynchronous client-side functions returning a `Future` (via `executeAsync`), complementing the existing `SynchronousClientFunction` (`executeSync`) without breaking changes. Resolves a2ui-project/a2ui#2066 ## Changes - **`packages/genui/lib/src/model/client_function.dart`**: - Added `abstract class AsynchronousClientFunction implements ClientFunction` requiring `Future<Object?> executeAsync(JsonMap args, ExecutionContext context)` and wrapping it lazily using an `async*` generator (`yield await executeAsync(args, context)`). - Added default `@override ClientFunctionReturnType get returnType => ClientFunctionReturnType.any;` to both `SynchronousClientFunction` and `AsynchronousClientFunction`. - Updated dartdoc comments to cross-reference `SynchronousClientFunction`, `AsynchronousClientFunction`, and the streaming `ClientFunction` interface. - **`packages/genui/pubspec.yaml`**: - Bumped version to `0.10.6` to match `CHANGELOG.md` and satisfy Firehose publish validation. - **`docs/contributing/design.md`**: - Documented `ClientFunction`, `SynchronousClientFunction`, and `AsynchronousClientFunction` under Section 3 (UI Model Layer). - **`packages/genui/CHANGELOG.md`**: - Added `0.10.6` release entry noting the addition of `AsynchronousClientFunction`. - **`packages/genui/test/model/client_function_test.dart`**: - Added unit tests covering synchronous/asynchronous execution, lazy evaluation, exception propagation into stream errors, null returns, and Catalog/DataContext integration. ## Impact & Risks - **Zero breaking changes**: 100% backward-compatible. Existing implementations of `SynchronousClientFunction` (all basic catalog functions) and `ClientFunction` (such as `FormatStringFunction`) remain completely unaffected. * fix: make Slider continuous by default (flutter#1039) ## Summary Makes `Slider` continuous (`divisions: null`) by default, resolving assertion crashes on sub-unit ranges and eliminating 2-position switch behavior over the standard `[0.0, 1.0]` range. Note that once v1.0 is implemented, the `steps` argument will provide the `divisions` settings again. Fixes a2ui-project/a2ui#2737 ## Changes - **Continuous default**: Removed `divisions: (sliderData.max - sliderData.min).toInt()` in favor of continuous movement (`divisions: null`), as specified in A2UI v0.9 / v0.9.1. - **Value clamping**: Added defensive `.clamp(sliderData.min, sliderData.max)` on slider value binding. - **Display value & literal fallback**: Updated the thumb label to use `currentVal` (which is clamped to `[min, max]`, ensuring the label matches the visual thumb position) and formatted values via `_formatSliderValue` with 6-decimal precision to present whole numbers cleanly (`"10"`) and preserve fractional decimals (`"0.5"`, `"0.005"`) rather than truncating with `toStringAsFixed(0)`. - **Tests**: Expanded `packages/genui/test/catalog/core_widgets/slider_test.dart` with tests for default continuous behavior (`divisions: null`), sub-unit ranges (`min: 0, max: 0.5`), literal value fallback, number formatting, and out-of-bounds label clamping. - **Linter fixes**: Resolved 80-character line limit and added explicit type annotations required by `flutter analyze`. ## Impact & Risks - **Breaking changes**: None. In A2UI v0.9.1, `Slider` does not specify discrete steps; continuous movement is the expected default. - **Risk**: Low. All 347 tests in `packages/genui` pass. * fix: address review feedback on validation checks and truthiness (flutter#1047) * Add announcement about package replacement. (flutter#1046) * Update README and RESUME summary to schema 6 * Fill build and test status fields in RESUME * Add article source fields to RESUME.cs.md * Update repository type in RESUME.cs.md to sample * Fill origin_checked date in RESUME.cs.md * Replace n/a with found/not found/not run in RESUME.cs.md (schema 10) * Set repository type to notmine_sample in RESUME.cs.md * Set repository type to forked_notmine_sample in RESUME.cs.md * Rename type values in RESUME.cs.md to hyphenated form * Add file extension counts to RESUME (schema 11) --------- Co-authored-by: smutekutek <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Victor Eronmosele <[email protected]> Co-authored-by: Diego López <[email protected]> Co-authored-by: cubegao <[email protected]> Co-authored-by: jacobsimionato <[email protected]> Co-authored-by: Greg Spencer <[email protected]> Co-authored-by: Polina Cherkasova <[email protected]>
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.
Summary
Introduces
AsynchronousClientFunctioninpackages/genui, establishing a symmetrical base class for asynchronous client-side functions returning aFuture(viaexecuteAsync), complementing the existingSynchronousClientFunction(executeSync) without breaking changes.Resolves a2ui-project/a2ui#2066
Changes
packages/genui/lib/src/model/client_function.dart:abstract class AsynchronousClientFunction implements ClientFunctionrequiringFuture<Object?> executeAsync(JsonMap args, ExecutionContext context)and wrapping it lazily using anasync*generator (yield await executeAsync(args, context)).@override ClientFunctionReturnType get returnType => ClientFunctionReturnType.any;to bothSynchronousClientFunctionandAsynchronousClientFunction.SynchronousClientFunction,AsynchronousClientFunction, and the streamingClientFunctioninterface.packages/genui/pubspec.yaml:0.10.6to matchCHANGELOG.mdand satisfy Firehose publish validation.docs/contributing/design.md:ClientFunction,SynchronousClientFunction, andAsynchronousClientFunctionunder Section 3 (UI Model Layer).packages/genui/CHANGELOG.md:0.10.6release entry noting the addition ofAsynchronousClientFunction.packages/genui/test/model/client_function_test.dart:Impact & Risks
SynchronousClientFunction(all basic catalog functions) andClientFunction(such asFormatStringFunction) remain completely unaffected.Testing
flutter analyze packages/genui(0 issues).flutter test packages/genui/test/model/client_function_test.dart(all tests passing).flutter test packages/genui(all 365 tests passing).dart format.