Service worker caching strategy #51

Member

Task 8fa0d0bd-4a52-4f09-ba68-41bdbdfda63b. Precache shell/JS/CSS/fonts, NetworkFirst for plan/shopping/dinners/home, CacheFirst for media and fonts, NetworkOnly for auth, settings, jobs, and non-GET. Route matching is a pure module with tests. Workbox packages are the ones already installed by vite-plugin-pwa; no new direct dependency was added.

Task 8fa0d0bd-4a52-4f09-ba68-41bdbdfda63b. Precache shell/JS/CSS/fonts, NetworkFirst for plan/shopping/dinners/home, CacheFirst for media and fonts, NetworkOnly for auth, settings, jobs, and non-GET. Route matching is a pure module with tests. Workbox packages are the ones already installed by vite-plugin-pwa; no new direct dependency was added.
dev_agent added 1 commit 2026-10-04 16:20:57 -04:00
Service worker caching strategy
CI / ci (pull_request) Successful in 1m34s
CI / ci (push) Successful in 1m33s
fe124f0d52
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>
dev_agent added 1 commit 2026-10-04 16:25:35 -04:00
Route font fetches through the expiring font cache
CI / ci (push) Successful in 1m34s
CI / ci (pull_request) Successful in 1m34s
3e95514053
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>
dev_agent added 1 commit 2026-10-04 16:31:50 -04:00
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)
9a5d0a7912
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>
review_agent left a comment
Member

Independent review — Codex gpt-6-sol, reasoning high

Verdict: APPROVED
Reviewed SHA: 9a5d0a79120aa63bcb7c8235cafef20ccabecc7c

{
  "verdict": "APPROVED",
  "reviewed_sha": "9a5d0a79120aa63bcb7c8235cafef20ccabecc7c",
  "summary": "No blocking issue found. Route checks cover encoded auth and settings paths, cache cleanup is limited to mealquest-* caches, and the precache configuration includes fonts. No direct dependency was added, though importing transitive Workbox packages is fragile if vite-plugin-pwa or the install layout changes. lint:colors passed. Typecheck, tests, and build could not be run because web/node_modules is absent; no packages were installed.",
  "findings": []
}

Posted unaltered by review_agent. This is transport, not a second review.

## Independent review — Codex `gpt-6-sol`, reasoning high Verdict: **APPROVED** Reviewed SHA: `9a5d0a79120aa63bcb7c8235cafef20ccabecc7c` ```json { "verdict": "APPROVED", "reviewed_sha": "9a5d0a79120aa63bcb7c8235cafef20ccabecc7c", "summary": "No blocking issue found. Route checks cover encoded auth and settings paths, cache cleanup is limited to mealquest-* caches, and the precache configuration includes fonts. No direct dependency was added, though importing transitive Workbox packages is fragile if vite-plugin-pwa or the install layout changes. lint:colors passed. Typecheck, tests, and build could not be run because web/node_modules is absent; no packages were installed.", "findings": [] } ``` --- Posted unaltered by `review_agent`. This is transport, not a second review.
approver_agent merged commit 21b2672d40 into feature/ea4f47b4-6f1e-4735-a33e-6e91bf092564-pwa-shell 2026-10-04 16:36:44 -04:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Maniacs_Mansion/MealQuest#51