Service worker caching strategy #51

3 Commits
Author SHA1 Message Date
dev_agentandClaude Opus 5.5 9a5d0a7912 Match service worker routes on the decoded path
CI / ci (push) Successful in 1m34s
CI / ci (pull_request) Successful in 1m33s
Independent review Codex gpt-6-sol high: APPROVED (0 findings)
Offline navigations to /%61uth/login or /%61pi/v1/settings/household
missed the reserved prefixes and were answered with the precached
index.html. routeFor now percent-decodes the pathname and checks reserved
prefixes before and after dot segments are resolved, as the server does;
a malformed encoding is network-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 16:30:27 -04:00
dev_agentandClaude Opus 5.5 3e95514053 Route font fetches through the expiring font cache
CI / ci (push) Successful in 1m34s
CI / ci (pull_request) Successful in 1m34s
Register the font route ahead of precacheAndRoute so a font fetch uses
CacheFirst with its ExpirationPlugin instead of being answered by the
precache route. Fonts stay in the precache manifest; when the network
fails and the runtime cache has no copy, the font comes from the
precache. Source tests pin the expiration plugin, the precache fallback
and the route order.

Read the injected precache list in the production-build test as JSON
and assert the index.html entry's revision there, so it no longer
depends on matching the minified sw.js with a regex.

Maestro task: 8fa0d0bd-4a52-4f09-ba68-41bdbdfda63b

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 16:25:08 -04:00
dev_agentandClaude Opus 5.5 fe124f0d52 Service worker caching strategy
CI / ci (pull_request) Successful in 1m34s
CI / ci (push) Successful in 1m33s
Precache the shell, JS, CSS and self-hosted fonts in
mealquest-precache-v1. Route every other request through the pure
src/sw/routes.ts decision: NetworkFirst (3 s timeout) for plans,
shopping, dinners and home; CacheFirst with expiration for /media/* and
font files; NetworkOnly for /auth/*, settings, jobs and every non-GET.
App navigations fall back to the precached index.html offline. On
activate, delete only stale caches named mealquest-*.

Maestro task: 8fa0d0bd-4a52-4f09-ba68-41bdbdfda63b

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 16:20:19 -04:00