Mail relay: review round 2 — the store is keyed by host, a copied database does not enrol by itself

- Q-1 one entry per host (iapl:mail-relay:site:<host>); a read never deletes or writes; another host's
  entry is neither used nor touched (a developer's process on the live database, www and apex, a copy)
- a database that holds another host's connection and none of this site's does not enrol by itself:
  "Connect again" does, once; mail.relay.otherHosts ('wait' | 'enrol' | the site's own other hosts);
  panel text and doctor finding; a site with an empty store enrols by itself as before
- Q-2 the file limit answers from what is stored and never asks the service
- Q-3 a file whose mail was not confirmed is not reported as a wrong file, and no notice mail follows
- Q-4 its own text when the access-key field is off
- D-1 docs for open enrolment; staging, copies and several hosts

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 23:14:11 +01:00
co-authored by Claude Fable 5.2
parent edee3a321f
commit 85ed92bb89
31 changed files with 467 additions and 211 deletions
+5
View File
@@ -686,6 +686,11 @@ describe('e-mail: transport, the mail service, Graph, the confirm route', () =>
expect(await run(mail({ relay: relay({ state: 'pending' }) }))).toEqual(['mail-relay-state:warning'])
expect(await run(mail({ relay: relay({ connected: false, reason: 'redirect', refusal: 'callback-failed', state: undefined }) }))).toEqual(['mail-relay-state:warning'])
expect(await run(mail({ relay: relay({ connected: false, state: undefined }) }))).toEqual(['mail-relay-state:info'])
// a copy of another site's database: it does not connect by itself, and the finding says what to do
const copy = await doctor(project({ ...base(), 'src/payload.config.ts': 'iapl({ forms: {} })' }), ids, { deepStatus: { mail: mail({ relay: relay({ connected: false, reason: 'client.pl', refusal: 'client-other-host', state: undefined }) }) } })
expect(rules(copy)).toEqual(['mail-relay-state:warning'])
expect(copy.findings[0].message).toContain('client.pl')
expect(copy.findings[0].fix).toContain('otherHosts')
expect(await run(mail({ relay: relay({ nameReplaced: true }) }))).toEqual(['mail-relay-state:warning'])
})