|
| 1 | +# Desktop WebKit offline-emulation failure — 2026-08-31 |
| 2 | + |
| 3 | +The original cached-offline startup acceptance test remains enabled and failing |
| 4 | +on this host's desktop Playwright WebKit. No application or PWA configuration |
| 5 | +change was made for this failure. No physical iPhone or Home Screen launch was |
| 6 | +tested. |
| 7 | + |
| 8 | +## Environment and original failure |
| 9 | + |
| 10 | +- Windows host, Playwright `1.62.1`. |
| 11 | +- WebKit `26.5`, bundled revision `2336`. |
| 12 | +- Chromium `151.0.7922.34`, bundled revision `1234`. |
| 13 | +- Both browser projects use Playwright's iPhone 13 device descriptor. This is |
| 14 | + desktop browser emulation, not a device test. |
| 15 | +- Existing production preview: `http://127.0.0.1:4173/Ironlog/`. |
| 16 | + |
| 17 | +Reproduction command (does not rebuild the app): |
| 18 | + |
| 19 | +```powershell |
| 20 | +npx playwright test tests/browser/resilience.spec.ts --project=webkit --grep 'cached offline startup' --output=output/playwright/webkit-offline-baseline --reporter=list |
| 21 | +``` |
| 22 | + |
| 23 | +Result: **1 failed**, at the first `page.reload()` after |
| 24 | +`context.setOffline(true)`, with `WebKit encountered an internal error`. |
| 25 | +The test already verified activated registration, a controlling worker, cached |
| 26 | +app HTML, and cached exercise data. Its full reload/fresh-tab/logging/finish |
| 27 | +assertions were not bypassed. Trace and screenshot are under |
| 28 | +`output/playwright/webkit-offline-baseline/`. |
| 29 | + |
| 30 | +## Minimal reproduction isolates the emulation boundary |
| 31 | + |
| 32 | +```powershell |
| 33 | +node diagnostics/service-worker-offline-repro.mjs |
| 34 | +``` |
| 35 | + |
| 36 | +This standalone diagnostic creates its own ephemeral loopback HTTP server and |
| 37 | +uses a small vanilla service worker. It contains no IronLog code, React, Vite, |
| 38 | +Workbox, navigation fallback, or app data. HTTP responses carry `no-store` so |
| 39 | +the service-worker Cache Storage is responsible for the cached document. |
| 40 | + |
| 41 | +The worker precaches `/`, serves that cached document for `/`, and serves a |
| 42 | +synthetic `new Response('handled-by-worker')` for `/worker-probe`. Each case |
| 43 | +verifies an active controller, a populated cache, the synthetic response, and |
| 44 | +a successful online reload before changing one variable. |
| 45 | + |
| 46 | +| Browser | Network change | Synthetic worker response | Offline reload / fresh tab | |
| 47 | +| -------- | -------------------------- | ------------------------- | ------------------------------------------------------- | |
| 48 | +| Chromium | `context.setOffline(true)` | Works | Both pass | |
| 49 | +| Chromium | Actual HTTP server stopped | Works | Both pass | |
| 50 | +| WebKit | `context.setOffline(true)` | `TypeError: Load failed` | Reload has internal engine error; fresh tab not reached | |
| 51 | +| WebKit | Actual HTTP server stopped | Works | Both pass | |
| 52 | + |
| 53 | +All four cases verify that an uncached network fetch fails after the network |
| 54 | +change. Stopping the server closes its listening socket and existing connections. |
| 55 | +`navigator.onLine` stays true in that case; it is only a connectivity hint and |
| 56 | +is not used as proof of network availability. The matrix reproduced consistently |
| 57 | +in repeated runs. The diagnostic intentionally exits nonzero when a case fails; |
| 58 | +it does not invert or suppress the WebKit failure. |
| 59 | + |
| 60 | +Inference: the local WebKit/Playwright offline-emulation path prevents even a |
| 61 | +synthetic service-worker response from being delivered. This reproduces without |
| 62 | +the application's PWA stack, so changing Workbox caching would not address the |
| 63 | +isolated failure. The evidence does not identify a precise upstream source-code |
| 64 | +defect or prove behavior in shipping Safari. Playwright's |
| 65 | +[service-worker documentation](https://playwright.dev/docs/service-workers) |
| 66 | +also warns that its service-worker support is Chromium-only; that warning is |
| 67 | +context, not a substitute for the reproduction above. |
| 68 | + |
| 69 | +## Supplemental actual-app origin-unavailable acceptance |
| 70 | + |
| 71 | +```powershell |
| 72 | +npx playwright test --config=diagnostics/playwright.config.ts |
| 73 | +``` |
| 74 | + |
| 75 | +Result against the existing production `dist`: **2 passed**, Chromium and WebKit |
| 76 | +(20.5 seconds total in the initial run). `app-server-stopped.spec.ts` serves the |
| 77 | +existing build on its own ephemeral port, marks HTTP responses `no-store`, then |
| 78 | +stops only its own server. It neither rebuilds nor interrupts preview port 4173. |
| 79 | +This is a supplemental origin-unavailable check, not a replacement for the |
| 80 | +original airplane-mode-like emulation test. |
| 81 | + |
| 82 | +After proving worker control and app precaching, this test verifies: |
| 83 | + |
| 84 | +1. Reload with the server stopped retains four pending warmups. |
| 85 | +2. Closing the page and opening a fresh page starts the cached app. |
| 86 | +3. An uncached request fails, proving the origin is unavailable. |
| 87 | +4. Resuming the workout retains the four warmups without counting them as sets. |
| 88 | +5. Explicitly logging one warmup and one working set creates two persisted sets. |
| 89 | +6. A further offline reload retains those sets and three pending warmups. |
| 90 | +7. Finishing/saving yields history with exactly the two logged sets, not pending |
| 91 | + warmups, and history survives another reload. |
| 92 | +8. No JavaScript page errors are raised during the flow. |
| 93 | + |
| 94 | +Attachments are generated under `output/playwright/origin-stopped/`. The ordinary |
| 95 | +resilience suite remains unchanged and still exposes the WebKit emulation |
| 96 | +failure. The supplementary pass increases confidence in cached startup and |
| 97 | +workout persistence with an unavailable origin; it does **not** prove full |
| 98 | +device-level offline behavior, installed-PWA lifecycle, browser-process restart, |
| 99 | +cache eviction resilience, or physical-iPhone acceptance. |
0 commit comments