calendar
All repositories: gitoria
5.0 KB
# P1 — a calendar reminder shown TWICE on the creator's Android Chrome, and ~5 min late## Evidence (live log of byrodin, read only; backup copy of 2026-10-22 19:47, deleted afterwards)- The live log has ONE `push sent (201) for 0mvkoh019mjp:1792758600000` at 2026-10-23 12:30:23.857 UTC. The key's instant is12:30:00 UTC (= 14:30 Vienna). The event id was created 07:58 UTC the same day. The server therefore sent ONE push to ONE subscription,23 s after the due time (the clock ticks every 30 s; the tick before, 12:29:53, had nothing due). **The server scheduler is not the 5 minutes**:at most 30 s late by design; the rest is delivery (FCM / Doze / the phone) or the page.- No `push not sent` line; the only other push line in 24 h is `push test sent (201)` 2026-10-22 15:44. The server restarted once(container up 21 h, two "listening" lines 3 s apart are the deploy's up + restart, one process).- Subscription table (backup copy, 22 Oct 19:47 — the newest backup; it predates the event): ONE live row, owner `0muh8y8myb5z`(the creator; the event owner id), endpoint host `fcm.googleapis.com`, zone Europe/Vienna, created 2026-10-22 15:48:23 UTC,since 17:46:43 UTC (moves every 30 s), test 0. The older row `0mvj6lex2l83` (created 06:49 UTC) was deleted at 15:44 (a 410 after the browser rotatedits subscription). So no second subscription of the same device; a second *send* path is excluded by the log (one line). The live table could not be read.- Service worker: ONE `push` listener (workerEntry in WebFramework.hl) → `pushed()` → one `showNotification(tag = key)`. One registration, scope `/`(`pushSubscribe` registers the same entry script at the same scope; the page's `getRegistration()` is that one). `testRound`/test path: one line only on 22 Oct.## Cause found (ours, proven in real headless Chrome): the PAGE shows the reminder twice by itself, and again after the push`month-view.hl arm()` shows the reminders that came due while the page could not run ("missed", also the late 5 min case: a frozen/dropped Android tabcomes back) and sets the timers. It is called from FIVE places that all fire when a tab is shown again: `browserEnv` end, `pageshow`, `visibilitychange`,`takeSoon` (the server's answer), the 10-minute `monthEnv`. Its `notify` calls wait for the browser, and `remember(now)` comes AFTER them, so the secondcall (2 ms later) starts with the same `since` and shows the same reminder again (and a run interleaved with another leaves timers behind that are never cleared).Measured on the old tree (tests/push-twice.mjs, control "bob", no push): `showNotification` called TWICE for one missed reminder, 1–2 ms apart,same tag. Chrome on Android shows a same-tag repost as a new alert; with the push (tag the same, 23 s after) a third post.Second, independent path: the server pushed the reminder (shown on the phone, then tapped / swiped away), then the page opensand `arm()` shows the SAME reminder again as "missed" — the page only knows its own localStorage, not that the server already pushed it(old tree, "alice": the page re-showed it, twice). A same-tag repost only replaces a notification that is still shown.That together = "twice, and late": the push (or nothing on time while the phone dozed), then the tab thawing at ~5 min.What I cannot prove from here: why the phone showed it ~5 min late (FCM delivery under Doze / battery saver, or the thawed page: both end in the same page code).## Fix (all .hl, commit on p1-twice)- `arm()` runs one at a time (`arming` / `armAgain`; a call that comes while one runs makes it run once more afterwards).- `lib/push.hl pushedUntil` + face `calPushedUntil` (calendar.hl): up to when the server has handled this device's reminders (its `since`, only if the serverlooked in the last 15 min). The page's `pushedSince` raises its "missed" start to that. No subscription / no answer / server stale → as before (the net stays).- Gate `tests/push-twice.mjs` (in deploy.sh GATES): 1 server pushes once to the closed device; 2 the reopened page shows NOTHING of it; 3 control: a devicewithout push still gets its missed reminder from the page, EXACTLY once. On the old tree: 3 passed, 2 failed (2 and 3: two `showNotification` calls each).## Gatesbrowser 86 passed; theme 0 problems; notify-paths 7 passed (3 known Hybriel gaps); push 30 passed; push-twice 5 passed (old tree: 3 passed, 2 failed); dst 13 passed. Ports 8700–8719.## What the creator should check on the phone (if it still happens after the deploy)- Chrome → the calendar site → Settings → Notifications: the calendar must exist ONCE (not also as an installed app / second "Calendar" entry; an installedPWA and a Chrome tab share the worker, but two entries mean two channels that each show a copy).- Android: Settings → Apps → Chrome → Battery: "Unrestricted" (not Optimized/Restricted), and no battery saver; Chrome → Site settings → the calendar:Notifications allowed. Doze delays push for Chrome when restricted — that is the ~5 minutes.- Reminder settings in the calendar: "Turn off on this device", then "Turn on notifications" once (a clean single subscription).
Branches
Latest commits
- f9b8f918Merge branch 'calendar-vendor-day61' into mainAtlas
- 66341793|||PR Vendor Hybriel day61Atlas
- 36fc596bMerge branch 'vendor-day59' into mainAtlas
- b37cc1da|||PR Vendor Hybriel day59Atlas
- 05665102Merge branch 'vendor-day56' into mainAtlas
- 687296fb|||PR Vendor Hybriel day56Atlas
- a6166d4eMerge branch 'hl-standard-3' into mainAtlas
- 6d0eb3b0|||PR Calendar day add buttons only when signed in (Kunibert minor)Atlas
- add4b499|||PR Make calendar day actions keyboard accessibleAtlas
- 79e49b4dMerge branch 'hl-standard' into mainAtlas
- e9fec7bb|||PR HL-STANDARD clean-up: typed parameters, plain locals, by-reference cacheAtlas
- eff166a4Re-vendor complete Hybriel plugins and runtime to day44mre
- cef81394Wait for the DST fixture page instead of an unused socketmre
- 42434f47Check lazy-session cookies after login with a stored anonymous fixturemre
- 728e84e3Re-vendor complete Hybriel day41 plugin directoriesmre
- cbd7ff43Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
- 59d1da0acalendar: plain declarations instead of needless let in 9 files (calendar#17): 49 declarations that are never reassigned; reassigned ones and the timer closure's p stay letmre
- f5415cf9calendar: the Style blocks in the language's nested form (calendar#16): rules named after the View's own elements with their children nested, pseudo-classes and @media nested, merged duplicate select rule; same CSS, shots identical in Chrome at 4 sizesmre
- edb7c947calendar: the sign-in callback keeps the session it finds and signs it in (same cookie, nothing signed out; ident#28); security gate 56+4 failing → 60 passedmre
- bf8cc0fcStyles move into their components: the shell's styles into main.hl, the events and the editors into the month view's Style block; styles.hl keeps only the theme inherit, the accent and the message line; .gitignore ignores a bin symlink too; tests/styles-shots.mjs for the before/after pixel comparemre