Check a connector's declared message and chat_message schemas against what core sends #2092

Closed
opened 2026-11-21 07:30:54 +00:00 by sam · 2 comments
Owner

Follow-up to #2087. Core sends two deliveries to a channel connector with fixed payloads: message (an object with title, optionally body and approval_request_id) and chat_message (chat_id and text). A connector declares input schemas for these, but nothing checks the declaration accepts what core actually sends, so an incompatible schema is only found when a delivery fails.

Done when

  • When a connector declares message or chat_message, its declared input schema is checked against every payload shape core may send on it, when the connector loads.
  • A declaration that rejects a payload core sends fails the connector with a clear reason, instead of failing deliveries at run time.
  • The delivery names have one definition (exported from the connectors module), used by core's senders and the check.
  • A table test in modules/connectors covers an accepting schema, a rejecting schema, and an undeclared delivery.
  • task check passes.
Follow-up to #2087. Core sends two deliveries to a channel connector with fixed payloads: `message` (an object with `title`, optionally `body` and `approval_request_id`) and `chat_message` (`chat_id` and `text`). A connector declares input schemas for these, but nothing checks the declaration accepts what core actually sends, so an incompatible schema is only found when a delivery fails. ## Done when - When a connector declares `message` or `chat_message`, its declared input schema is checked against every payload shape core may send on it, when the connector loads. - A declaration that rejects a payload core sends fails the connector with a clear reason, instead of failing deliveries at run time. - The delivery names have one definition (exported from the connectors module), used by core's senders and the check. - A table test in `modules/connectors` covers an accepting schema, a rejecting schema, and an undeclared delivery. - `task check` passes.
sam added the featuremedium labels 2026-11-21 07:30:54 +00:00
sam self-assigned this 2026-11-21 07:30:54 +00:00
sam added the in-progress label 2026-11-21 07:35:35 +00:00
Author
Owner

Landed in 592d36e0d.

  • connectors now exports DeliveryMessage ("message") and DeliveryChatMessage ("chat_message"); deliveries and runs use them instead of their own constants, so the contract has one definition.
  • checkCoreDeliveries runs in launch before declarations are stored: each declared core delivery's input schema is validated against every payload shape core sends (title always, body and approval_request_id optionally, for message; chat_id+text for chat_message). A rejection stops the connector and fails it with delivery "..." doesn't accept what core sends: ....
  • Table test TestCoreDeliveriesGuardWhatCoreSends in modules/connectors covers accepting schemas, a required field core never sends, a wrong field type, an empty schema, and an undeclared delivery; verified to fail with the check disabled. task check passes.
Landed in 592d36e0d. - `connectors` now exports `DeliveryMessage` ("message") and `DeliveryChatMessage` ("chat_message"); `deliveries` and `runs` use them instead of their own constants, so the contract has one definition. - `checkCoreDeliveries` runs in `launch` before declarations are stored: each declared core delivery's input schema is validated against every payload shape core sends (`title` always, `body` and `approval_request_id` optionally, for `message`; `chat_id`+`text` for `chat_message`). A rejection stops the connector and fails it with `delivery "..." doesn't accept what core sends: ...`. - Table test `TestCoreDeliveriesGuardWhatCoreSends` in modules/connectors covers accepting schemas, a required field core never sends, a wrong field type, an empty schema, and an undeclared delivery; verified to fail with the check disabled. `task check` passes.
Author
Owner

Landed in 592d36e0d. Closing without the manual check; it moves to #2096.

Landed in 592d36e0d. Closing without the manual check; it moves to #2096.
sam closed this issue 2026-11-21 15:01:52 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#2092