96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 1 | # macltok design decisions |
96fdf90aacd6 | atagen | 2026-09-08 08:24 UTC | 2 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 3 | the contract the working tree actually implements. if the code disagrees with |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 4 | this, one of them is lying and it should be fixed |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 5 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 6 | ## two ways in, one way out |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 7 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 8 | state changes are commands. `ClientHandle::send` queues one and hands back a |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 9 | `Pending`, `execute` queues and waits, and there's an awaited convenience method |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 10 | for every command. each command answers exactly once with |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 11 | `Result<CommandOutput, Error>`. drop the `Pending` if you don't care, the |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 12 | command still runs |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 13 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 14 | pure reads skip the engine and ask the sdk directly through the handle. rooms, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 15 | members, power levels, account data, devices, push notification resolution, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 16 | and media bytes all live here |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 17 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 18 | the event stream carries state and only state. timelines, history, typing, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 19 | rooms, connection, encryption, verification, upload progress, session. no |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 20 | command results ride on it. drain it from its own task, it's bounded and the |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 21 | engine waits for you |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 22 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 23 | one error type for everything, `Error { kind, message, challenge }`. match on |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 24 | `kind`. `Interrupted` means the engine stopped, the room closed, or the task |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 25 | doing the work died before it could answer. `challenge` turns up with |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 26 | `InteractiveAuthRequired` |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 27 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 28 | ## engine |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 29 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 30 | the run loop routes and does nothing slow. every task it spawns is registered |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 31 | with a context. a command task that panics costs its caller an `Interrupted` |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 32 | and gets logged. a watcher or a room actor that panics takes the engine down, |
7b376d620a3d | atagen | 2026-09-26 12:53 UTC | 33 | emitting `Failed` then `Stopped`. natively, anyway. on wasm a panic traps the |
7b376d620a3d | atagen | 2026-09-26 12:53 UTC | 34 | task mid poll and nothing is caught. the rest keeps running in an undefined |
7b376d620a3d | atagen | 2026-09-26 12:53 UTC | 35 | state and goes silent, no `Failed` and no `Stopped`, so the host hears of it |
7b376d620a3d | atagen | 2026-09-26 12:53 UTC | 36 | through `on_panic`, a free function since a panic hook belongs to the whole |
7b376d620a3d | atagen | 2026-09-26 12:53 UTC | 37 | instance rather than to one engine |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 38 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 39 | sync restarts itself with backoff after an error or an unexpected stop, and |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 40 | `ConnectionChanged` shows `Offline` meanwhile. a run that drops again inside |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 41 | thirty seconds counts as a failure too, or a server that answers `/versions` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 42 | but refuses sync would bounce us between online and offline forever. every return to `Online` re-arms |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 43 | the send queues, since the sdk parks a room's queue on any send failure and |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 44 | never unparks it. a recoverable failure while online gets the room another go |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 45 | after a few seconds |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 46 | |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 47 | logout and a rejected token both stop the engine. `run` resolves to a |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 48 | `Termination` naming which of those it was, or a shutdown, or every handle |
fe4133dbcd47 | atagen | 2026-09-26 09:05 UTC | 49 | dropping, so the host never works it out from the events. `Shutdown` answers once |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 50 | `Stopped` has gone out, every one of them if several were queued |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 51 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 52 | `Engine::run` hands back a boxed future. the real one nests deep enough that |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 53 | every crate spawning it would trip the compiler's query depth |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 54 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 55 | ## rooms |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 56 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 57 | one actor per open room. the engine holds a slot per room, `Active` with a |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 58 | sender or `Closing` with a fifo of opens and closes that arrived while it wound |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 59 | down. those replay in order once the actor exits. a room you leave, or get |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 60 | kicked or banned from, closes itself. it tells the engine first, and anything |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 61 | already queued to it comes back to be answered or replayed, so an open racing a |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 62 | leave still gets a fresh actor |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 63 | |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 64 | however an actor ends, short of the engine stopping, its typing goes out empty |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 65 | and each of its timelines sends `TimelineClosed`. so does a closed thread. a |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 66 | timeline that never sent a reset never sends a close either |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 67 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 68 | opening sends `TimelineReset` on the stream before it answers. opening an |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 69 | already open room sends a fresh reset, so a second frontend gets a snapshot |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 70 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 71 | sends, edits and replies run on the actor in order, so they reach the send |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 72 | queue in the order they were asked for. redactions, reactions and read |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 73 | receipts are network calls, so they run beside the actor and a slow one |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 74 | doesn't queue the room behind it. closing lets them finish rather than lie |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 75 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 76 | threads belong to their room's actor. commands for a thread that's still |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 77 | opening wait behind the open, up to the actor's queue capacity |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 78 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 79 | pagination runs one request at a time per timeline and emits `HistoryChanged` |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 80 | around each. the sdk remembers where history starts, we don't, because a gappy |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 81 | sync can unload it again |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 82 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 83 | the actor's watchers are supervised, and a panic in any of them panics the |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 84 | actor. its command work isn't, a panicking redaction just answers `Interrupted` |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 85 | and gets logged |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 86 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 87 | ## timelines |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 88 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 89 | `TimelineDiff::try_apply` refuses a diff whose indices don't fit your snapshot |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 90 | and leaves the snapshot alone. `try_apply_all` does the same for a whole batch, |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 91 | checking every diff against lengths alone first, since that's all a diff's fit |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 92 | depends on. snapshots are `imbl::Vector`s so keeping one is a pointer copy. |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 93 | stop applying, `resync`, and carry on from the next `TimelineReset`. resync |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 94 | kills the old watcher before the new reset goes out, so no stale diff can land |
d5d8097c3afd | atagen | 2026-09-26 09:33 UTC | 95 | after it |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 96 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 97 | `TimelineId` tells a room from a thread by its root event |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 98 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 99 | every item is an event, a day divider, the read marker or the start. an event |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 100 | carries its sender with avatar and name ambiguity, and a `TimelineContent` |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 101 | saying what it actually is. messages keep their msgtype, membership and profile |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 102 | changes and the common room state changes get their own variants, and anything |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 103 | else is `OtherState` or `Other` with its type. nothing is flattened into english |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 104 | in a body field |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 105 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 106 | thread receipts for a thread that isn't open go straight to the room, so |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 107 | marking a thread read works the same whether its room is on screen or not |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 108 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 109 | replies carry the replied-to event once it's loaded. the watcher asks the sdk |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 110 | for any it hasn't got, once per event, since the sdk won't on its own |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 111 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 112 | edit, redact and react take an `EventRef`, so your own message can be edited or |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 113 | reacted to before the server has echoed it back. redacting an unsent one just |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 114 | cancels it |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 115 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 116 | ## mutations |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 117 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 118 | membership, moderation, power levels, room creation and account data writes go |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 119 | through one keyed fifo scheduler. same room, same alias, same dm partner or |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 120 | same account data type run in order, everything else runs at once. |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 121 | `create_direct` hands back the existing dm when there is one |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 122 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 123 | notifications and encryption each get one serial worker. the encryption worker |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 124 | owns the verification controller outright |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 125 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 126 | power level changes build one state event from the local mapping, since the |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 127 | sdk's own patcher is private |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 128 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 129 | ## media |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 130 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 131 | media is a read. `ClientHandle::media` takes a `MediaId` a retained timeline |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 132 | handed you, `mxc_media` takes any plain mxc uri. both share one bounded |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 133 | download path with the byte cap the sdk's own download lacks, an hour's total |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 134 | deadline instead of the sdk client's thirty seconds, and a minute's patience |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 135 | for a stalled stream. concurrent asks for the same bytes share one flight. |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 136 | a thumbnail the server won't make falls back to the file itself. |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 137 | `MediaId` parses from a string, since a web client has to round trip it |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 138 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 139 | the cache holds plaintext, keyed like the sdk keys it, so the sdk and macltok |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 140 | can read each other's entries. that's how your own encrypted uploads come back. |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 141 | the sdk keys plain and encrypted sources alike, so a plain event pointing at |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 142 | someone's encrypted file can leave ciphertext in the cache. an encrypted read |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 143 | checks the cached bytes against the file's hash and decrypts them if they match |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 144 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 145 | media ids are registered as timelines render and forgotten when their timeline |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 146 | closes, least recently seen first once the cap is hit |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 147 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 148 | uploads are commands that answer once the send queue has them. progress only |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 149 | goes out on a room's own send queue channel, so each room that uploads gets a |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 150 | forwarder, subscribed before the upload is queued and restarted for uploads the |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 151 | sdk resumes from last time. everything but progress reaches the client-wide |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 152 | channel, so one watcher there follows every attachment in the queue and ends |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 153 | each with one `MediaUploadFinished`. sent, cancelled, its room forgotten, or |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 154 | missed when that channel overflowed at the wrong moment, since then there's no |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 155 | knowing which. a failure isn't an ending, a wedged upload can still be retried. |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 156 | uploads don't belong to a room's actor, so closing the room leaves them be |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 157 | |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 158 | the forwarders hand their progress to that watcher rather than the stream, so |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 159 | it's the only thing speaking about uploads. anything that ever showed progress |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 160 | or a failure is followed until it gets exactly one `MediaUploadFinished`, and |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 161 | nothing about it goes out after. each forwarder relays its room's sends and |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 162 | cancels behind its progress, so an end never overtakes the ticks before it. an |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 163 | upload ended from anywhere else is remembered until its forwarder's own end |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 164 | turns up, since until then there may be progress still queued for it. the |
7cf348521204 | atagen | 2026-09-26 12:28 UTC | 165 | engine stopping ends nothing, `Stopped` covers it |
7c26fad34822 | atagen | 2026-09-26 09:41 UTC | 166 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 167 | ## sessions and secrets |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 168 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 169 | `Session::login_password`, `begin_oauth` and `restore` share one client builder |
62fe32759529 | atagen | 2026-09-26 08:50 UTC | 170 | with an encrypted store, refresh tokens and threads. the store is sqlite |
62fe32759529 | atagen | 2026-09-26 08:50 UTC | 171 | natively and indexeddb in a browser. secret-bearing inputs don't derive `Clone` |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 172 | |
713205a95af2 | atagen | 2026-09-26 09:24 UTC | 173 | a `SessionStore` owns one login's record and its store. login saves the first |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 174 | record, `restore` loads it, and the engine a `Session` builds saves every token |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 175 | rotation after that, since a refresh token works once and a host that missed one |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 176 | save has lost the login. the session changes are subscribed the moment the |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 177 | client exists, because the sdk can refresh during restore before any engine |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 178 | does. a save runs off the event stream, so a full stream never holds it back, |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 179 | and `SessionTokensChanged` only goes out once it has landed, or |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 180 | `SessionSaveFailed` if it didn't. natively the sdk's save callback runs inside |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 181 | the refresh, before the new token is used, and `save_blocking` writes there and |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 182 | then. in a browser there's only the async save, so a tab that dies between a |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 183 | refresh and its save wakes up holding a spent token. `without_persistence` |
f12377bce9b9 | atagen | 2026-09-26 12:32 UTC | 184 | hands the job back to the host. `EncryptedSessionStore` seals the record with |
713205a95af2 | atagen | 2026-09-26 09:24 UTC | 185 | the sdk's `StoreCipher` under the store's passphrase and replaces it by rename, |
713205a95af2 | atagen | 2026-09-26 09:24 UTC | 186 | so a crash mid save leaves the old one. it keeps the record out of the sdk's |
713205a95af2 | atagen | 2026-09-26 09:24 UTC | 187 | state store because sqlite writes custom values there in the clear, and a |
713205a95af2 | atagen | 2026-09-26 09:24 UTC | 188 | client can't open its store before it knows the homeserver the record holds. |
713205a95af2 | atagen | 2026-09-26 09:24 UTC | 189 | `discard` deletes the record, then the store, since a record without its store |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 190 | would restore into empty crypto. the host follows `Termination::retain`. |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 191 | `Nothing` discards. `Store` calls `soft_log_out`, which keeps the store and |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 192 | swaps the record for one holding the homeserver, user, device and oauth client |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 193 | id with no tokens. `restore` hands that back as `Restore::SoftLoggedOut`, so a |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 194 | restart still knows which device to log in again as, and the login overwrites |
6f1d6591c10d | atagen | 2026-09-26 09:52 UTC | 195 | it. one store directory per login |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 196 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 197 | ## room lists, spaces and profiles |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 198 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 199 | `RoomSummary` has what a room list row needs without a second query. topic, |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 200 | alias, member counts, heroes for nameless rooms, the inviter, where an upgraded |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 201 | room went, a latest event preview, the joined spaces listing it, and for a |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 202 | space the children it lists |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 203 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 204 | parents come from one lazily built `SpaceService` shared by every handle. |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 205 | children come straight from the space's local state, joined or not. |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 206 | `space_hierarchy` pages through the server's view for browsing rooms you |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 207 | haven't joined, and holds its place between pages |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 208 | |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 209 | `own_profile` and `user_profile` read profiles. name and avatar changes are |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 210 | commands, and uploading an avatar gets the same byte cap as any upload |
960ac0721079 | atagen | 2026-09-25 00:24 UTC | 211 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 212 | ## notifications and room data |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 213 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 214 | the notification client is built lazily and shares the engine's sync service. |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 215 | sdk ui types stay behind the boundary |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 216 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 217 | `rooms` normalises on demand with bounded concurrency and sorts by latest event, |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 218 | then name, then id. `RoomsChanged` is an invalidation, coalesced so one sync |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 219 | touching fifty rooms is one event. a left room stays in the list with its |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 220 | membership until it's forgotten. push rule changes never touch room info, so |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 221 | `NotificationSettingsChanged` brings a `RoomsChanged` along for the modes in |
0bfa3f46f0be | atagen | 2026-09-26 09:12 UTC | 222 | the summaries |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 223 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 224 | ## verification |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 225 | |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 226 | `Accept`, `Confirm`, `Reject` and `Cancel`. a request another device sends |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 227 | shows up as `Incoming` and waits for `Accept`, or `Cancel` to turn it down. one |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 228 | is only taken up while nothing else is in flight. reject tells the other side |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 229 | the emoji didn't match. the watchers subscribe before they look at the current |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 230 | state, since the sdk only reports what changes after you ask. the watcher and |
5a52012c9b1d | atagen | 2026-09-24 23:45 UTC | 231 | the action paths claim the terminal event, so a racing |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 232 | cancel can't turn `Done` into `Cancelled` |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 233 | |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 234 | ## mirror |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 235 | |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 236 | the mirror is a consumer like any other, behind the `mirror` feature, and it |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 237 | takes any stream of events rather than the `EventStream` itself so a host keeps |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 238 | the raw events without a second channel. state, its sequence number and the |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 239 | broadcast send all move under one lock, which is how `subscribe` gets a |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 240 | snapshot and a receiver with nothing between them. a lagged subscriber starts |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 241 | over from a fresh state under the same lock |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 242 | |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 243 | nothing on the draining path waits for an engine answer. a resync runs on its |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 244 | own task, retrying with backoff until a reset or a close for its timeline |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 245 | aborts it. rooms are fetched on a task too, one at a time with one more owed at |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 246 | most. the only thing it does wait for is `SessionStore::save`, since a refresh |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 247 | token spent before the save lands loses the login. `SessionTokensChanged` |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 248 | never becomes an update, a lagging subscriber would lose it |
a319bae745d8 | atagen | 2026-09-26 09:59 UTC | 249 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 250 | ## public model |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 251 | |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 252 | owned ruma ids and typed data wherever there's a stable shape, `Raw` where |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 253 | arbitrary content has to survive. anything expected to grow is |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 254 | `#[non_exhaustive]`. `Engine::from_client` stays public for people who built |
31ce2453c82f | atagen | 2026-09-24 13:07 UTC | 255 | their own client |