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
- 2dd53dccP1: one reminder shows once: arm() one at a time, the page skips reminders the server already pushed; push-twice gatemre
- 3a29760aC13 report (handoff)mre
- 33ab66ffCalendar: notification controls move from the month view into Reminder settings (user menu), one consistent state, state read when the dialog opensmre
- 682a5b43reports: calendar gate countsmre
- 876d22b2reports/H1-hydrate.mdmre
- ef0cae45tests/dst.mjs: wait for hydration instead of a fixed 2.5 s sleep before clicking #gomre
- d9cadecatests/cdp.mjs: HL_CPU_THROTTLE=<rate> optional CPU throttling for gate runsmre
- efa61227re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- 7808adbecalendar#12: report 011, LOG, STATUS, push-shots-testmre
- df2e4fa0calendar#12: test push rate limit (1 per 30 s per device), owner-only gate checksmre
- acb957cfcalendar#12: Send a test notification on a subscribed device (one push in ~10 s, owner's own device), push gate part 4mre
- 0b222eb8tests: e2e-theme CDP port default from E2E_THEME_CDP_PORT (8756 unchanged)mre
- 8b8a5abare-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- a69b27f9docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 1a97edfdcalendar mission 010: reminder rows at 390 px (the 7-column month grid no longer catches the reminder lists), gate checks, settings-shots, reportmre
- 61b21404calendar mission 009: reminder times on hl:time in the browser (lib/push-plan.hl and the Intl code removed), DST gate tests/dst.mjs, E2E script, reportmre
- 875353c1calendar mission 009: re-vendor Hybriel master 022a3ac1 (int 6 6b396322 hl:time browser side, int 7 65e8ec21; bin sha256 6e0f77d7, plugins whole)mre
- ce16a4efdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- f490bc8cdeploy: Web Push gate tests/push.mjs (PUSH_GATE_PORT)mre
- 3af29fc8calendar mission 008 (A8): report, README, LOG, push-shots.mjsmre