chore(ui): temporary Android WebView boot diagnostic (test contour only) #176
Reference in New Issue
Block a user
Delete Branch "feature/webview-boot-diagnostic"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Temporary on-device boot diagnostic to chase the Android white-screen: the SPA loads a progress bar and then stays blank inside the Telegram/VK in-app WebView, while Firefox/Gecko on the same device renders it fine — pointing at a stale Android System WebView that cannot parse the
es2022bundle.A classic ES5
<script>is injected intoindex.htmlbefore the module bundle, so it runs and paints even when the bundle fails to parse. The oneindex.htmlis served under/app/,/telegram/and/vk/, so it covers all three entries at once.It reports, on screen:
userAgent, parsed Chromium major,wvWebView marker, viewport/dpr, cookies/online/lang.?.,??,??=,||=, private fields, static blocks, object spread, numeric separators, dynamicimport()— each parsed vianew Function(never crashes the probe) and dated by the Chrome version that shipped it, so the firstNOdates the engine.structuredClone,Array.at/findLast,Object.hasOwn,Proxy(Svelte 5 runes),ResizeObserver,Intl.Segmenter,localStorage, … same dating.?./??⇒ the bundle cannot parse).<html>.app-shell(didmain.tsrun?) and#appchild count (did Svelte mount?), so it distinguishes module never ran (parse fail) / ran but Svelte crashed / all good.window.onerror, capture-phaseerror(module SyntaxError / load failure),unhandledrejection.A Copy report button exports everything; Hide / continue reveals the app that booted underneath.
Not for production
vite.config.tsstrip-boot-diagremoves the wholeBOOT-DIAGblock from every non-production build, so the mock e2e (a full-screen overlay would intercept its taps) and the dev server stay clear — only the production build shipped to the test contour carries it. Temporary: the block + the plugin get reverted after the diagnosis; must never reachmaster.Verified locally
pnpm check— 0 errors.pnpm build(production) — the panel is indist/index.html; rendered it via headless Chromium (all probes OK, mount check reads SPA mounted).pnpm build --mode mock— the panel is absent (gate works).pnpm test:e2e— 188 passed (Chromium + WebKit); the overlay does not affect the smoke.Replace the temporary on-device boot diagnostic (the always-on overlay, the console.error mirror and the handleError console hook) with a permanent boot-capability guard in index.html. Before the deferred module, in plain ES5, it: - hard-gates on the unpolyfillable essentials the app cannot run without — BigInt (the 64-bit FlatBuffers wire decode) and Proxy (Svelte 5 runes) — and, when one is missing, shows a friendly full-screen "this device's OS/browser can't run the app" screen instead of a white screen; - soft-gates the polyfillable es2020+ globals, pulling core-js (polyfills.js) only when needed (the previous behaviour, folded in); - keeps a reactive net: an uncaught error during boot with no window.__booted signal within 8s raises the same screen with the captured cause. Inside a Telegram/VK Mini App the screen also points to the web version (https://<host>/app/). A "Diagnostic information" button reveals the engine, the feature table, the reason and the app version, with a Copy button. App.svelte sets window.__booted once bootstrap resolves. vite.config drops the now-unneeded strip-boot-diag plugin and adds inject-boot-version (stamps the guard's diagnostic with VITE_APP_VERSION). The es2019 target, the core-js loader and the board cqw->vmin glyph fallback stay. The speculative Chrome-74 pan change is reverted — it did not fix the judder and added nothing on modern engines. Verified: svelte-check clean, unit + mock e2e green (the guard is inert on a capable engine, so the size budget and the smoke are untouched), and the screen + diagnostic + stamped version render on a forced hard-gate (BigInt removed via addInitScript). The unsupported-engine telemetry beacon (dedup + edge rate-limit + a Prometheus counter) is a separate follow-up PR, per the agreed split.