chore: correct comments that describe the removed clear push and API cache

The dose tag comment still explained the clear push sent for a logged
dose, the session-end wipe comment still named the worker's API cache as
a live layer, and the worker's header and foreign-origin note did not
match what the worker stores and when it resumes.
This commit is contained in:
Marc-André Bombeck committed 2026-11-12 14:09:18 +01:00
1 parent d15fb27bce
commit e498a44d70
4 files changed
+14 -23

No files matched your search

+3 -3
View File
@@ -1,7 +1,7 @@
/**
* HealthLog service worker: Web Push, a page cache for public pages, and a
* static cache for catalogs and icons. API answers and app chunks are never
* stored here.
* static cache for catalogs, icons, fonts and images. API answers and app
* chunks are never stored here.
*/
// Cache names carry the release, so `activate` drops every older cache. The
@@ -28,7 +28,7 @@ const CURRENT_HEALTHLOG_CACHES = new Set([STATIC_CACHE, PAGE_CACHE]);
// Set by `src/proxy.ts` on every HealthLog page; same name as there.
const HEALTHLOG_PAGE_MARKER_HEADER = "X-HealthLog-Page";
// While set, the fetch handler declines every request. Set when a page looks
// like another app, cleared when `confirmForeignOrigin` finds HealthLog.
// like another app, cleared unless the probe confirms another app.
let foreignOrigin = false;
// One confirmation at a time, shared by a burst of navigations.
let foreignOriginCheck = null;
@@ -1,7 +1,7 @@
{
"$comment": "Comment lines that open with a release version, per file under src/. Maintained by src/__tests__/version-stamp-ratchet.test.ts.",
"count": 2876,
"total": 9163,
"count": 2875,
"total": 9162,
"entries": {
"__tests__/account-payload-consumer-guard.test.ts": 2,
"__tests__/acting-account-boundary-guard.test.ts": 7,
@@ -2581,7 +2581,6 @@
"lib/notifications/delegated-intake.ts": 2,
"lib/notifications/dispatch-localised.ts": 3,
"lib/notifications/dispatcher.ts": 3,
"lib/notifications/dose-tag.ts": 1,
"lib/notifications/medication-intake-sync.ts": 1,
"lib/notifications/senders/__tests__/apns.test.ts": 7,
"lib/notifications/senders/__tests__/push-attempt-record.test.ts": 1,
+4 -4
View File
@@ -626,10 +626,10 @@ export function useAccountOnceMounted(): AuthUser | null {
* former explicit `setQueryData(null)` + `invalidateQueries(["auth"])`.
*
* Then `clearOfflineCachesForSessionEnd()` wipes the persisted layers — the
* IndexedDB query snapshot, the SW offline read-data cache (`healthlog-data-*`),
* and the SW page cache (`healthlog-pages-*`, cached navigation HTML). The static
* cache (hashed chunks, icons) carries no PII and stays intact to avoid a
* needless re-download. Best-effort; never blocks the redirect.
* IndexedDB query snapshot, the SW page cache (`healthlog-pages-*`, cached
* navigation HTML) and any API cache an older worker left (`healthlog-data-*`).
* The static cache (catalogs, icons, fonts, images) carries no PII and stays
* intact to avoid a needless re-download. Best-effort; never blocks the redirect.
*/
export function clearCachesForSessionEnd(queryClient: QueryClient): void {
queryClient.clear();
+5 -13
View File
@@ -1,18 +1,10 @@
/**
* v1.18.4 — stable Web Push notification tag for a medication dose slot.
* Stable notification tag for a medication dose slot, `(medicationId,
* scheduledFor instant)`. A repeated reminder for the same dose replaces the
* one already shown instead of stacking a second.
*
* A PWA self-hoster with no Apple Developer account has no Live Activity to
* end when a dose is logged. Instead the server pushes a `type: "clear"`
* web-push that the service worker turns into `getNotifications({ tag })` +
* `notification.close()`. For that to work the REMINDER push and the CLEAR
* push must agree on a single, stable tag per dose slot.
*
* The slot is uniquely identified by `(medicationId, scheduledFor-instant)`:
* - the dose-due reminder fires with `scheduledAt` = the slot's ISO instant,
* - the clear-on-taken fires with `scheduledFor` = the same ISO instant.
*
* `scheduledFor` is normalised through `Date` so a reminder ISO carrying
* milliseconds and a clear ISO without them still collapse to one tag.
* The instant is normalised through `Date`, so an ISO string with and one
* without milliseconds give the same tag.
*/
export function medicationDoseTag(
medicationId: string,