Repository navigation
test(a2ui_flutter): cover the properties an agent gets wrong - #4108
diegolopezrm wants to merge 4 commits into
Conversation
Ports the cases from flutter/genui#1050 and a2ui-project#2872 to the v0.9 and v1.0 basic catalogs: Slider, TextField, DateTimeInput and Tabs. A literal of the wrong type does not reach a widget here. The processor checks it against the component's schema, even without a validation config, and rejects the update, so those cases check that it is rejected, reported on the surface's onError, and that the surface keeps what it showed. What a bound path holds is not checked, so the values a widget has to survive are bound, and each one falls back instead of throwing. The two schema-valid Slider payloads from a2ui-project#2872, a value above max and a max below min, stay literals.
A JSON number past the largest double, such as -1e400, decodes to an infinity, and the schema accepts it as a number. With a min of negative infinity the Material Slider normalises its value to NaN and fails the assertion 'value >= 0.0 && value <= 1.0' while building. An infinite min or max now falls back to its default, 0 or 100, which is what an HTML range input does with the same attribute.
There was a problem hiding this comment.
Code Review
This pull request updates the Slider component in a2ui_flutter to treat infinite min or max values (which can result from decoding extreme JSON numbers like -1e400) as absent, falling back to default values. It also introduces comprehensive tests in tolerant_reads_test.dart and v1_0_test.dart to verify how various components (such as Slider, TextField, DateTimeInput, and Tabs) handle invalid or unexpected bound types. As there are no review comments, I have no additional feedback to provide.
…olerant-reads # Conflicts: # dart/a2ui_flutter/CHANGELOG.md
|
From triage bot: Triage suggestion: For humansSummary: Why flagged for triage: Suggestion:
To adjust and apply this suggestion, run in your a2ui checkout: tools/internal/triage_new/triage_ui.sh https://github.com/a2ui-project/a2ui/pull/4108For software🤖 Agent-generated |
Part of #2872, as @yjbanov suggested there: every case from flutter/genui#1050 and from the issue, now as tests on a2ui_flutter's v0.9 and v1.0 basic catalogs.
None of them crash a2ui_flutter. A literal of the wrong type never reaches a widget, since a2ui_core rejects it against the schema, so those tests check that the update is rejected, reported on
onError, and that the surface keeps what it showed. A value that arrives through a binding isn't schema-checked, and those fall back without throwing.Trying nearby inputs found one that does crash: a Slider with
"min": -1e400, which JSON decodes to negative infinity and fails a Material assertion. The second commit treats an infiniteminormaxas absent, the way an HTML range input does. Happy to move it to its own PR if you'd rather.