Skip to content

feat(spikes): cache and preload the in-browser Flutter toolkit (CHE-7630) [squash] - #98

Draft
congvc-bot-x99[bot] wants to merge 1 commit into
agent/x99-claude-sonnet-200k/che-7478-51a70fdc3c43from
agent/x99-claude-sonnet-200k/che-7630-5f14e2c9f470
Draft

congvc-bot-x99[bot] wants to merge 1 commit into
agent/x99-claude-sonnet-200k/che-7478-51a70fdc3c43from
agent/x99-claude-sonnet-200k/che-7630-5f14e2c9f470

Conversation

@congvc-bot-x99

Copy link
Copy Markdown

What

Evidence-only spike (CHE-7630, S2b): cache and preload the in-browser Flutter toolkit. Stacked on S1b (agent/x99-claude-sonnet-200k/che-7478-51a70fdc3c43, head b7b39b31). Nothing here ships. Full write-up: spikes/flutter-lane/S2B-EVIDENCE.md.

Result

  1. Service worker + Cache Storage, one entry per file keyed by SHA-256 (cache name toolkit-0.1.4-3.14.0-3.50.0). Warm visit: 0 B of toolkit. Toolkit bump: 12,136 B in 2 requests, new toolkit runs. The immutable-URL alternative re-downloads 31.3 MB on a bump.
  2. Preload level 2 (worker, pub get, toolkit and a hidden connected sandbox at page open): frame opens 15 s after the page, first frame in 3.5 to 4.0 s (warm, 3 of 3) instead of 12 to 14 s. Level 1 gives almost nothing.
  3. A warm visit is not faster than a cold one on X99 (p50 12.6 s vs 13.0 s): the time is CPU, not download.
  4. pub.dev, the Roboto fallback font and the rive runtime mirror on X99 (/mirror/*); the viewer's browser then calls no third-party host. Font and rive redirects need the service worker.
  5. Quota bug found and fixed in the spike: cache.put threw QuotaExceededError and the page never reached a first frame. Fixed with .catch.

Red then green

node check.mjs assert (from spikes/flutter-lane/s2b), cold / warm / bumped toolkit in one persistent Chrome 158 profile.

S1b page, red (evidence-s2b/red-s1b.txt, 2026-11-19 19:11 ICT):

PASS  1 cold reaches a first frame
PASS  2 warm second visit downloads no toolkit asset  0.00 MB
FAIL  3 after a toolkit bump the page runs the new toolkit  ran 84d633a69e12 want 52c6aa63f4aa
PASS  4 after a bump only changed assets download (< 1 MB)  0.00 MB
FAIL  5 page exposes a frame-open hook (preload needs one)
FAIL  6 viewer browser calls no third-party host  pub.dev,fonts.gstatic.com

S2b sw + mirror, green (evidence-s2b/green-sw.txt, 23:21 ICT):

PASS  1 cold reaches a first frame
PASS  2 warm second visit downloads no toolkit asset  0.00 MB
PASS  3 after a toolkit bump the page runs the new toolkit  ran 52c6aa63f4aa want 52c6aa63f4aa
PASS  4 after a bump only changed assets download (< 1 MB)  0.01 MB
PASS  5 page exposes a frame-open hook (preload needs one)
PASS  6 viewer browser calls no third-party host  none

Quota (node check.mjs evict --only E): red evidence-s2b/evict-red-E.txt (23:13 ICT, first frame never reached at a 100 MB quota, 240 s timeout), green evict-green-E.txt (23:17 ICT).

Checks run

  1. prettier --check, oxlint --deny-warnings, eslint --max-warnings 0 on spikes/flutter-lane/s2b and the evidence file: clean.
  2. verify.sh b7b39b31: related-tests SKIP (no ts/tsx test changed), browser-tests SKIP, lint PASS, format PASS, doc-lint PASS, build SKIP. typecheck FAIL, in files this PR does not touch (scripts/perf/*, server/clientStatic.ts, two tests): the checkout had no install of its own, so I used another checkout's node_modules, which lacks playwright-core and compression. Nothing under spikes/ is in the error list. CI will give the clean typecheck.

Caveats

  1. X99 is shared; load was 5 to 34. Read p50, not max, and do not use any number as a budget.
  2. Chrome 158 headless only. No Safari, Firefox or phone.
  3. The rive redirect rule and mirrored files exist but no rive frame ran end to end here (CHE-7353 owns the Rive shell, slot and harness; none touched).
  4. s2b/node_modules is a gitignored symlink for playwright-core; not committed.

Tailnet only. No public URL, no C00 change, no CDN, no spend.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants