Skip to content

[web, tool] Support recompiling shaders and unify asset processing (2nd try)#186902

Merged
auto-submit[bot] merged 9 commits into
flutter:masterfrom
kevmoo:revert_revert
May 27, 2026
Merged

[web, tool] Support recompiling shaders and unify asset processing (2nd try)#186902
auto-submit[bot] merged 9 commits into
flutter:masterfrom
kevmoo:revert_revert

Conversation

@kevmoo
Copy link
Copy Markdown
Contributor

@kevmoo kevmoo commented May 21, 2026

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

kevmoo added 3 commits May 21, 2026 09:27
…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.
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 21, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 21, 2026
@kevmoo kevmoo marked this pull request as draft May 21, 2026 17:28
@kevmoo kevmoo changed the title revert revert [web, tool] Support recompiling shaders and unify asset processing (2nd try) May 21, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 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)

critical

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)

critical

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:

@kevmoo

This comment was marked as outdated.

@kevmoo kevmoo marked this pull request as ready for review May 23, 2026 05:05
@github-actions github-actions Bot removed the CICD Run CI/CD label May 23, 2026
@kevmoo kevmoo requested a review from harryterkelsen May 23, 2026 05:06
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a 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 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.

Comment thread packages/flutter_tools/lib/src/devfs.dart
Comment thread packages/flutter_tools/lib/src/devfs.dart
Comment thread packages/flutter_tools/lib/src/resident_runner.dart
Comment thread packages/flutter_tools/lib/src/resident_runner.dart
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 26, 2026
kevmoo added 2 commits May 26, 2026 10:32
…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.
@github-actions github-actions Bot removed the CICD Run CI/CD label May 26, 2026
@harryterkelsen harryterkelsen added the CICD Run CI/CD label May 26, 2026
harryterkelsen
harryterkelsen previously approved these changes May 26, 2026
Copy link
Copy Markdown
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions github-actions Bot removed the CICD Run CI/CD label May 27, 2026
@kevmoo kevmoo added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels May 27, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 27, 2026
@auto-submit
Copy link
Copy Markdown
Contributor

auto-submit Bot commented May 27, 2026

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.

@kevmoo kevmoo requested a review from harryterkelsen May 27, 2026 17:50
@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label May 27, 2026
<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\)\.$',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hot reload may take more than 1s on CI

Copy link
Copy Markdown
Contributor

@harryterkelsen harryterkelsen left a comment

Choose a reason for hiding this comment

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

LGTM

@auto-submit auto-submit Bot added this pull request to the merge queue May 27, 2026
Merged via the queue into flutter:master with commit 21c6566 May 27, 2026
166 of 167 checks passed
@kevmoo kevmoo deleted the revert_revert branch May 27, 2026 21:06
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request May 28, 2026
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
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 CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants