gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Branchmainf9b8f918Merge branch 'calendar-vendor-day61' into mainAtlasmain/reports/008-webpush.md

8.0 KB

  1. # Report 008 (A7): calendar#9 part 2 — Web Push
  2. Branch w8-webpush (worktree A7/wt), not pushed, not deployed, no .env read. Hybriel master 0e3c9830: bin/hybriel sha256 9d957fed77d0bd7f0bfeb3b90beb358b524d24d555f63578d3340ecd63706b65, plugins/ whole from master.
  3. ## Step 1 — re-vendor (commit cf175c8). Gates, pristine re-vendored tree, own cold cache
  4. | gate | before (f9833544) | after (0e3c9830) |
  5. |---|---|---|
  6. | tests/browser.mjs | 81/0 | 81/0 |
  7. | tests/notify-paths.mjs (port 8732) | 7/0 + 3 gaps | 7/0 + 3 gaps (a run at 8788 failed only because 8795 is foreign) |
  8. | theme/check-theme.mjs | 0 problems | 0 problems |
  9. ## Step 2 — what was built (all Hybriel)
  10. - `lib/push.hl`: table push.db, `savePush` / `dropPush`, the clock (`every`), `sendPush` per due reminder, drop on 404/410, retry up to 15 min when the service answers 5xx.
  11. - `lib/push-plan.hl`: server copy of the reminder plan on hl:time `fromLocal`. WHY A COPY: **Hybriel gap**, a static that calls hl:time `fromLocal` is refused in a component's browser build ("'viaStatic' is a static … whose initializer reaches 'instantOf', a name the realm 'client' … cannot bind"). Repro: `.scratch/hltime-client/` (page.hl, calc.hl, run.mjs). Delete the copy when fixed.
  12. - Faces `calPushSave(sub, zone)` / `calPushOff(endpoint)` (calendar.hl); `month-view.hl`: tapping "Turn on notifications" (or the first pointer on a device that already allowed them) subscribes and saves; text "Reminders also reach this device when the calendar is closed." (else "…while the calendar is open on this device.").
  13. - project.hl: `CALENDAR_PUSH_PUBLIC / _PRIVATE / _SUBJECT` → pushKey / pushPrivateKey / pushSubject (all or none). `tools/vapid-keys.hl` makes the pair (hl:crypto). README "Web Push" says how deploy sets it. No key committed.
  14. ## Step 3 — proof
  15. - `tests/push.mjs` (PUSH_GATE_PORT=8788): real headless Chrome as a 390 px phone, real touch tap on the button, subscribe stubbed (headless has no push service), then the browser is CLOSED; local fake push service decrypts like a user agent. **New 9/9, old (re-vendored tree without the feature) 0/9.** Checks: page text after the tap; subscribe got the VAPID key; the encrypted push arrives once at the reminder time (0 s late) with title "Zahnarzt Push", body "Starts in 1 minute"; VAPID JWT verifies with the public key; no duplicate; on 410 the subscription is dropped (second reminder not sent to it).
  16. - Real FCM (tests/push-real.mjs, lisbeth's Chrome 155, one tab reused, under the lock): the tab subscribed through **fcm.googleapis.com** (real tap path = pointer + permission already given), the app on loreana (reverse tunnel, app only SENDS) sent at the reminder time with the page on about:blank: server log `push sent (201)`. **Not proven:** that the notification was displayed — the service worker target was gone and `getNotifications()` afterwards was empty (could be already dismissed; the page screenshot hung on lisbeth's non-visible tab). So real end-to-end display is unverified; delivery to FCM (201) is.
  17. - Evidence: /media/STORAGE/claude-scratch/atlas-evidence/A7/ (ok-2-subscribed.png: phone shot after the tap showing the new text; logs).
  18. ## Gaps
  19. 1. hl:time `fromLocal` in a browser static (above).
  20. 2. Real notification display on a device not observed (above); no "turn off on this device" button yet (face `calPushOff` exists).
  21. 3. Pre-first-touch behaviour of part 1 unchanged (GAP 2): subscription of a device that already allowed notifications happens at its first pointer, not at load (the `shown` hook is not used).
  22. 4. W50: nothing relied on server members; subscriptions are in the table.
  23. ## A8 finish (turn off, subscribe on show, final gates, real FCM display proof)
  24. Branch w8-webpush, not pushed, not deployed, no live .env read. Evidence: /media/STORAGE/claude-scratch/atlas-evidence/A8/.
  25. - **Turn off on this device** (`#push-off`, button right under the on-state text, 44 px high, only shown while this device is subscribed): in Hybriel (`on pushOff` in month-view.hl: `navigator.serviceWorker.getRegistration()` → `pushManager.getSubscription()` → `unsubscribe()` → `emit server calPushOff(endpoint)`; no JS, no gap). The choice is kept in localStorage (`calendar-push-off-<user>`) so a reload / later show does not subscribe again; "Turn on notifications" is offered again and undoes it. In lisbeth's real Chrome: subscription before = fcm.googleapis.com, after the click `getSubscription()` = none, text "Reminders show while the calendar is open on this device."
  26. - **Subscribe when already allowed**: `on client shown(r) { browserEnv() }` subscribes/refreshes whenever the app is shown again (tab visible, pageshow). NOT at the very first load: measured, the first `pageshow` comes before the components are hydrated, Hybriel's `shown` hook only hears later shows (and `reconnected` never the first) — so on first load it is the first pointer, as before. Page asks the browser for a subscription only when the server has the VAPID settings (`pushAvailable` ← `lib/util.hl pushConfigured`); without them (browser gate) nothing is asked and the console stays clean.
  27. - **Gates on the final code (head after the last commit)**: tests/browser.mjs 81/0; tests/notify-paths.mjs 7/0 + 3 Hybriel gaps (unchanged); theme/check-theme 29 files 0 problems; tests/push.mjs **16/16** (9 old + part 3: shown-again subscribes without touch, off control 44 px, tap unsubscribes the browser, control gone / "Turn on" back, reload does not resubscribe, **no push to the device after off**, same reminder still reaches the owner's other device). On main 186f969 (+ the vendored bin/plugins, since main has no bin) push.mjs fails: 0 passed, 2 failed (no subscribe, no text). An earlier browser run (80/1) found the console warning "subscribePush needs the app to set pushKey" → fixed by `pushAvailable`, whole sequence rerun. Load was 10–42 during the runs; no check needed a second try after the fix.
  28. - **Real FCM + visible notification** (tests/push-real-app.mjs outside the lock, tests/push-real.mjs under `timeout 600 flock -o`; app on loreana, host `localhost:8789` via ssh -R, own ident, fresh VAPID pair, one existing about:blank tab reused, fresh login each run): the page subscribed through **fcm.googleapis.com**, event 2.5 min ahead with a 1-min reminder, the calendar page stayed open; at the reminder time the app log says `push sent (201) for 0mvijc09clk0:1792612860000` and `registration.getNotifications()` read from the page = `[["Real push","Starts in 1 minute","0mvijc09clk0:1792612860000"]]` (tag = the push's tag). Screenshots real-3-on.png, real-4-notified.png. **Not separable**: with the page open the page's own timer shows the same notification with the same tag (one notification replaces the other), so this proves "FCM accepted the push (201) and a notification with the push's tag is shown by the service worker", not that the push alone created it; the OS-level toast of lisbeth's desktop cannot be captured from CDP. Closed-page delivery stays proven by the fake push service (decrypting user agent, push.mjs) + the A7 FCM 201 run.
  29. - Shots (looked at): shot-1280-on.png (one row: text · "Turn off on this device" · "Reminder settings"), shot-1280-off.png (blue "Turn on notifications" · "Reminders show while … open on this device." · settings), shot-390-off.png (button full-width block, text under it, settings), real-3-on.png at 390 (text, then "Turn off on this device" as a quiet 44 px button, then "Reminder settings"). Layout clean, no overlap. The off control is a quiet text button like "Reminder settings" (same theme style).
  30. - **Deploy must**: put into the live `.env` of calendar (Atlas): `CALENDAR_PUSH_PUBLIC` (VAPID public key, base64url), `CALENDAR_PUSH_PRIVATE` (32-byte scalar, base64url), `CALENDAR_PUSH_SUBJECT` (`mailto:…` or `https://…`) — all three or none; make the pair with `bin/hybriel tools/vapid-keys.hl` (see README "Web Push"); optional `CALENDAR_PUSH_EVERY` (s, default 30), `CALENDAR_PUSH_LATE` (s, default 900). Keep the pair stable (a new pair invalidates all subscriptions). Storage gets `push.db` by itself. Nothing else.
  31. - Gaps left: hl:time `fromLocal` in browser statics (repro .scratch/hltime-client); no hook for the very first load (above).

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