diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index bd124a5..5ad1e6d 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -469,3 +469,29 @@ project-scoped roles. Changes are audit-logged as `project_access_changed`. the project's members plus app admins, each with their effective role on that project. A project with nobody assigned shows only the admins, which is why assigning people is the first step on a new job. + +## Asset freshness (why the app can't run half-updated) + +A page must never run against a stylesheet or script from a previous deploy. Three +things enforce that, and all three are needed: + +1. **`Cache-Control: no-cache` on HTML/CSS/JS** — set by NGINX + (`nginx/conf.d/wp-suite.conf`) and by the dev server (`_NoCacheCode` in + `server/app.py`). With no header at all the browser applies *heuristic* freshness, + roughly 10% of each file's age, so the least recently changed file gets the longest + lifetime — which is exactly how HTML and CSS drift apart. ETag/Last-Modified still + make each revalidation a cheap 304. +2. **The service worker fetches code with `cache: 'no-cache'`** (`html/sw.js`) and + precaches with `cache: 'reload'`. A plain `fetch(req)` inherits the request's + default cache mode and consults the browser HTTP cache, so "network-first" alone + was not enough. Non-`ok` responses fall back to the cache rather than replacing a + page the cache could still serve, and cache keys drop the query string so in-app + links (`?project=…&tab=…`) still resolve offline. +3. **Components whose CSS-missing state is *broken* carry their own critical layout.** + The embedded creator's iframe keeps its sizing inline (and `sizeWPFrame()` re-applies + it), and the work-package panel injects a floor of positioning rules from + `wp-creation-app.js`. Both had failure modes — a 300×150 iframe, and panel controls + dumped loose into the form — that a missing rule turned into a broken page rather + than a plain one. + +If you change the shell file list in `sw.js`, bump `CACHE`. diff --git a/html/admin.html b/html/admin.html index ab0f2e3..4fbdcbc 100644 --- a/html/admin.html +++ b/html/admin.html @@ -5,6 +5,9 @@