Skip to content

Add chat_channel_create(), chat_leave(), and message attachments - #13

Merged
TroyHernandez merged 2 commits into
mainfrom
create-leave-attachments
Aug 18, 2026
Merged

TroyHernandez merged 2 commits into
mainfrom
create-leave-attachments

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

Writing a new adapter surfaced two contract gaps.

Channel lifecycle. The contract had chat_join() but no way to create a channel or leave one, so any bot that opens rooms is forced below the seam into adapter-native calls (mx_room_create is how the resident fleet does it today). This adds chat_channel_create(client, name, ...) and chat_leave(client, channel, ...), capability-gated (channel_create, leave) with loud defaults. Matrix wires mx_room_create/mx_room_leave behind .create/.leave testing seams; loopback implements create, with declared channels reported by chat_channels() before any traffic; irc and slack answer the flags honestly FALSE (their platform verbs exist but the adapters have no wiring yet).

Inbound media. chat_send() already takes files =, but a received file had nowhere to land except raw. chat_message() gains attachments, a list of new chat_attachment records (id, name, mime, bytes, url, path, sha256). sha256 is only ever transport-supplied, never computed speculatively: NA means unverified, telling a consumer that needs provenance to hash at ingest and record the result. Capabilities split send/receive as usual: files (outbound) and attachments (inbound). Loopback now round-trips files into attachment records, making it the media test double; matrix reports attachments = FALSE for the same structural reason as thread_replies (the text-only extractor), to flip when mx.client grows a media-aware extractor.

978 tests pass, including new coverage: lifecycle round trip and double-create refusal on loopback, seam-injected create/leave on matrix with error propagation, the four-adapter flag sweep for the new capabilities, attachment record validation, and the files-to-attachments poll round trip.

Bots open rooms about as often as they are invited to them, and the
contract had no verb for either creating or leaving: consumers were
forced below the seam into adapter-native calls (mx_room_create is
how the resident fleet does it today). Both new generics are
capability-gated with loud defaults.

Inbound media had no home either: chat_send() takes files= but a
received file could only ride raw. chat_message() gains attachments,
a list of chat_attachment records (id, name, mime, bytes, url, path,
sha256) where sha256 is only ever transport-supplied, never invented,
so NA means unverified and a consumer that needs provenance hashes at
ingest.

Adapters: loopback implements create (declared channels count before
any traffic) and the files round trip, making it the media test
double; matrix wires mx_room_create/mx_room_leave behind .create and
.leave seams, attachments stays FALSE until mx.client grows a
media-aware extractor (same structural reason as thread_replies);
irc and slack answer the new flags honestly FALSE.
@TroyHernandez
TroyHernandez merged commit 1d1dc6e into main Aug 18, 2026
2 checks passed
@TroyHernandez
TroyHernandez deleted the create-leave-attachments branch August 18, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant