-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Create Hot Restart over websocket test #173852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
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 a new integration test for hot restart over a WebSocket connection and refactors the existing hot reload test to use a new shared utility file, websocket_dwds_test_common.dart. The refactoring is well done and improves code reuse. I've identified a potential resource leak in the new common utility file where a Chrome process might not be cleaned up on certain failures. I've also pointed out a few places where documentation is missing for public members, which violates the project's style guide.
packages/flutter_tools/test/integration.shard/test_data/websocket_dwds_test_common.dart
Show resolved
Hide resolved
| final Duration debugUrlTimeout; | ||
| final Duration appStartTimeout; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Public fields should have documentation comments. 1
/// The maximum time to wait for the DWDS debug URL to be available.
final Duration debugUrlTimeout;
/// The maximum time to wait for the app to start after Chrome connects.
final Duration appStartTimeout;
Style Guide References
Footnotes
| final StringBuffer stdout; | ||
| final io.Process chromeProcess; | ||
| final StreamSubscription<String> subscription; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Public fields should have documentation comments. 1
/// The captured stdout from the Flutter process.
final StringBuffer stdout;
/// The headless Chrome process.
final io.Process chromeProcess;
/// The subscription to the stdout stream of the Flutter process.
final StreamSubscription<String> subscription;
Style Guide References
Footnotes
| final StreamSubscription<String> subscription = flutter.stdout.listen((String e) { | ||
| stdout.writeln(e); | ||
| // Extract the debug connection URL | ||
| if (e.contains('Waiting for connection from Dart debug extension at http://')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have the regexp we can just use firstMatch and it'll be null if there isn't a match. It's harder to keep 2 copies of this string in sync.
| r'Waiting for connection from Dart debug extension at (http://[^\s]+)', | ||
| ); | ||
| final Match? match = debugUrlPattern.firstMatch(e); | ||
| if (match != null && !sawDebugUrl.isCompleted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to see the debug URL twice? Seems like something is off if that happens so perhaps we should throw a clear error. Otherwise it'll just look like a timeout.
|
|
||
| io.Process? chromeProcess; | ||
| try { | ||
| // Step 1: Start Flutter app with web-server device (will wait for debug connection) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment step numbers are all off by 1. I actually think the comments are unnecessary since the debugPrint is self-commenting.
| subscription: subscription, | ||
| ); | ||
| } catch (e) { | ||
| // Clean up on error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this call cleanupWebSocketTestResources?
| debugPrint('Step 5: Testing hot reload with WebSocket connection...'); | ||
| try { | ||
| // Test hot reload functionality | ||
| debugPrint('Step 6: Testing hot reload with WebSocket connection...'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having step numbers here requires keeping all these files in sync. If the common file changes then we would have to update this one too. I think for the actual testing we can omit the step numbers.
flutter/flutter@a4cb00a...c65f01d 2025-08-26 engine-flutter-autoroll@skia.org Roll Packages from fe66130 to 1ef712e (4 revisions) (flutter/flutter#174442) 2025-08-26 15619084+vashworth@users.noreply.github.com Revert "Directly generate a Mach-O dynamic library using gen_snapshot (#171626) (flutter/flutter#174392) 2025-08-26 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 5.4.0 to 5.5.0 in the all-github-actions group (flutter/flutter#174436) 2025-08-26 engine-flutter-autoroll@skia.org Roll Skia from 9daab16abbf9 to 21214d63fc40 (1 revision) (flutter/flutter#174431) 2025-08-26 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from UiY8gj468PZUj6QTm... to L5zGzsIWIS8N36AFQ... (flutter/flutter#174430) 2025-08-26 engine-flutter-autoroll@skia.org Roll Dart SDK from f1f90d413dd3 to 9054cd8af73c (2 revisions) (flutter/flutter#174428) 2025-08-26 engine-flutter-autoroll@skia.org Roll Skia from afb5c22d9ba0 to 9daab16abbf9 (2 revisions) (flutter/flutter#174429) 2025-08-26 engine-flutter-autoroll@skia.org Roll Skia from 2227187dbdcf to afb5c22d9ba0 (1 revision) (flutter/flutter#174425) 2025-08-26 87506348+jingshao-code@users.noreply.github.com [iOS][Secure Paste] Custom edit menu actions (flutter/flutter#171825) 2025-08-26 huy@nevercode.io Make SystemUiOverlayStyle to be diagnosticable (flutter/flutter#174018) 2025-08-26 34465683+rkishan516@users.noreply.github.com Fix: Active step fully colored in vertical mode (flutter/flutter#173152) 2025-08-26 32538273+ValentinVignal@users.noreply.github.com Migrate to use `WidgetStateProperty` (flutter/flutter#174323) 2025-08-26 engine-flutter-autoroll@skia.org Roll Skia from ed42a94ee066 to 2227187dbdcf (3 revisions) (flutter/flutter#174417) 2025-08-26 engine-flutter-autoroll@skia.org Roll Dart SDK from a0e39d9b4a58 to f1f90d413dd3 (1 revision) (flutter/flutter#174409) 2025-08-26 jason-simmons@users.noreply.github.com [Impeller] Flush the data written to the device buffer by RoundSuperellipseGeometry (flutter/flutter#174316) 2025-08-26 flar@google.com Remove obsolete vulkan_window source files (flutter/flutter#174087) 2025-08-25 1961493+harryterkelsen@users.noreply.github.com [web] Migrate non-CanvasKit-specific tests to ui/ (flutter/flutter#174396) 2025-08-25 jessy.yameogo@gmail.com Create Hot Restart over websocket test (flutter/flutter#173852) 2025-08-25 engine-flutter-autoroll@skia.org Roll Dart SDK from e283a9e88242 to a0e39d9b4a58 (1 revision) (flutter/flutter#174383) 2025-08-25 matanlurey@users.noreply.github.com Update `master` CHANGELOG for 3.35.2 (flutter/flutter#174399) 2025-08-25 engine-flutter-autoroll@skia.org Roll Skia from da724d312e65 to ed42a94ee066 (4 revisions) (flutter/flutter#174394) 2025-08-25 58529443+srujzs@users.noreply.github.com Update dwds to 25.0.3 (flutter/flutter#174379) 2025-08-25 38427679+xVemu@users.noreply.github.com Fix logic statements in year2023 documentation (flutter/flutter#174120) 2025-08-25 jason-simmons@users.noreply.github.com Release thread-local resources when submitting a Flutter GPU command buffer (flutter/flutter#173663) 2025-08-25 1961493+harryterkelsen@users.noreply.github.com [web] Refactor LayerScene out of CanvasKit (flutter/flutter#174375) 2025-08-25 15619084+vashworth@users.noreply.github.com Stream logs from `devicectl` and `lldb` (flutter/flutter#173724) 2025-08-25 jmccandless@google.com NavigatorPopScope examples no longer use deprecated onPop. (flutter/flutter#174291) 2025-08-25 mohellebiabdessalem@gmail.com fix typo in test documentation function name (flutter/flutter#174297) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
- Create hot restart over websocket test - refactored websocket_dwds_test_common Closes dart-lang/webdev#2669 Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and flutter#173777 - This PR can be landed once the bug above is fixed in dwds and the dwds version is updated --------- Co-authored-by: Srujan Gaddam <58529443+srujzs@users.noreply.github.com>
- Create hot restart over websocket test - refactored websocket_dwds_test_common Closes dart-lang/webdev#2669 Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and flutter#173777 - This PR can be landed once the bug above is fixed in dwds and the dwds version is updated --------- Co-authored-by: Srujan Gaddam <58529443+srujzs@users.noreply.github.com>
- Create hot restart over websocket test - refactored websocket_dwds_test_common Closes dart-lang/webdev#2669 Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and flutter#173777 - This PR can be landed once the bug above is fixed in dwds and the dwds version is updated --------- Co-authored-by: Srujan Gaddam <58529443+srujzs@users.noreply.github.com>
Closes dart-lang/webdev#2669
Blocked by hot restart bug: Fix in dart-lang/webdev#2668 and #173777