diff --git a/apps/api/migrations/032_room_id_bare_form.sql b/apps/api/migrations/032_room_id_bare_form.sql new file mode 100644 index 0000000..e8f2ced --- /dev/null +++ b/apps/api/migrations/032_room_id_bare_form.sql @@ -0,0 +1,11 @@ +-- 032: accept homeservers that mint room IDs without the :server suffix. +-- +-- tuwunel 1.9.4 returns BARE room IDs from createRoom ("!localpart") and its +-- client API only accepts that bare form for those rooms (the suffixed form +-- 500s with "no forward extremities"). The 030 check demanded the full +-- "!localpart:server" spec form, which made every provisioned collective fail. +-- Accept both forms; the homeserver is the authority on its own IDs. + +ALTER TABLE group_rooms DROP CONSTRAINT group_rooms_room_id_check; +ALTER TABLE group_rooms ADD CONSTRAINT group_rooms_room_id_check + CHECK (room_id ~ '^![^:\s]+(:[^:\s]+)?$'); diff --git a/apps/api/src/collectives/provisioner.config.ts b/apps/api/src/collectives/provisioner.config.ts index d62483f..5f5148b 100644 --- a/apps/api/src/collectives/provisioner.config.ts +++ b/apps/api/src/collectives/provisioner.config.ts @@ -115,13 +115,7 @@ export class MatrixHttpClient implements MatrixAdminPort { if (typeof body.room_id !== "string" || body.room_id === "") { throw new ProvisionerUnavailableError("createRoom response missing room_id"); } - // Some homeservers return the bare localpart; the full room ID carries the - // server name, and every downstream consumer (DB checks, invites, joins) - // requires the complete form. - const roomId = body.room_id.includes(":") - ? body.room_id - : `${body.room_id}:${this.config.homeserverUrl.host}`; - return { roomId }; + return { roomId: body.room_id }; } async sendStateEvent(