Mail relay: launch and a domain move need no click; a non-public copy neither enrols nor sends by itself

The copy rule now goes by direction. A public site that finds another host's connection in its database
(its development address after launch, its old domain after a move) enrols by itself. A site that says it
is not public - IAPL_NOINDEX=1, or a host in the new mail.relay.developmentHosts - and holds another host's
connection is a copy of that site's data: it neither enrols nor sends until "Connect again", also when it
has a token of its own (production's database copied back onto the development address). The consent is
stored with the copy (acceptedHosts), so the next fresh copy waits again.

- mail.relay.otherHosts: 'auto' (default) | 'wait' | 'enrol' | list of the site's own hosts
- mail.relay.developmentHosts, siteIsNonPublic() exported
- the copy refusal ends when its reason does (no cool-down; the panel recomputes it on every read)
- doctor: info for a public site whose database knows another host (the launched site, or a copy that
  forgot IAPL_NOINDEX)
- contract copy 1.7.1 (wording only)
- docs, AGENT.md, skills, changelog draft

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 00:46:16 +01:00
co-authored by Claude Fable 5.2
parent acfcf72c03
commit 49927205bb
30 changed files with 443 additions and 119 deletions
+13 -5
View File
@@ -1284,10 +1284,17 @@ the mail service → nothing (`mail: { relay: false }` and no SMTP). A site with
the mail service that is where replies go; the service's own address has no mailbox.
5. Nothing to arrange with Intecion: a site that passes the call-back is active at once (`relay-pending`, held for
approval, is the exception — the panel says so).
6. **Staging made from a copy of production's database** does not connect by itself (it would mail production's
real addresses): it stays "not connected" until an admin presses "Connect again". For a copy that must never
send: `mail: { relay: false }` or SMTP to a catcher. After a **domain move** press "Connect again" once, or set
`mail: { relay: { otherHosts: ['old-domain.example'] } }`. A site before launch (empty store) enrols by itself.
6. **Launch needs nobody:** a site enrolled on its development address and then served on the real domain (or moved
to another domain) enrols by itself on its first e-mail. **A non-public copy does not send by itself:** a site
with `IAPL_NOINDEX=1` — set it on every staging, preview and test copy — or on a host matched by
`mail: { relay: { developmentHosts: ['*.dev.agency.example'] } }`, whose database holds another host's
connection (staging made from production; production's data copied back onto the development address), neither
enrols nor sends until an admin presses "Connect again". **A copy with neither mark sends to the real addresses
in its data** — the plugin cannot tell it from launch day; the doctor's deep run notes it (`mail-relay-state`,
info). A production site that kept `IAPL_NOINDEX=1` sends nothing until the variable is removed. For a copy that
must never send: `mail: { relay: false }` or SMTP to a catcher. If the project's development addresses share a
pattern, set `developmentHosts` in its config. Verify: on the copy, Site integrations → E-mail sending says "The
data comes from another site (…)" and a test e-mail is refused; on the launched site it says "Connected to IWSN".
**Verify:** Site integrations → E-mail sending → the block "How e-mails are sent" says "Connected to IWSN"; **Send test e-mail** answers "through IWSN, as <name>"; the mail arrives from
`notification@webservices.intecion.net` with the client's name and `Reply-To` the client's address; `iapl-doctor
@@ -1320,7 +1327,8 @@ overrides per adapter; `resolveRelayOptions` reads what is in effect):
| `relay: false` | on | no mail service: no outbound call, no routes, no state block |
| `url` | `RELAY_BASE_URL` | a relay of your own (same contract) |
| `host` | host of `serverURL` (`relayHost`, `isPublicHost`) | the public host the service calls back |
| `otherHosts` | `'wait'` | a database holding another host's connection and none of this site's (a copy, a moved domain): wait for "Connect again"; a list of the site's own other hosts; or `'enrol'` |
| `otherHosts` | `'auto'` | a database holding another host's connection: a public site enrols by itself (launch, a move), a non-public one (`IAPL_NOINDEX=1` / `developmentHosts`) neither enrols nor sends until "Connect again"; a list of the site's own other hosts; `'wait'` (a public site without a connection waits too); `'enrol'` (no rule) |
| `developmentHosts` | `[]` | host patterns (`*`) of development and staging addresses: a site there is non-public for `otherHosts` (`siteIsNonPublic`) |
| `enrol` | `'auto'` | `'manual'` (only "Connect again" / `enrolRelay`), `false` (token from `token` / `setRelayToken`) |
| `accessKeyField` | `false` | `true`: admins get "Enter an access key" in the state block (a hand-issued token) |
| `token` | — | a token from elsewhere; nothing is stored, the site does not enrol |