matrix-org / matrix-org/matrix-rust-sdk

Expose custom create-room initial state and exact state reconciliation through matrix-sdk-ffi

Open
#6,777 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

Problem

A retry-safe encrypted room-creation flow needs both of these capabilities through generated Swift matrix-sdk-ffi bindings:

  1. Atomically include m.room.encryption and a custom idempotency marker state event in the original create-room initial_state request.
  2. After an ambiguous response, sync/query room state and classify zero, exactly one, or multiple exact marker matches before deciding whether any retry is safe.

Observed against an artifact based on matrix-rust-sdk f50309786e5d4019d7d73f4b126483f68068f785. Its generated Swift create-room parameters expose standard room metadata, invitees, preset/visibility, and an encryption convenience flag, but the downstream preflight did not establish a supported custom initial-state event surface or an authoritative exact-marker query path.

Creating the marker after room creation is not equivalent: a timeout can occur after server creation but before the post-create marker, leaving no safe reconciliation key. Blind retry can create duplicate private rooms.

Requested FFI surface

Expose supported Swift bindings for custom initial state, for example:

CreateRoomParameters.initial_state: [InitialStateEvent]

Each event should carry an event type, state key, and JSON content without requiring a second authenticated transport.

Also expose a supported room-state query capable of retrieving an exact state event by (event_type, state_key) after sync, or an equivalent API that lets callers enumerate authoritative room state without timeline heuristics.

Requirements

  1. A custom marker and m.room.encryption can be submitted in the same create-room request.
  2. JSON content is passed without leaking it into logs or error strings.
  3. Query results preserve enough state-event identity to distinguish zero, one, and multiple candidate rooms.
  4. The API does not synthesize local authority when the server result is ambiguous.
  5. The design supports cancellation and retry without duplicate room creation.
  6. Standard invite handling and encryption convenience options remain compatible with custom initial state.

Why this matters

This enables durable operation markers, exact-match reconciliation after timeout, and fail-closed duplicate prevention for private encrypted-room onboarding.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the Rust create-room implementation and the generated Swift matrix-sdk-ffi CreateRoomParameters and room-state entry points, then trace how initial state and synced state are exposed. Done means supported bindings meet all six listed requirements, including exact reconciliation and retry safety, with tests covering zero, one, and multiple matches.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, swift
Domain
api, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.