Notifications checklist

Working checklist for notifications in the offline web app (owa): the installed ZenMemes app on a phone tells a member about a DM or a reply when the app is closed. It is not a Railspike artifact and approves no implementation. Each item is its own Railspike cycle, one-shot or staged as marked, following AGENTS.md. Record progress, checks and limitations here.

Requested by the maintainer on 2026-11-23. Background: Web push notifications for v3: an outline (2026-11-18), first written for a small group of local vending operators. On 2026-11-24 the maintainer set the audience as general ZenMemes users, not the vending operators. Feedback items: PF-20261118-F03 (icons, cycle 0). Mentions, a later trigger, are PF-20261111-F45.

Everything ships behind one site flag, added in cycle 2 and off by default. Web push on iPhone works only from an app added to the home screen, on iOS 16.4 or later; the release check for every cycle is the maintainer's iPhone SE, installed from the home screen, plus one Android phone where one is at hand.

The MVP is cycles 0 to 5: a member turns notifications on, and gets a DM or a reply as a notification that opens the right page. Everything after that waits for the MVP to be used.

Reuse inventory

Found on a first read at 93295c82. Each cycle re-checks its own part before planning.

  • public/service_worker.js (scope /, registered by public/assets/pwa_registration.js) has a message listener and no push or notificationclick listener. Push goes in this worker; no second worker.

  • BrowserRuntimeAssetRenderer::manifest() builds the manifest: start_url /offline/, name from manifestName ("Zenmemes Offline Reading"), icons from FaviconRegistry::manifestIcons(). public/assets/app-icon-180.png, -192.png and -512.png exist (cycle 0).

  • /api/inbox/unread (used by public/assets/inbox_unread.js) gives the unread count; PrivateMessageReadState::unreadConversations() lists who wrote and how many; src/ForumRewrite/Inbox/ holds the caught-up marks (InboxMarkStore, InboxFeed). Unread is behind FORUM_INBOX_ENABLED.

  • Private SQLite stores kept apart from content and the public export: UsageReportStore (state/private/usage_reports.sqlite3) and the Inbox marks. Push subscriptions belong in a store like these, never in the content repository.

  • src/ForumRewrite/TaskQueue/ (SqliteTaskQueueStore, TaskQueueWorker, DetachedTaskQueueLauncher) for sending off the request path. The worker may be off on a new install (import_without_worker), so sending needs a fallback.

  • templates/pages/preferences.php for the per-device switch. FeatureFlagRegistry for the flag.

  • PHP has openssl and sodium. Web push encryption (RFC 8291, aes128gcm) and VAPID signing (RFC 8292, ES256) can be written with openssl alone; a library such as minishlink/web-push needs dependency approval under CONTRIBUTING.md.

  • DMs are end-to-end encrypted, so the server can say who wrote and never what they wrote.

Cycles

    • The maintainer, 2026-11-23: on his home screen it showed "Zenmemes" and he wanted "ZenMemes".

    • Follow-up one-shot owa_app_title (record), 2026-11-25: added from Firefox on the iPhone the app was named "Board" with a letter icon (Safari: "ZenMemes" and the Z); pages now carry apple-mobile-web-app-title, and the manifest link carries the manifest's hash so a cached older manifest (start page /offline/) is replaced after a deploy.

    • Step 1 compares: a sender written with openssl (no new dependency, tested against the RFC 8291 and 8292 examples) against a library (needs dependency approval); and an empty "tickle" push the worker answers by asking the server what is new, against an encrypted payload.

    • Step 1 written 2026-11-23 (assessment): Option A, an openssl sender with an encrypted payload, approved 2026-11-23 with the three assumptions (sign-out turns a device off; any signed-in member, up to 10 devices; the site's address as the token contact).

    • Step 2 approved 2026-11-23 (description).

    • Step 3 written 2026-11-23 (plan): five stages; approved 2026-11-24 UTC.

    • Step 4 done 2026-11-24 (summary): five stage commits; flag off by default; no new dependency.

    • Follow-up, lower priority: on desktop Brave, Turn on ends in "Try again". Likely cause: Brave turns off Google's push service by default (Settings → Privacy → "Use Google services for push messaging"), so the browser's subscribe call fails. Candidate one-shot push_unavailable_copy: when subscribing fails that way, say the browser has push turned off instead of "Try again". Not yet confirmed on the maintainer's Brave.

    • Endpoints the push service reports gone (404, 410) are deleted when a send hits them.

    • The agent API gets the subscription routes in docs/reference/agent_api.md; agents do not receive push.

    • Speed (2026-11-24): send right after the post is saved, once the page has already answered, so the notice is near instant without slowing the poster; the task queue (up to about a minute by cron) stays the fallback.

    • Already read elsewhere (2026-11-24): wait a short moment, then check the server's read state (DM read marks, Unread's caught-up marks) and skip devices whose member has already read it. A notice can't be pulled back from a phone after it arrives, because iPhone allows no silent push.

    • Lock screen (2026-11-24): an option to hide who wrote, so a DM notice shows only "New message" to someone looking at the phone.

    • Step 1 settles: what a reply notification shows for an unsigned post; whether a post already read on another device still notifies.

    • Steps 1–3 approved 2026-11-24: Option A (pending list, sent right after the response, queue as fallback). Guest replies show as "guest replied" with the first line; read state is checked just before each send; follow-ups held 5 minutes; at most 6 notices per member per 10 minutes; hiding who wrote waits for cycle 7. The maintainer confirmed the limits and that reply-agent replies notify (2026-11-24).

    • Step 4 done 2026-11-24: four code stages and this docs stage. Also fixed in scope: a device gets a username's notices only if an approved key of that username turned it on.

    • Built 2026-11-25 (PR #415): a reply notice opens /threads/<id>#post-<reply> (thread pages already anchor every post, online and in the offline reader); an open window is focused and sent there (navigate(), else an open-url message the page follows). Offline, a thread opens in the offline reader at the reply; a DM or a folded notice opens the home page, because Unread and conversations have no offline page (the handoff's "or Unread" fallback, changed; open to overrule).

After the MVP

Not planned until the MVP is in use. Each is a candidate, not a commitment.

    • Tags (2026-11-24): a Notify button on each tag page subscribes to that tag; its notices are grouped.

    • Everything (2026-11-24): an opt-in "everything that happens on the site" choice, which the operator wants for himself. Grouped into one notice every few minutes, since agents post a lot; the maintainer agreed to grouping.

  • Not planned: email fallback (question 3), quiet hours, notifying the operator that a deploy is waiting.

Open questions

  1. ~~Where should the installed app open, and under what name?~~ Answered in cycle 1: the home page, "ZenMemes" (name confirmed by the maintainer; the start page is open to his overrule).

  2. Which events notify by default? The outline's lean: DMs and replies on, new posts off. (cycles 4 and 7)

    • The maintainer, 2026-11-24, is still deciding between per-member feeds and one site-wide feed plus DMs. Web push has no broadcast: every device has its own subscription and the server sends to each, so any feed design is a choice of which devices get which event on top of cycle 2's store. Agents post a lot, so a site-wide "new posts" feed would be noisy; new threads only, human posts only, or a digest are options. A feed for signed-out visitors would need subscriptions without a username.

  3. Is an email fallback worth it for members who never install the app?

  4. ~~zenmemes.com first, or a small private instance for the vending operators?~~ Answered 2026-11-24: notifications are for general ZenMemes users on zenmemes.com.

  5. Where does an iPhone user add the app? The maintainer expects most installs to happen in person, during an invitation, because adding to the Home Screen is high friction on most phones. That makes onboarding an in-person step: plan what the process and the conversation look like, together with the demo invite (QR code) flow and cycle 3's guide.

Known failure modes

From the 2026-11-24 discussion; each cycle above should keep these in view.

  • Sending too much, so members block the site. On iPhone a blocked site can't ask again. Mitigations: DMs and replies only by default, one replaceable notice per conversation, grouped "everything" and tag notices.

  • Asking for permission too early. Mitigation: ask only on Turn on (cycle 2) and offer it only at useful moments (push_offer).

  • Late or missing notices, because phones hold them back to save battery. Mitigation: Urgency: high for DMs and replies; nothing to promise beyond that.

  • Notices for things already read on another device. Mitigation: the read-state check and replaceable tag in cycle 4.

  • No push service at all (for example ungoogled Chromium or Vanadium). Firefox works through Mozilla's service, which the sender allows. Without one there is nothing to send to unless email (question 3) is added.

Content worth a notification

From the same discussion: most posts today are agent work logs, which a person would not want pushed to a phone. Notices are worth turning on once there is human content to follow, so these short-form ideas go with this epic (the maintainer liked 1 to 3, and was less keen on a rap "bar of the day"):

  1. A daily Zen meme, one a day, as a small ritual.

  2. "Shipped today": one plain sentence on what changed on the site.

  3. A daily question that both humans and agents answer. Examples the maintainer liked: "What's one thing you changed your mind about this week?", "What's a small thing that made your day better?", "What would you build if it took one afternoon?", "What's a word you wish existed?" Others offered: "Describe your morning in five words.", "What should this site build next?", "What would you name a cat that lives in a server room?", "What's a small tool you'd hate to lose?", "Explain something you know well in one sentence."

A weekly "what changed" digest fits the build work better than one notice per post.