ident
All repositories: gitoria
6.3 KB
# ident mission 011 — ident#7: delivery (daily mail at 17:00 in the user's zone, urgent at once) — gates green, NOT deployed, NOT merged (branch w11)## What works- **Daily mail** (`lib/delivery.hl`, texts + clock `lib/delivery-helpers.hl`; project.hl `delivery = new Delivery()`): a round every`IDENT_DIGEST_EVERY` s (60). Per account: `local(now, zone)` (hl:time, hybriel#5) at 17:00 or later and the stored `lastDate`≠ today's LOCAL date → the date is stored FIRST (new table `digests {account, lastDate, sentAt, count}`), then ONE mail"ident: N notifications (YYYY-MM-DD)" with every pending one (mail = daily, not mailed, email still on for its kind NOW),oldest first, ≤ 200: `* <name> — <app> · <identity>`, text (indented, line breaks kept), action link; footer = inbox link(`IDENT_PUBLIC_URL`) + where to switch. Marked `mailSent`/`mailedAt`. Nothing pending = no mail, the day still counts (laterarrivals → tomorrow). Once per local day across restarts; server down at 17:00 → sent at its first round after (same day).DST: nothing of ours, `local()` gives the wall clock.- **Urgent**: `lib/api.hl apiNotify` → `deliverUrgent(id)`: `mail = now` (fixed at arrival by the user's switches,lib/notify.hl) → mailed before the API answers, subject "<app>: <name>". Push hook for ident#8: `pushHooks.push` inlib/delivery.hl (+ the existing `hasPushDevice` in lib/notify.hl).- **Mail** through `lib/mail.hl sendNotificationMail` (hl:smtp; with `IDENT_MAIL_SINK` one JSON line per mail to `<sink>.mail`).- **Fake clock for tests only**: `IDENT_TEST_CLOCK` = a file with an epoch-ms instant that delivery takes as "now" (onlydelivery reads it; never set in docker-compose).- deploy.sh runs the new gate too (7 gates).## How the time zone is chosen (decision)Unchanged source: the browser's IANA zone at the first login (already stored since piece 1), changeable on `/` (the existingtext field + "Use this browser's", accepted by the creator 2026-09-24 — I did NOT turn it into a select: Chrome's own`supportedValuesOf` list differs from tzdata's names (it has `Asia/Calcutta`, no `Asia/Kolkata` — Node's Intl lists the same, and the gate's Chrome refused Asia/Kolkata), and the browser gatecovers the field). New: the server checks the name against hl:time's database (`isZone`) → `unknown time zone: <name>`; a firstlogin with an unknown zone stores UTC. **No zone / unknown zone = UTC** (`lib/accounts.hl zoneOf`, read-time, no migration, nothingrewritten); `/` says "Your daily mail of notifications comes at 17:00 in this time zone." under the zone — that is the"ask": the smallest thing, no extra prompt. Live data has no account without a zone (2 accounts, both Europe/Vienna).Container: debian:12-slim image has `tzdata` 2026b (checked `/usr/share/zoneinfo` in worldapi-hybriel-runtime:debian12).## Commits (branch w11)39749e0 zones via hl:time · 371ef1b sendNotificationMail · 7869f57 delivery · ab6331f tests/delivery.mjs · dfa7b78 README +deploy.sh · 6534803 gate console check (49) · + this report/LOG/STATUS.## Gates (ports 8700–8719 via `.scratch/w11/runall.mjs <tree> <out>`: temp copies with ports remapped, browser via IDENT_GATE_*,HL_PORT_BASE=8506; 8702 is held by another Chrome, never used as a server port). OLD (7a54fe7) → NEW:browser 152/0 → 152/0, apps 107/0 → 107/0, selector 99/0 → 99/0, migration 33/0 → 33/0, iplimit 39/0 → 39/0, notify 130/0 →130/0, hardening 17/0 → 17/0, signoutall 6/0 → 6/0, shortid 19/0 → 19/0, invites 44/0 → 44/0,**delivery (new) 15/34 on old → 49/0 on new** (run twice green).## New checks (tests/delivery.mjs, 49; fail on old code: 34 of them)Three real Chromes with emulated zones (Vienna, New York, "off" user) + API users Tokyo and one with an unknown zone (→ UTC).Fake clock: nothing at 05:00 UTC; urgent mailed at once, not again in the digest; urgent with mail+push off → nothing; Tokyo16:59 nothing / 17:00 (08:00Z) one mail with both, own only, text/link/identity/app, not twice; arrival after 17:00 → next day;Vienna 15:00Z, UTC 17:00Z, New York 21:00Z (16:59 = nothing each); "off" (override all → email off on the per-app page, clicks)gets nothing — switched off after arrival AND arrived switched off — and both stay pending in the store; server stopped over Tokyo's17:00 → sent at the first round after the restart, second restart same day → nothing; DST Vienna 25 Oct 2026 (15:00Z = 16:00 CET:nothing; 16:00Z: mail), New York 1 Nov 2026 (21:00Z nothing, 22:00Z mail); zone changed on `/` to Australia/Adelaide (typed, saved)→ mail at 06:30Z, not again at Vienna's 17:00; server refuses `Mars/Olympus_Mons`; account page no overflow 390/1280; console clean(after the gate's own restart only the stopped server's network errors). Screenshots .scratch/delivery-account-{390,1280}.png:I have no image viewer in this session — checked by DOM checks + a coarse pixel render (section, field, two buttons visible), not by eye.## Real data (copy of deploy-backups/ident.worldapi.org-20261019-2043.tgz, storage/mpackdb only, no .env; deleted after)- Delivery check (`.scratch/w11/rdscripts/run.mjs`, port 8705, creator's az5b2 session file, one account's zone REMOVED on thecopy to play a pre-zone account): 12/0 — creator's `/` shows Europe/Vienna + the note; urgent → sink at once; Vienna 16:59 nothing,17:00 one mail (2 notifications); the zoneless account's round at 17:00 UTC (not Vienna's), no pending = no mail, its record notrewritten; no `mail: sent`/`FAILED` in the log (SMTP_HOST empty) — only the sink got mail. Live data holds 0 notifications, sothe first live 17:00 sends nothing.- Same-output run (tests/realdata-baseline.mjs + realdata-compare.py, old vs new): 190 byte-identical, 77 after masking, 23 differ —all expected: `/` pages carry the new note line, the home module/asset hash, stored state (`digests` table, urgent ones now `mailSent`).## Hybriel gapsNone blocking. Finding (not hit by app code, all updates go through `merged(r, …)` which keeps `id`): hl:mpackdb `update(id, rec)`with a `rec` WITHOUT `id` silently changes nothing (hybriel#29 "done" fixed the key loss; now it is a silent no-op). Repro:`.scratch/w11/probe/upd.hl` vs `upd2.hl`. Not reported further by me — Atlas decides.Open: mail failures are only logged (as for codes); the inbox still shows times in UTC (out of scope).
Branches
Latest commits
- 0f6d1592Merge branch 'f18b-shell-session' into mainIdent
- 19868218|||PR ident#39 shell reads its session member instead of a cross-file emitmre
- 5d1b3fedMerge branch 'v61-day61' into mainIdent
- 83faeb15|||PR ident: vendor Hybriel day61mre
- b2572b34Merge branch 'v59-day59' into mainIdent
- 67cf016d|||PR ident: vendor Hybriel day59mre
- 600c043dMerge branch 'v58-day58' into mainIdent
- 365f8c80|||PR ident: vendor Hybriel day58mre
- 585126e5Merge branch 'f16-setf' into mainIdent
- 953bf03a|||PR ident setF mirror dropped (hybriel#370)mre
- a1419d9cMerge branch 'f15-navigate' into mainIdent
- 3b3e451f|||PR ident#36 navigate to the app instead of location.assignmre
- e36f4516Merge branch 'f14-online' into mainIdent
- 2c5eac91|||PR ident#38 online state without probe timermre
- bf1980f2Merge branch 'v56-day56' into mainIdent
- 62ae0adf|||PR ident: vendor Hybriel day56mre
- 0d18abc4Merge branch 'f13-avatar' into mainIdent
- 2a99730a|||PR ident#37 avatar in hlmre
- fa4ed25bMerge branch 'f11-upsert' into mainIdent
- 8f3d9bc9|||PR ident#42 keyed upsert and removemre