Add chat_channel_create(), chat_leave(), and message attachments - #13
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_createis how the resident fleet does it today). This addschat_channel_create(client, name, ...)andchat_leave(client, channel, ...), capability-gated (channel_create,leave) with loud defaults. Matrix wiresmx_room_create/mx_room_leavebehind.create/.leavetesting seams; loopback implements create, with declared channels reported bychat_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 takesfiles =, but a received file had nowhere to land exceptraw.chat_message()gainsattachments, a list of newchat_attachmentrecords (id, name, mime, bytes, url, path, sha256).sha256is 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) andattachments(inbound). Loopback now round-trips files into attachment records, making it the media test double; matrix reportsattachments = FALSEfor the same structural reason asthread_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.