Files
mesh-catalog/modules/mesh-mail-notifier/README.md
T
jochen ed66a2e873 issue 800: fix review round 1 findings in mesh-mail-notifier
Flush now sorts accounts instead of walking a map, so notice order is
stable. A failed node-notifier.send keeps its mail pending and retries
at most once a minute, without holding up other accounts' notices, and
the failure is kept in the Store for a new health tool
(mail_notifier_health) that is unhealthy past ten minutes of failure.
The burst rule now follows the lead's reading of ADR 0378 S9: within an
account's sliding minute, the first three qualifying mails are shown
one by one and the rest are folded into one notice at the window's
end; there is no separate quiet-gap timer. The dedupe key is the
account and message id, falling back to folder/uidvalidity/uid only
when no message id is given, so a UIDVALIDITY reset cannot suppress a
new mail, and a redelivered event already buffered is never recounted.
status now lists every granted account, not only those with a notice,
and caches mail-store.accounts for a minute.
2026-10-15 17:54:27 +02:00

2.5 KiB

mesh-mail-notifier — the default holder of mail-notifier

Built from mesh-mail's source (novox/hq ADR 0378 §9, as amended by ADR 0379, issue 800 part B): it carries a byte-identical copy of mesh-mail's event shape (mailevent.go, pinned by copies_test.go, the way modules/networkmanager's uplink-tools carries ifwatchd's own file, ADR 0241). Nothing here names Betterbird (ADR 0379 §3), and nothing here reaches a mailbox: it only hears what mesh-mail already said.

What it does

It claims mail-notifier (held once per machine, needing node-notifier there) and shows each new inbox mail on this machine's notifier, through node-notifier.send, at most once:

  • quiet during a first sync or a resync (mesh-mail already says nothing then, imap.go ~387)
  • quiet for a mail from the account's own address (its address, from mail-store.accounts; not known, the notice is shown)
  • quiet for a mail already marked read (\Seen in its flags)
  • quiet for anything outside the inbox
  • of one account's qualifying mail within a sliding minute, the first three are shown one by one; the rest of that minute's mail is folded into one notice naming the count and the latest sender, rather than shown one by one

A notice node-notifier.send refuses stays pending and is tried again, at most once a minute, without holding up any other account's notice; nothing is deleted before it is shown. Each notice shown emits this module's own event shown (account and message id, never sender or subject), and is kept in its own state (shown) so a redelivered event is never counted or shown twice — by the mail's message id wherever it has one, so a UIDVALIDITY reset cannot make an already-shown mail look new.

Where it runs

Its own account (runs-as), because it hears mesh-mail's restricted stream MAIL (novox/hq ADR 0376 §2): the machine's runtime runs as the operator's account, which every agent shares and which never hears a restricted stream. Held once per machine (wherever mail-notifier is assigned); the operator grants it the accounts it announces, in mesh-mail's trusted setting grants (mail-store's stream).

Tools

tool does
mail-notifier.status every account it is granted, when it last showed each one a notice, and any notice still failing to send (its count, last error, since when). Read-only
mail_notifier_health how it is: unhealthy once a notice has failed to show for more than ten minutes, healthy otherwise, even mid-retry. Read-only