Skip to content

Keep remote persistent notifications in sync - #53

Merged
pjeweb merged 18 commits into
osb/integrationfrom
osb/pr/relay-notifications
Nov 15, 2026
Merged

pjeweb merged 18 commits into
osb/integrationfrom
osb/pr/relay-notifications

Conversation

@pjeweb

@pjeweb pjeweb commented Nov 13, 2026 •

Copy link
Copy Markdown

Why

Someone watching a box remotely, a moderator or a helper through the cloud or the legacy remote connection, can miss a warning from the box, keep seeing one that has already cleared, or get an outdated list after reconnecting. They then act on the wrong picture of what's going on with the stream.

What

  • When a remote client connects, the box sends its current list of lasting warnings, and sends it again whenever it changes. Cleared warnings disappear on the remote side too.
  • A warning that keeps flapping doesn't flood the connection: the list goes out at most once a second, but a new problem or a rise in severity goes out straight away.
  • A very long list keeps the most severe warnings and ends with a note saying how many more are on the box.
  • Remote warnings are short, fixed English summaries without details or identifying names. Full text, translations and dismissing stay in the box's own web app.

How: the box checks its warning list every 250 ms and only sends when it changed. Every frame carries the complete list (full: true) and an epoch, a random id for the running backend, so the CeraUI client replaces its whole list and can tell when the box has restarted. A shared filter swaps free-form warning text for fixed summaries before anything leaves the box. Cloud frames are checked against the control protocol before sending.

Sits on #63 (the remote status allowlist), and needs #95 first for the build size limit.

Screenshots

Mock data; the same state at the PR base and head.

Before After
Before: Previous-session notice after an empty remote snapshot (390 px) After: Previous-session notice after an empty remote snapshot (390 px)
Before: Previous-session notice after an empty remote snapshot (1280 px) After: Previous-session notice after an empty remote snapshot (1280 px)

How to verify

Run apps/backend/src/modules/remote/notification-relay.test.ts and notification-catalog-sync.test.ts. They cover connect, change and clear, a warning toggling every 250 ms for ten seconds (at most one frame a second, settled state within a second), 401 warnings fitting into one frame with the summary, and a restarted box being heard by a browser that stayed connected.

Testing and limits
  • Full backend and frontend suites, rpc, i18n, sender, lint, type checks and the production build pass, also together with Bound remote status with an explicit payload allowlist #63 on the current integration base.
  • A clear can take up to about 1.25 s to reach the remote side.
  • Epochs have no order, so a late frame from an older backend the client never saw can't be recognised as old.
  • If removals don't fit next to a cut list they're left out; the full list still retracts them, but a consumer that ignores full and merges by id would keep them.
  • Hub-side replay and mobile push delivery are separate work. Not deployed or tried on hardware.

Risks

Remote viewers now see fewer details than the local app, by design. Older remote clients that ignore full still get correct additions.


Checklist

  • Docs updated if behavior or structure changed (Rule A: AGENTS.md within budget, README, docs/, versions.yaml)
  • User docs (Rule G): no user-visible change, OR ceralive-docs PR updates English and Spanish, plus ceralive-website PR if a landing claim changed
  • Started from updated main; branch rebased on latest canonical branch (Rule B)
  • Rule D local-scratch reference check passes for tracked files
  • Tests pass; QA evidence attached or linked

…epochs

The cloud relay sent `type: "notification"`, which the pinned control
protocol's strict status schema rejects; its closed set spells the type
`notifications`. Send the plural and check every emitted frame with the
package's own `strictParseFrame`. The singular remains the local browser
event name.

Names, revisions, seq and the sent-set are scoped to one backend process,
so after a restart the first frame could not retract earlier notices and a
client fencing by seq would drop the new ones. Every frame's `show` is the
complete list; mark it with `full: true` and a per-process `epoch` in the
payload (the strict envelope strips unknown top-level fields). The client
replaces its persistent notices on a `full` frame; local frames are
unchanged.

Detect changes by projected content instead of revision, so a producer
re-raising the same condition no longer re-sends the list several times a
second. The cloud path writes through the control channel's `sendFrame`.
Remote notification frames carry a per-process epoch, but the client never
read it. A device restart starts its seq again at 1 while the browser can
stay connected, so the existing fence dropped the restarted device's frames
until the browser reconnected, and a late frame from the old process could
re-show its notices.

A full frame from a new epoch now resets the notification seq entry and
becomes the current epoch. Frames from an epoch already replaced are
ignored without moving the fence, and a partial frame from an unknown epoch
is not merged. Local frames, which carry no epoch, are unchanged. Epochs are
unordered random ids, so a frame from a process the client never saw cannot
be recognised as old.
A list too large for one frame was held back entirely, including
all-links-down, with nothing logged. The relay now keeps the most severe
notices that fit, in their original order, adds a summary notice saying how
many more are on the device, and logs the first cut once.

A notice that keeps clearing and returning re-sent the full list on every
250 ms tick. Frames are now limited to one per second carrying the latest
state. A notice the remote side has not had in the last ten seconds, or a
severity rise, still goes out on the tick it appears.

Cloud frames are checked with the pinned protocol's strictParseFrame before
sending (about 10 us per frame). A rejected frame is not sent, is logged once
and the latest state is retried. The check covers the envelope; the payload
is an open record, bounded by the projection.
@pjeweb
pjeweb marked this pull request as ready for review November 14, 2026 09:03
@pjeweb
pjeweb merged commit 44ed152 into osb/integration Nov 15, 2026
3 checks passed
pjeweb added a commit that referenced this pull request Nov 16, 2026
@pjeweb pjeweb added the upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal. label Nov 16, 2026
pjeweb added a commit that referenced this pull request Nov 17, 2026
pjeweb added a commit that referenced this pull request Nov 17, 2026
pjeweb added a commit that referenced this pull request Nov 18, 2026
pjeweb added a commit that referenced this pull request Nov 18, 2026
pjeweb added a commit that referenced this pull request Nov 19, 2026
pjeweb added a commit that referenced this pull request Nov 21, 2026
pjeweb added a commit that referenced this pull request Nov 22, 2026
pjeweb added a commit that referenced this pull request Nov 23, 2026
pjeweb added a commit that referenced this pull request Nov 24, 2026
pjeweb added a commit that referenced this pull request Nov 24, 2026
@pjeweb

pjeweb commented Nov 25, 2026

Copy link
Copy Markdown
Author

Still carried in the integration train and not upstream, so it continues as #247.

pjeweb added a commit that referenced this pull request Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream: waits for intent Needs an issue or maintainer agreement before an upstream proposal.

Development

Successfully merging this pull request may close these issues.

1 participant