Skip to content

mx_room_create(): pass creation_content through - #17

Merged
TroyHernandez merged 2 commits into
mainfrom
room-creation-content
Aug 22, 2026
Merged

mx_room_create(): pass creation_content through#17
TroyHernandez merged 2 commits into
mainfrom
room-creation-content

Conversation

@TroyHernandez

Copy link
Copy Markdown
Contributor

A space is an ordinary room with type: "m.space" in its m.room.create event. That field is fixed at creation and immutable afterwards, so there is no set-it-later path — without a way to send creation_content, mx.api cannot make one at all.

space_id <- mx_room_create(s, name = "dev",
                           creation_content = list(type = "m.space"))

The test asserts the JSON, not the R value

mx_http serializes with auto_unbox = TRUE. An unnamed list("m.space") therefore goes out as a bare string rather than an object, and the server answers that with a perfectly ordinary room. The failure is a space-less space, not an error — so an unnamed list is refused at the call instead, and the passing case is pinned on the serialized form:

expect_true(grepl('"creation_content":\\{"type":"m.space"\\}', json))

mx_http is stubbed and the request body captured, which is the only way to see the shape of this field without a server. The existing test_rooms.R checks that the function exists; this checks what it sends.

Verified

193 tests, all green.

Live: created the dev space now holding 45 rooms across two bot accounts.

The man/ churn in mx_keys_upload, mx_read_receipt, mx_register and mx_send_media is tinyrox regenerating drift — no roxygen source changed for those.

A space is an ordinary room with `type: "m.space"` in its
m.room.create event. That field is fixed at creation and immutable
afterwards, so there is no set-it-later path -- without a way to send
creation_content, mx.api cannot make one at all.

The new test captures the request body by stubbing mx_http, which is
the only way to see the shape of this field without a server. It
asserts the JSON, not the R value: mx_http auto-unboxes, so an
unnamed list(...) of one string serializes to a bare "m.space" and the
server answers with a perfectly ordinary room. The failure is a
space-less space rather than an error, which is why an unnamed list is
refused at the call instead.

The man/ churn in mx_keys_upload, mx_read_receipt, mx_register and
mx_send_media is tinyrox regenerating drift; no roxygen source changed
for those.
@TroyHernandez
TroyHernandez merged commit fa2b521 into main Aug 22, 2026
0 of 2 checks passed
@TroyHernandez
TroyHernandez deleted the room-creation-content branch August 22, 2026 20:20
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