gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainf9b8f918Merge branch 'calendar-vendor-day61' into mainAtlasmain/reports/P1-twice.md

5.0 KB

  1. # P1 — a calendar reminder shown TWICE on the creator's Android Chrome, and ~5 min late
  2. ## Evidence (live log of byrodin, read only; backup copy of 2026-10-22 19:47, deleted afterwards)
  3. - The live log has ONE `push sent (201) for 0mvkoh019mjp:1792758600000` at 2026-10-23 12:30:23.857 UTC. The key's instant is
  4. 12: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,
  5. 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**:
  6. at most 30 s late by design; the rest is delivery (FCM / Doze / the phone) or the page.
  7. - 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
  8. (container up 21 h, two "listening" lines 3 s apart are the deploy's up + restart, one process).
  9. - Subscription table (backup copy, 22 Oct 19:47 — the newest backup; it predates the event): ONE live row, owner `0muh8y8myb5z`
  10. (the creator; the event owner id), endpoint host `fcm.googleapis.com`, zone Europe/Vienna, created 2026-10-22 15:48:23 UTC,
  11. 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 rotated
  12. its 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.
  13. - Service worker: ONE `push` listener (workerEntry in WebFramework.hl) → `pushed()` → one `showNotification(tag = key)`. One registration, scope `/`
  14. (`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.
  15. ## Cause found (ours, proven in real headless Chrome): the PAGE shows the reminder twice by itself, and again after the push
  16. `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 tab
  17. comes back) and sets the timers. It is called from FIVE places that all fire when a tab is shown again: `browserEnv` end, `pageshow`, `visibilitychange`,
  18. `takeSoon` (the server's answer), the 10-minute `monthEnv`. Its `notify` calls wait for the browser, and `remember(now)` comes AFTER them, so the second
  19. call (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).
  20. Measured on the old tree (tests/push-twice.mjs, control "bob", no push): `showNotification` called TWICE for one missed reminder, 1–2 ms apart,
  21. 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.
  22. Second, independent path: the server pushed the reminder (shown on the phone, then tapped / swiped away), then the page opens
  23. and `arm()` shows the SAME reminder again as "missed" — the page only knows its own localStorage, not that the server already pushed it
  24. (old tree, "alice": the page re-showed it, twice). A same-tag repost only replaces a notification that is still shown.
  25. That together = "twice, and late": the push (or nothing on time while the phone dozed), then the tab thawing at ~5 min.
  26. 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).
  27. ## Fix (all .hl, commit on p1-twice)
  28. - `arm()` runs one at a time (`arming` / `armAgain`; a call that comes while one runs makes it run once more afterwards).
  29. - `lib/push.hl pushedUntil` + face `calPushedUntil` (calendar.hl): up to when the server has handled this device's reminders (its `since`, only if the server
  30. looked 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).
  31. - 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 device
  32. without 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).
  33. ## Gates
  34. browser 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.
  35. ## What the creator should check on the phone (if it still happens after the deploy)
  36. - Chrome → the calendar site → Settings → Notifications: the calendar must exist ONCE (not also as an installed app / second "Calendar" entry; an installed
  37. PWA and a Chrome tab share the worker, but two entries mean two channels that each show a copy).
  38. - Android: Settings → Apps → Chrome → Battery: "Unrestricted" (not Optimized/Restricted), and no battery saver; Chrome → Site settings → the calendar:
  39. Notifications allowed. Doze delays push for Chrome when restricted — that is the ~5 minutes.
  40. - 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