Mail relay: review of 7d766b6 — R-1 to R-12, four mutations, two sentences

- R-1 a delivered token becomes the one in use only on 200 or a refusal given after authentication
- R-2 a token of another site is refused by what /v1/status says (access-key field, scripts); docs for staging
- R-3 the confirm route looks the nonce up first and counts only refused calls
- R-4 one budget of time per message (10 s, 30 s with files), enrolment and retries included
- R-5 'Disconnect' without the service's answer is not confirmed and keeps the token to try again
- R-6 no enrolment without the confirm route in the config
- R-7 half an SMTP set-up: one log line and a hint in the panel
- R-8 to R-10, R-12 docs; R-11 the last failure stays in the state block
- tests for redirect: manual, the candidate's nonce, the expectation taken back, one recipient only

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 22:07:10 +01:00
co-authored by Claude Fable 5.2
parent 0ee74ab2a4
commit a2b07b1dc1
23 changed files with 584 additions and 69 deletions
+2 -2
View File
@@ -30,12 +30,12 @@ export const contractExamples = (): ContractExample[] =>
.map((f) => JSON.parse(readFileSync(path.join(CONTRACT_DIR, 'examples', f), 'utf8')) as ContractExample)
/** The slice of Payload the relay client touches: the key-value store, the config, the logger, the two globals. */
export function relayPayload({ custom, integrations = {}, serverURL = 'https://example.com', siteName = '' }: { custom?: object; integrations?: Record<string, unknown>; serverURL?: string; siteName?: string } = {}) {
export function relayPayload({ custom, endpoints = [relayConfirmEndpoint()], integrations = {}, serverURL = 'https://example.com', siteName = '' }: { custom?: object; endpoints?: unknown[]; integrations?: Record<string, unknown>; serverURL?: string; siteName?: string } = {}) {
const store = new Map<string, unknown>()
const logger = { error: vi.fn(), info: vi.fn(), warn: vi.fn() }
const settings = { ...integrations }
const payload = {
config: { custom: custom ?? {}, globals: [{ slug: 'site-integrations' }, { slug: 'site-settings' }], routes: { api: '/api' }, serverURL },
config: { custom: custom ?? {}, endpoints, globals: [{ slug: 'site-integrations' }, { slug: 'site-settings' }], routes: { api: '/api' }, serverURL },
findGlobal: vi.fn(async ({ slug }: { slug: string }) => (slug === 'site-settings' ? { siteName } : settings)),
kv: {
delete: async (key: string) => void store.delete(key),