Skip to content

Conversation

@biggs0125
Copy link
Contributor

Upcoming changes to DDC change the async semantics of code produced by the compiler. The changes will bring the semantics more in line with those of dart2js and fix several bugs in the old semantics. However in landing those changes I experienced a test failure in obscured_animated_image_test.

Some debugging uncovered that this is due to the use of SynchronousFuture in this FakeCodec. The old DDC async semantics forced an async gap when that future was awaited. The new async semantics do not create an async gap here. This changes the render ordering of the widget tree created in the test leading to the test failure.

Future.value should be a reasonable substitute here and should achieve what the test was trying to achieve while also preserving the correct render ordering given the new DDC semantics.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Jul 23, 2024
Copy link
Contributor

@nate-thegrate nate-thegrate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Hopefully we can have a smooth transition to the next Dart Dev Compiler version 🤞

final SynchronousFuture<ui.FrameInfo> result =
SynchronousFuture<ui.FrameInfo>(_frameInfos[_nextFrame]);
final Future<ui.FrameInfo> result =
Future<ui.FrameInfo>.value(_frameInfos[_nextFrame]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is SynchronousFuture broken, or does it simply not suitable for this use-case because it's too eager to call the then callback? (or something else?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's actually some active discussion going on about SynchronousFuture here:
#151579 (comment)

I personally don't know the history of why SynchronousFuture was added in the first place. It provides a very different behavior than a normal Future and doesn't really conform to the Dart spec.

I don't know that its "broken" though... it does what it seems like it was designed to do. But in this specific case it definitely causes an incorrect render order given a fully valid implementation of Dart's async semantics. This same bug would also occur if the test were run with dart2js.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@yjbanov yjbanov added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 25, 2024
@auto-submit auto-submit bot merged commit 30cce4d into flutter:master Jul 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 27, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 28, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 29, 2024
Roll Flutter from 7d5c1c0 to 031dc3d (97 revisions)

flutter/flutter@7d5c1c0...031dc3d

2024-07-26 [email protected] Roll Flutter Engine from 342a42547822 to 354abf2800a0 (7 revisions) (flutter/flutter#152385)
2024-07-26 [email protected] Use more CORS headers for flutter run server (flutter/flutter#152249)
2024-07-26 [email protected] Manual roll Flutter Engine from 8714b54a87c0 to 342a42547822 (6 revisions) (flutter/flutter#152379)
2024-07-26 [email protected] feat: Add drag handle size to be configurable based on given size (flutter/flutter#152085)
2024-07-26 [email protected] Add and use an integration test with native(ADB) screenshots (flutter/flutter#152326)
2024-07-26 [email protected] Roll Packages from 19daf6f to 3d358d9 (4 revisions) (flutter/flutter#152372)
2024-07-26 [email protected] Add test for range_slider.0.dart (flutter/flutter#152152)
2024-07-26 [email protected] Introduce `TabBar.indicatorAnimation` to customize tab indicator animation (flutter/flutter#151746)
2024-07-26 [email protected] Roll Flutter Engine from 21629ece8b72 to 8714b54a87c0 (3 revisions) (flutter/flutter#152351)
2024-07-26 [email protected] Cleanup examples/api web load logic to latest (flutter/flutter#152349)
2024-07-26 [email protected] Adds a call to the `PlatformDispatcher` whenever the focus changes (flutter/flutter#151268)
2024-07-26 [email protected] Roll Flutter Engine from d665bf82dc32 to 21629ece8b72 (4 revisions) (flutter/flutter#152344)
2024-07-25 [email protected] `docImport`s for the widgets library (flutter/flutter#152339)
2024-07-25 [email protected] Set dart defines properly while in debug mode. (flutter/flutter#152262)
2024-07-25 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.13 to 3.25.14 (flutter/flutter#152342)
2024-07-25 [email protected] Roll Flutter Engine from 74785a771ae6 to d665bf82dc32 (2 revisions) (flutter/flutter#152340)
2024-07-25 [email protected] Cleanup InputDecoration.collapsed constructor (flutter/flutter#152165)
2024-07-25 [email protected] Add test for expansion_panel_list.expansion_panel_list_radio.0_test.dart (flutter/flutter#151730)
2024-07-25 [email protected] Roll Flutter Engine from f862a620cee4 to 74785a771ae6 (2 revisions) (flutter/flutter#152333)
2024-07-25 [email protected] Roll Packages from 1c319ac to 19daf6f (3 revisions) (flutter/flutter#152327)
2024-07-25 [email protected] Add a more typical / concrete example to IntrinsicHeight / IntrinsicWidth (flutter/flutter#152246)
2024-07-25 [email protected] Roll Flutter Engine from f47b4d8e145a to f862a620cee4 (1 revision) (flutter/flutter#152320)
2024-07-25 [email protected] Roll Flutter Engine from 74737820a8ee to f47b4d8e145a (7 revisions) (flutter/flutter#152314)
2024-07-25 [email protected] Flutter Web App: adds a11y semantic attributes to slider (flutter/flutter#151985)
2024-07-25 [email protected] Manual roll Flutter Engine from eb8fac2b1703 to 74737820a8ee (8 revisions) (flutter/flutter#152305)
2024-07-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from eb8fac2b1703 to a57655cccb55 (6 revisions) (#152293)" (flutter/flutter#152304)
2024-07-25 [email protected] Roll Flutter Engine from eb8fac2b1703 to a57655cccb55 (6 revisions) (flutter/flutter#152293)
2024-07-25 [email protected] Modify stepping integration test to accommodate new DDC async semantics. (flutter/flutter#152204)
2024-07-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from eb8fac2b1703 to e1259b86ba02 (2 revisions) (#152285)" (flutter/flutter#152289)
2024-07-25 [email protected] Update fake_codec.dart to use Future.value instead of SynchronousFuture (flutter/flutter#152182)
2024-07-25 [email protected] Roll Flutter Engine from eb8fac2b1703 to e1259b86ba02 (2 revisions) (flutter/flutter#152285)
2024-07-25 [email protected] Roll Flutter Engine from 4b952093cb99 to eb8fac2b1703 (3 revisions) (flutter/flutter#152278)
2024-07-24 [email protected] [CupertinoAlertDialog] Rewrite (flutter/flutter#150410)
2024-07-24 [email protected] Revert "Make `CupertinoRadio`'s `mouseCursor` a `WidgetStateProperty`" (flutter/flutter#152254)
2024-07-24 [email protected] Fix: A selectable's selection under the active selection should not be cleared on right-click (flutter/flutter#151851)
2024-07-24 [email protected] Marks Mac channels_integration_test to be flaky (flutter/flutter#151882)
2024-07-24 [email protected] Roll Flutter Engine from c2f489d783d6 to 4b952093cb99 (3 revisions) (flutter/flutter#152264)
2024-07-24 [email protected] added Semantics label to TextField with InputDecoration to let user kâ�¦ (flutter/flutter#151996)
2024-07-24 [email protected] feat: Add alignmentOffset to DropdownMenu (flutter/flutter#151731)
2024-07-24 [email protected] Roll Flutter Engine from 490576daf810 to c2f489d783d6 (6 revisions) (flutter/flutter#152260)
2024-07-24 [email protected] Scaffolding for `NativeDriver` and `AndroidNativeDriver` for taking screenshots using `adb`. (flutter/flutter#152194)
2024-07-24 [email protected] `widgets` docImport (flutter/flutter#152146)
2024-07-24 [email protected] Roll Flutter Engine from 3078f6a90e71 to 490576daf810 (1 revision) (flutter/flutter#152239)
2024-07-24 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Use more CORS headers for `flutter run` server (#152048)" (flutter/flutter#152248)
2024-07-24 [email protected] Use more CORS headers for `flutter run` server (flutter/flutter#152048)
2024-07-24 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Enable Swift Package Manager by default on master channel (#152049)" (flutter/flutter#152243)
...
TytaniumDev pushed a commit to TytaniumDev/flutter that referenced this pull request Aug 7, 2024
…re (flutter#152182)

Upcoming changes to DDC change the async semantics of code produced by the compiler. The changes will bring the semantics more in line with those of dart2js and fix several bugs in the old semantics. However in landing those changes I experienced a test failure in [obscured_animated_image_test](https://github.com/flutter/flutter/blob/master/packages/flutter/test/widgets/obscured_animated_image_test.dart).

Some debugging uncovered that this is due to the use of `SynchronousFuture` in this `FakeCodec`. The old DDC async semantics forced an async gap when that future was [awaited](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/painting/image_stream.dart#L1064). The new async semantics do not create an async gap here. This changes the render ordering of the widget tree created in the test leading to the test failure.

`Future.value` should be a reasonable substitute here and should achieve what the test was trying to achieve while also preserving the correct render ordering given the new DDC semantics.
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…re (flutter#152182)

Upcoming changes to DDC change the async semantics of code produced by the compiler. The changes will bring the semantics more in line with those of dart2js and fix several bugs in the old semantics. However in landing those changes I experienced a test failure in [obscured_animated_image_test](https://github.com/flutter/flutter/blob/master/packages/flutter/test/widgets/obscured_animated_image_test.dart).

Some debugging uncovered that this is due to the use of `SynchronousFuture` in this `FakeCodec`. The old DDC async semantics forced an async gap when that future was [awaited](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/painting/image_stream.dart#L1064). The new async semantics do not create an async gap here. This changes the render ordering of the widget tree created in the test leading to the test failure.

`Future.value` should be a reasonable substitute here and should achieve what the test was trying to achieve while also preserving the correct render ordering given the new DDC semantics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants