Expand description
Notifications (decisions 408-429): which channels hear of an event, the message each gets,
and the checks on a DAG’s notify=.
An event queues one notification per channel told of it, in the transaction that records
the event (the outbox, decision 410); sender delivers them. A body is filled here, when
it is queued, from fixed values (Placeholder): nothing in it is code.
Modules§
- sender
- The master’s sender: delivers the outbox (decision 410). A notification delivered is
deleted; one that fails is tried again later, waiting longer each time, until
[notifications] give_up_afterhas passed since it was queued: then it is logged as an error, counted and deleted. Redirects aren’t followed (decision 425), and a URL is never logged (a server webhook’s may hold its secret).
Structs§
- Budget
- What a body may still take, in bytes of its JSON, as it is filled: each value is measured before it is copied, so a template using a big value many times stops at the limit instead of filling the master’s memory (Codex’s review of M4.13a).
- Email
Channel - A server email channel (
type = "email"): its recipients, every one in To. - Event
- What happened, for the message.
- Notifications
- The notification settings (
[notifications]), checked. - Server
Webhook - A server webhook, its headers read from the environment.
- Smtp
- The mail server (
[notifications.smtp]), checked.
Constants§
- DEFAULT_
MAX_ BODY - The most bytes a filled body may take by default (1 MiB).
- KIND_
EMAIL - A notification sent as an email; its body holds
to,subjectandtext. - KIND_
WEBHOOK - A notification posted to a webhook (
notifications.kind). - MAX_
FAILED_ TASKS - The most failed tasks a message lists.
- MESSAGE
- The event name of a message a task sends itself.
Functions§
- fill
bodyfilled fromvars, withinbudget. Withstrict(a task’s ownsend), a path intodatathat the data lacks is an error; otherwise it fills as null (empty in text).- url_
within - Whether
urlis withinallowed(decision 425): the same scheme, host and port, no user or password, and a path underallowed’s, at a/(https://a.example.com/hooksallows/hooksand/hooks/x, not/hooksy). Both are parsed, as the client parses them, so a host suffix (a.example.com.evil) or userinfo (a.example.com@127.0.0.1) can’t pass.