IWSN: "Połącz z IWSN" — a person of Intecion connects the site (contract 1.8.0)

- the state block on the e-mail tab (method IWSN): the button while the service offers the confirmation page
  (connectAvailable) or before the site has enrolled; a click asks the site's server for the link
  (POST /api/iapl/mail-relay/connect-link, admin only), which asks the service (POST /v1/connect, enrolling first),
  checks that it begins with the service's own {base}/connect?, and hands it over without storing or logging it;
  the browser opens it in a new tab with noopener noreferrer; the block asks /v1/status every 5 s for 10 min
- states: waiting for confirmation (button), waiting for approval (no page), connected, stopped; 503
  connect-unavailable and 429 said in the admin's language; a load of the panel asks the service while the site waits
- dashboard alert for a waiting site (live); doctor mail-relay-connect (error) — replaces the pending warning and the
  "not enrolled yet" note of mail-relay-state
- opt-out mail.relay.connectButton: false (no button, no route); building blocks requestRelayConnectLink,
  isRelayConnectUrl, RELAY_CONNECT_LINK_PATH; the fake service implements /v1/connect, connectAvailable and
  confirmConnect
- contract copy 1.8.0 (IWDL working tree, checksums match); docs, AGENT.md, setup / upgrade / debug skills, changelog

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-12-01 21:42:23 +01:00
co-authored by Claude Opus 5.5
parent 347e3bafa1
commit 2c0262367d
41 changed files with 1113 additions and 57 deletions
@@ -0,0 +1,31 @@
{
"id": "connect-active",
"title": "A site that is confirmed already gets no link",
"given": {
"site": "active"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 200,
"schema": "ConnectResponse",
"body": {
"ok": true,
"state": "active"
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": null
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,31 @@
{
"id": "connect-pending",
"title": "A waiting site asks for the link a person of Intecion confirms it with",
"given": {
"site": "pending"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 200,
"schema": "ConnectResponse",
"body": {
"ok": true,
"state": "pending"
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-pending"
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,32 @@
{
"id": "connect-suspended",
"title": "A suspended site cannot be connected",
"given": {
"site": "suspended"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 403,
"schema": "Error",
"body": {
"ok": false,
"code": "site-suspended",
"retryable": false
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-suspended"
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,33 @@
{
"id": "connect-unavailable",
"title": "The service has no confirmation page set up: the site stays waiting and says whom to ask",
"given": {
"site": "pending",
"connect": "unavailable"
},
"request": {
"method": "POST",
"path": "/v1/connect",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 503,
"schema": "Error",
"body": {
"ok": false,
"code": "connect-unavailable",
"retryable": false
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-pending"
},
"then": {
"mails": 0
}
}
@@ -0,0 +1,29 @@
{
"id": "status-pending-connect",
"title": "Status of a waiting site says that it can be confirmed through /v1/connect",
"given": {
"site": "pending"
},
"request": {
"method": "GET",
"path": "/v1/status",
"headers": {
"authorization": "Bearer {{token}}",
"x-intecion-site": "{{host}}"
}
},
"response": {
"status": 200,
"schema": "StatusResponse",
"body": {
"ok": true,
"state": "pending",
"connectAvailable": true
}
},
"client": {
"retry": false,
"reEnrol": false,
"status": "relay-pending"
}
}