[web, tool] Support recompiling shaders and unify asset processing (2nd try)#186902
Conversation
…sion errors During web hot reloads, the tool attempts to evict assets using `ext.flutter.evict`. If the service extension hasn't been registered in the browser client yet (e.g., immediately after the app connection is established), native platforms throw a standard `kMethodNotFound` (-32601) error, which the tool handles gracefully. However, on web/DWDS, a null-assertion in DDC's `dart:developer` patch throws an `Unexpected null value` error which DWDS propagates as a `-32603` internal error. This change catches these DWDS-specific unregistered extension errors and treats them identically to unregistered native service extensions. Remove this work-around once dart-lang/sdk#63424 is fixed. This is the root cause of the revert in flutter@7ed7e21
- Replaces magic number -32603 with vm_service.RPCErrorKind.kInternalError.code in both source and tests. - Fixes style constraint on the TODO comment.
…sset processing (flutter#185534)"" This reverts commit 7ed7e21. This brings back the shader compilation support and unified web asset syncing path which was previously reverted due to devicelab test flakes on Chrome. The flakes have been resolved by defensively handling DWDS unregistered service extension errors in the previous commit.
There was a problem hiding this comment.
Code Review
This pull request refactors asset and shader synchronization by introducing a shared static method DevFS.updateBundle and enables asset eviction for the web runner. Feedback identifies a missing import for asset.dart in devfs.dart and a non-exhaustive switch statement in updateBundle that fails to handle the null case for the nullable entry.kind property.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/flutter_tools/lib/src/devfs.dart (27-28)
The constant kFontManifestJson is used later in this file (line 739), but it is defined in package:flutter_tools/src/asset.dart. Since the local _kFontManifest constant was removed, an import for asset.dart is required to avoid a compilation error.
import 'asset.dart';
packages/flutter_tools/lib/src/devfs.dart (768-769)
The switch statement on entry.kind is missing a case for null. In the previous implementation (line 684 on the left), null was handled alongside AssetKind.regular and AssetKind.font. Since entry.kind is nullable, omitting the null case will lead to a compilation error because Dart requires exhaustive switches on enums, including the null case for nullable types.
case AssetKind.regular:
case AssetKind.font:
case null:
This comment was marked as outdated.
This comment was marked as outdated.
There was a problem hiding this comment.
Code Review
This pull request refactors asset and shader synchronization by extracting bundle update logic into a static DevFS.updateBundle method and centralizing eviction handling within the ResidentRunner base class. This change enables asset and shader eviction for web platforms. Review feedback identifies a missing import for kFontManifestJson and an unhandled null case in the AssetKind switch statement. Additionally, the evictDirtyAssets implementation requires updates to correctly account for and reset the didUpdateFontManifest flag.
…tate bugs Removes premature clearing of didUpdateFontManifest trigger flag during compilation updates and clears it upon consumption inside the shared `evictDirtyAssets()` eviction lifecycle. Exposes and resolves two pre-existing latent bug patterns: - Web Redundant Reloads: WebDevFS lacked didUpdateFontManifest resetting inside its update phase. This caused any subsequent image/shader updates to trigger duplicate, redundant font manifest reloads on client browsers, leading to visual flashes and performance drops. - Native Silent Failures: Native DevFS prematurely cleared didUpdateFontManifest at compilation startup. In cases where compilation succeeds but a subsequent pipeline error aborts hot reload before eviction, the updated font manifest is successfully synced but never evicted. On the next successful reload, font reloading is silently skipped entirely. Refactors the reset logic inside `packages/flutter_tools/lib/src/resident_runner.dart` to clean up state upon successful consumption, aligning it with asset and shader eviction lifecycles. Tests: - Enhanced `Can hot reload and evict dirty assets/shaders` unit test to explicitly assert clearing of `didUpdateFontManifest` post-eviction. - All 20 tests in `devfs_test.dart` and the `resident_web_runner_test.dart` suite successfully pass.
|
autosubmit label was removed for flutter/flutter/186902, because - The status or check suite Windows tool_integration_tests_8_10 has failed. Please fix the issues identified (or deflake) before re-applying this label. |
| <Pattern>[ | ||
| RegExp( | ||
| r'^Reloaded 0 libraries in [0-9]+ms \(compile: \d+ ms, reload: \d+ ms, reassemble: \d+ ms\)\.$', | ||
| r'^Reloaded 0 libraries in [\d,]+ms \(compile: [\d,]+ ms, reload: [\d,]+ ms, reassemble: [\d,]+ ms\)\.$', |
There was a problem hiding this comment.
Hot reload may take more than 1s on CI
flutter/flutter@c8f2f16...e70534d 2026-05-28 30870216+gaaclarke@users.noreply.github.com Linux glyph gamma correction (flutter/flutter#187122) 2026-05-28 chris@bracken.jp [iOS] Eliminate strong retain cycle from VSyncClient (flutter/flutter#187164) 2026-05-28 katelovett@google.com Revert "[pubspec] Bump Dart SDK constraint to ^3.13.0 (#186957)" (flutter/flutter#187209) 2026-05-28 engine-flutter-autoroll@skia.org Roll Skia from f1b8ba877c07 to 32acea791248 (3 revisions) (flutter/flutter#187220) 2026-05-27 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from k9EizfEGJO4WwQN9-... to SBpmmPxqx3lAvGojE... (flutter/flutter#187211) 2026-05-27 bdero@google.com [Impeller] Add block-compressed texture format support (BC, ETC2, ASTC) (flutter/flutter#187077) 2026-05-27 katelovett@google.com Disable analyzer (flutter/flutter#187205) 2026-05-27 bdero@google.com [Flutter GPU] Add explicit draw counts (reland) (flutter/flutter#187192) 2026-05-27 bdero@google.com [Flutter GPU] Inject per-backend defines into shader bundle compilation (flutter/flutter#187081) 2026-05-27 engine-flutter-autoroll@skia.org Roll Skia from fa944af10f91 to f1b8ba877c07 (13 revisions) (flutter/flutter#187194) 2026-05-27 47866232+chunhtai@users.noreply.github.com Fixes bug when changing accessibilityFocusBlockType doesn't update ch… (flutter/flutter#186596) 2026-05-27 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#187191) 2026-05-27 kevmoo@users.noreply.github.com [web, tool] Support recompiling shaders and unify asset processing (2nd try) (flutter/flutter#186902) 2026-05-27 robert.ancell@canonical.com Fix crash if FlView is destroyed during a draw. (flutter/flutter#186848) 2026-05-27 engine-flutter-autoroll@skia.org Roll Packages from fc795e5 to 4b424d7 (4 revisions) (flutter/flutter#187174) 2026-05-27 15619084+vashworth@users.noreply.github.com Stop prefetching Swift packages in pub get (flutter/flutter#187113) 2026-05-27 jesswon@google.com Update CI with newer android sdk package (flutter/flutter#187143) 2026-05-27 jason-simmons@users.noreply.github.com Add a tag to the Linux platform properties in .ci.yaml that specifies x64 CPUs (flutter/flutter#187124) 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 boetger@google.com,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
This reverts commit 7ed7e21
Which reverted f15c3a3
Effectively re-lands #185534
This brings back the shader compilation support and unified web asset syncing path
which was previously reverted due to devicelab test flakes on Chrome.
The flakes have been resolved by defensively handling DWDS unregistered service
extension errors in the previous commit.
Towards #137265