matrix-org / matrix-org/matrix-rust-sdk
Expose custom create-room initial state and exact state reconciliation through matrix-sdk-ffi
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:
- Atomically include
m.room.encryptionand a custom idempotency marker state event in the original create-roominitial_staterequest. - 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
- A custom marker and
m.room.encryptioncan be submitted in the same create-room request. - JSON content is passed without leaking it into logs or error strings.
- Query results preserve enough state-event identity to distinguish zero, one, and multiple candidate rooms.
- The API does not synthesize local authority when the server result is ambiguous.
- The design supports cancellation and retry without duplicate room creation.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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