Visitar URL original
Fix Wasm build cache mismatch in ResidentWebRunner and browser 404 fallbacks by kevmoo · Pull Request #190786 · flutter/flutter · GitHub
Skip to content

Fix Wasm build cache mismatch in ResidentWebRunner and browser 404 fallbacks - #190786

Merged
auto-submit[bot] merged 5 commits into
flutter:masterfrom
kevmoo:issue-190779
Sep 11, 2026
Merged

auto-submit[bot] merged 5 commits into
flutter:masterfrom
kevmoo:issue-190779

Conversation

@kevmoo

@kevmoo kevmoo commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

This pull request resolves unnecessary Wasm recompilations during flutter run by removing hardcoded compiler variables that mismatched with flutter build, and ensures missing web assets correctly return HTTP 404s to prevent browser instantiation crashes.

Specifically:

  • Removed explicitly hardcoded optimizationLevel and stripWasm defaults in ResidentWebRunner's WasmCompilerConfig. This allows it to gracefully inherit dynamic defaults downstream, achieving cache key parity with flutter build web --wasm.
  • Updated ReleaseAssetServer to properly return 404 Not Found for missing static file requests (.wasm, .mjs, .js, assets/, canvaskit/) instead of serving index.html. This prevents obscure WebAssembly.instantiate syntax errors in the browser when caching or compilation pipelines fail to produce an artifact.

Related to #67053.

@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 8, 2026
@kevmoo kevmoo changed the title fix(web): align resident runner wasm config and asset 404 fallback Fix Wasm build cache mismatch in ResidentWebRunner and browser 404 fallbacks Aug 8, 2026
@kevmoo
kevmoo marked this pull request as ready for review August 8, 2026 20:38

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates ReleaseAssetServer to return a 404 status for missing static web assets (such as .wasm, .mjs, .js, assets/, and canvaskit/) instead of falling back to index.html, and ensures index.html exists before serving it. It also refactors ResidentWebRunner to use default compiler options for WasmCompilerConfig to maintain cache key parity, and adds corresponding tests. Feedback suggests optimizing and robustifying the path matching logic in ReleaseAssetServer to avoid fragile pattern matching on split path segments and reduce string allocations.

@kevmoo kevmoo added the CICD Run CI/CD label Aug 8, 2026
@kevmoo
kevmoo requested a review from mdebbar August 10, 2026 20:08
@kevmoo
kevmoo marked this pull request as draft August 10, 2026 20:08
@kevmoo
kevmoo removed the request for review from mdebbar August 10, 2026 20:08
@kevmoo

kevmoo commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Sorry. Need to investigate the default here.

ResidentWebRunner explicitly hardcoded WasmCompilerConfig optimizationLevel and stripWasm values, preventing dynamic defaulting and creating cache key mismatches with `flutter build web --wasm` which lead to duplicated recompilations. Additionally, ReleaseAssetServer returned index.html (200 OK) for missing static assets instead of 404 Not Found, causing browser Wasm instantiation syntax errors.

* Delete explicit optimizationLevel and stripWasm values in ResidentWebRunner _compilerConfig.
* Update ReleaseAssetServer to return 404 Not Found for missing static file requests (.wasm, .mjs, .js, assets/, canvaskit/) using URL path segment pattern matching while preserving SPA index.html fallback for client-side navigation routes.
* Update unit tests in resident_web_runner_test to verify dynamic cache-equivalent defaults.
* Add unit tests in web_asset_server_test verifying 404 responses for missing assets and 200 responses for SPA navigation routes.
@kevmoo
kevmoo marked this pull request as ready for review September 4, 2026 22:51

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates the release asset server to return a 404 Not Found for missing static assets (such as those under assets/ or canvaskit/, and files ending in .wasm, .mjs, or .js) and simplifies WasmCompilerConfig instantiation in ResidentWebRunner. Feedback points out that exact match checks for assets and canvaskit will break client-side SPA routing by returning a 404 instead of falling back to index.html. Additionally, the feedback suggests expanding the list of checked static file extensions to include common types like .css and .json to avoid console errors, and adding tests to cover these routing fallbacks.

mdebbar
mdebbar previously approved these changes Sep 10, 2026
@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 10, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 11, 2026
@auto-submit

auto-submit Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/190786, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@kevmoo kevmoo added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 11, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 11, 2026
Merged via the queue into flutter:master with commit 6d8e1dd Sep 11, 2026
29 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 11, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 12, 2026
Roll Flutter from 63b9518f16bc to 2553f89be1ef (62 revisions)

flutter/flutter@63b9518...2553f89

2026-09-12 chris@bracken.jp Roll clang to 07d67299a15ce03b053736e2d31a668ee0576987 (flutter/flutter#192607)
2026-09-12 engine-flutter-autoroll@skia.org Roll Dart SDK from b24b352c29db to 7863887acbfb (3 revisions) (flutter/flutter#192665)
2026-09-12 codefu@google.com fix(tree): et format --all (flutter/flutter#192669)
2026-09-12 matt.boetger@gmail.com Support activity-alias in Android launcher activity detection (flutter/flutter#187251)
2026-09-12 matt.boetger@gmail.com fix: regenerate gradle lockfiles for external_textures integration test (flutter/flutter#192657)
2026-09-12 engine-flutter-autoroll@skia.org Roll Skia from 51aa02b2c195 to e5e96533b732 (4 revisions) (flutter/flutter#192646)
2026-09-12 Rusino@users.noreply.github.com [WebParagraph] Fix text pixelation, glyph clipping, and snapping offsets to avoid subpixel raster caching (flutter/flutter#191736)
2026-09-12 codefu@google.com fix(tests): Add ruby dep to Mac windowing_test (flutter/flutter#192656)
2026-09-12 116356835+AbdeMohlbi@users.noreply.github.com Remove some `unawaited_futures` outdated ignores (flutter/flutter#192026)
2026-09-11 katelovett@google.com Bump Dart to 3.13, reformat, re-enable formatting check (flutter/flutter#192649)
2026-09-11 34871572+gmackall@users.noreply.github.com [android] Isolate API-34 high contrast listener in AccessibilityBridge behind Api34Impl (flutter/flutter#192502)
2026-09-11 katelovett@google.com Update style guide for Dart 3.13 (flutter/flutter#192639)
2026-09-11 codefu@google.com ci(bringups): remove bringup from these tests (flutter/flutter#192637)
2026-09-11 30870216+gaaclarke@users.noreply.github.com Unmark new_gallery_windows_impeller__transition_perf as bringup (flutter/flutter#192633)
2026-09-11 30870216+gaaclarke@users.noreply.github.com Unmark new_gallery_windows_skia__transition_perf as bringup (flutter/flutter#192635)
2026-09-11 engine-flutter-autoroll@skia.org Roll Skia from f446aec4ce9e to 51aa02b2c195 (2 revisions) (flutter/flutter#192631)
2026-09-11 codefu@google.com fix(ci): mac verify binaries still racing (flutter/flutter#192634)
2026-09-11 engine-flutter-autoroll@skia.org Roll Packages from 8a35b16 to 9caa77c (8 revisions) (flutter/flutter#192630)
2026-09-11 engine-flutter-autoroll@skia.org Roll Dart SDK from a76fee2722e0 to b24b352c29db (2 revisions) (flutter/flutter#192627)
2026-09-11 bkonyi@google.com [tool] Migrate PackagesCommand and Pub to modular dependency injection (flutter/flutter#192460)
2026-09-11 bkonyi@google.com [tool] Migrate Darwin framework commands to modular dependency injection (flutter/flutter#192252)
2026-09-11 bkonyi@google.com [tool] Migrate Upgrade, Downgrade, and UpdatePackages commands to modular dependency injection (flutter/flutter#190787)
2026-09-11 engine-flutter-autoroll@skia.org Roll Skia from b3fa80a0e168 to f446aec4ce9e (55 revisions) (flutter/flutter#192620)
2026-09-11 engine-flutter-autoroll@skia.org Roll Dart SDK from d20d59cfa664 to a76fee2722e0 (2 revisions) (flutter/flutter#192616)
2026-09-11 okorohelijah@google.com remove deeplink integration tests from bringup (flutter/flutter#192459)
2026-09-11 154381524+flutteractionsbot@users.noreply.github.com Revert: [devicelab] Clean up Chrome profile directories and trap abort signals in web benchmarks (flutter/flutter#192615)
2026-09-11 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from C0j8F-_Iy-OQZ6YyI... to m69nfK-wnHaMTe8P9... (flutter/flutter#192608)
2026-09-11 kevmoo@users.noreply.github.com Fix Wasm build cache mismatch in ResidentWebRunner and browser 404 fallbacks (flutter/flutter#190786)
2026-09-11 engine-flutter-autoroll@skia.org Roll Dart SDK from 3ce3116bc9ec to d20d59cfa664 (1 revision) (flutter/flutter#192588)
2026-09-11 robert.ancell@canonical.com [Linux] Keep the frame at the top of a resizing subsurface (flutter/flutter#192408)
2026-09-10 1961493+harryterkelsen@users.noreply.github.com [devicelab] Clean up Chrome profile directories and trap abort signals in web benchmarks (flutter/flutter#192584)
2026-09-10 1961493+harryterkelsen@users.noreply.github.com [web] Keep ImageSource alive until Picture disposal (flutter/flutter#192516)
2026-09-10 jhy03261997@gmail.com Remove the accessibility evaluations feature flag (flutter/flutter#192266)
2026-09-10 97480502+b-luk@users.noreply.github.com Promote Windows gradient benchmark tests to non-bringup (flutter/flutter#192581)
2026-09-10 116356835+AbdeMohlbi@users.noreply.github.com Remove commented out export in `text_input.dart` since the dart compiler has the correct behavior now (flutter/flutter#191539)
2026-09-10 bkonyi@google.com [flutter_tools] Do not mistake server-initiated requests for responses to client requests in AnalysisServer (flutter/flutter#192546)
2026-09-10 engine-flutter-autoroll@skia.org Roll Packages from 36e088a to 8a35b16 (12 revisions) (flutter/flutter#192550)
2026-09-10 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#192517)
2026-09-10 kevmoo@users.noreply.github.com feat(web): support --web-content-hash for entrypoint files (flutter/flutter#190153)
2026-09-10 zhongliu88889@gmail.com [web] Stop iOS auto-zoom by sizing semantic inputs at 16px (flutter/flutter#192328)
2026-09-10 engine-flutter-autoroll@skia.org Roll Dart SDK from 0d55b7a6a9ee to 3ce3116bc9ec (2 revisions) (flutter/flutter#192534)
2026-09-10 116356835+AbdeMohlbi@users.noreply.github.com Update more enum instances comparison to use equality == since dart has the correct behavior now (flutter/flutter#191788)
2026-09-10 bkonyi@google.com Fix specify_nonobvious_local_variable_types lints in luci_resultdb_test.dart (flutter/flutter#192543)
2026-09-10 engine-flutter-autoroll@skia.org Roll ICU from 8cc91d9b6ab9 to 6ebb40c59477 (1 revision) (flutter/flutter#192527)
2026-09-10 robert.ancell@canonical.com [Linux] Make the framebuffer depth/stencil buffer optional (flutter/flutter#192156)
2026-09-10 robert.ancell@canonical.com [Linux] Cancel input when events stop being delivered (flutter/flutter#192277)
...
@kevmoo
kevmoo deleted the issue-190779 branch September 15, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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