Merge remote-tracking branch 'origin/main' into phase5/gpui-spikes

This commit is contained in:
faumaray committed 2026-10-27 04:59:04 +03:00
commit 02b2b470fc
75 files changed
+13910 -6576

No files matched your search

+82 -22
View File
@@ -419,33 +419,93 @@ A row whose binding columns cannot be read is listed and read as unbound, with a
warning, instead of failing the list; so no damaged row, the account record's
included, keeps a sign-out from finishing, and `Forget` still deletes the key
it names.
Signing out of an account is the trait's `sign_out`, run on this table: it
removes the account record and the synced copies, unbinds the identities only
this device holds, keeps the device key (unbound, byte for byte) when the
record says it predates the account, and deletes it when it does not or when
the caller asks to forget it. The engine and the UI do not use the key store
yet; accounts, sign-in and the integrations page are later steps.
Signing out of an account is the trait's `sign_out`, run on this table, and it
keeps every key (Phase 2 task 34 of the protocol repository, open question 10
of its accounts design, answered by the owner on 2026-10-24). The device key
stays, unbound and byte for byte, whether it was in use before the account
existed or the client made it for the account: at every host without accounts
that the user reached with it, it is the user's identity, and deleting it would
lose their servers, roles and memberships there.
`AccountRecord.bound_existing_key` stays in the record for the client's wording,
and no rule reads it. The sign-out unbinds the identities only this device holds
and deletes what is not a key of the device: the account record, and the synced
copies of integration secrets, which the account service holds. It does not
release the device key at the service. The engine and the UI do not use the key
store yet; accounts, sign-in and the integrations page are later steps.
The device key is never a synced copy. The trait's `sign_out` deletes every
identity bound with `synced = true` in its first step, before it reads the
record, so a device key stored that way would be deleted even where the record
says to keep it. `SqliteKeyStore` therefore refuses, with an error that names
the key and the record, a `put` of a `voelin` blob with `synced = true` while an
account record names its uid as the device key, or while an account record
cannot be read (it may name the key); and a `put` of an account record whose
device key is stored as a synced copy. A key bound with `synced = false` is
accepted: a sign-out unbinds it and then follows the record. The check is made
under the store's lock; it is defence in depth against the code that signs in,
which does not exist yet.
The three parts of open question 10, and what each asks of the store and of the
client:
1. **A sign-out keeps every device key.** The only deletion of a key of the
device is "Forget this device's identity", the user's explicit choice, after
an offer to export the key. Signed in, it is a sign-out with
`DeviceKeyChoice::Forget(uid)` (the key goes before the record is read, so an
unreadable record does not keep it); signed out, it is `KeyStore::remove` of
the key, and for a TeamSpeak identity `Store::delete_identity`. The store has
no export call: the UI reads the bytes first, a Voelin key with
`KeyStore::voelin_key` and `IdentityKey::to_pkcs8`, a TeamSpeak identity with
`Store::identity` and `ts::identity::export`.
2. **A device key can be released from its account**, so that it can serve
another account. Releasing is the account service's operation
(`AccountClient::release`: `POST /v1/devices/<own>/release`, after a password
check) followed by the same local sign-out with `Auto`, which keeps the key,
unbound. The store has nothing to add and the client remembers nothing of the
release: the service holds the registration of the key, and a sign-in or a
sign-up refused with `CONFLICT`, field `device`, is how the client learns
that the key is still registered with an account it signed out of.
3. **The deletion of an account releases every device key of it.** The service
writes a DEVICE and a RELEASED entry for each key, the hosts that adopted a
key end their record of it at their next poll, and the account's users on
them stay the deleted account's, out of reach for good: nobody inherits them,
neither a key nor another account. The local half is
`AccountClient::delete_account(choice)`, the same sign-out: this device's key
is kept with `Auto`.
What the screens owe, as duties of the GPUI client (they do not exist yet; the
acceptance of the task in the protocol repository names the fixtures):
- The sign-out dialog says what is kept: "This device's identity stays on this
device. Servers that do not use accounts still know you by it. Choose 'Forget
this device's identity' to delete it (you can export it first)." Forgetting is
a separate, explicit choice there, with the export offered before it.
- Settings → Account offers "Release this device's identity from the account",
apart from signing out: the password first (`AccountClient::reauth`), then
`release`, then the text of protocol section 13.6 (the key can sign in to, or
up for, another account; a host that adopted it and knows the kind RELEASED
accepts it after its next poll, within five minutes). After a release the
client closes its own account sessions and shows no prompt to sign in again
when a host closes one with code 11; a release whose answer was lost
(`SignedOut`) is finished with a sign-out with `Auto`; a `CONFLICT`, field
`device`, at sign-in or sign-up is explained.
- **The delete-account dialog warns that the servers of the account become
unreachable** (its users on the hosts that adopted its keys stay the deleted
account's, and nobody inherits them) **and offers an export of the device keys
first**, before the deletion is sent: `KeyStore::list` names the `voelin`
rows, and each is read and exported as above.
The device key is never a synced copy. The trait's `sign_out` keeps the device
key, but its first step deletes every identity bound with `synced = true`,
before it reads the record, so a device key stored that way would be deleted
all the same, whichever way the record says it came. `SqliteKeyStore` therefore
refuses, with an error that names the key and the record, a `put` of a `voelin`
blob with `synced = true` while an account record names its uid as the device
key, or while an account record cannot be read (it may name the key); and a
`put` of an account record whose device key is stored as a synced copy. A key
bound with `synced = false` is accepted: a sign-out unbinds it and keeps it. The
check is made under the store's lock; it is defence in depth against the code
that signs in, which does not exist yet.
The rows are private keys, so a deleted key must not stay in the file. Every
connection to the database sets `secure_delete`, which makes SQLite overwrite
what it deletes, and deleting a key (`Store::delete_identity`, and the
`KeyStore::remove` a sign-out deletes with) is followed by a
`PRAGMA wal_checkpoint(TRUNCATE)`, so that the frame of the write-ahead log that
held the key's page goes too: neither `client.db` nor `client.db-wal` has the
key's text afterwards. A sign-out runs the checkpoint once, after its last step,
not after each row it removes. The checkpoint waits for another connection for
`KeyStore::remove` that forgetting a Voelin key and a sign-out delete with) is
followed by a `PRAGMA wal_checkpoint(TRUNCATE)`, so that the frame of the
write-ahead log that held the key's page goes too: neither `client.db` nor
`client.db-wal` has the key's text afterwards. A sign-out deletes the synced
copies (private keys of TeamSpeak identities), the account record and, when the
user chose to forget it, the device key; it runs the checkpoint once, after its
last step, not after each row it removes, and not at all when it deleted
nothing. The checkpoint waits for another connection for
150 ms at most (the connection's own busy timeout is restored after it), because
while it waits for a reader it holds the writer lock of the log and every other
writer waits with it. If another connection blocks it (one that keeps reading an
+55 -15
View File
@@ -19,7 +19,8 @@ here; section 11 lists what it has to do.
Read for this design: `crates/voelin-core/src/link.rs`, `ts_link.rs`,
`voice.rs`, `book.rs`, `stream.rs`, `files.rs`, `session.rs` (its use of the
link), `tests/link_fake.rs`, `voelin-audio/src/packet.rs`; and in
VoelinProtocol (main `c8e0e5a`) `crates/voelin-proto/src/link.rs`,
VoelinProtocol (main at the pin of that round; moved to `c5bb6b9` by task 34)
`crates/voelin-proto/src/link.rs`,
`media.rs` with `media/`, `test_util/` (FakeHost, FakeSession,
FakeConnector, FakeAccountAgent, the conformance suite),
`proto/voelin/v1/*.proto`, `crates/voelin-model/src/replica/` and
@@ -789,8 +790,8 @@ against this record, not against an assumption.
### Slice 1: the adapter
1. **Protocol crates at one revision.** `voelin-identity`, `voelin-proto`
and `voelin-model` from VoelinProtocol at one rev (main `c8e0e5a` or
later: it has `AccountAgent`, `IssuerTrust`, `Credential::Account`;
and `voelin-model` from VoelinProtocol at one rev (the main of the seam
round or later: it has `AccountAgent`, `IssuerTrust`, `Credential::Account`;
`voelin-identity` changed only in `cert.rs` and `revocation.rs` since
`64808cc`). `crates/voelin-model` is removed and every crate that used it
takes `voelin-model = { workspace = true }` (`voelin-core`, `-ui`,
@@ -1217,7 +1218,8 @@ second that works.
### 16.2 The conformance suite
**Through the registry.** `the_conformance_suite_passes_on_a_session_of_the_registry`
runs the 17 cases of `c8e0e5a` against the `FakeSession` that
runs the 17 cases of the protocol's suite (still 17, in the same order, at
`c5bb6b9`) against the `FakeSession` that
`Backends::connect(params, LocalCtx::standalone())` hands over: 17 of 17
pass, none is skipped. The registry adds nothing to a plain connector's
session (`host_uid` is the connector's, there is no stream port), so the
@@ -1733,15 +1735,52 @@ were fresh compose projects (`down -v`, `up -d`) for each smoke run.
`Command::ObserveGateway` link `ts::identity::to_blob`,
`VoiceOptions::client_version` links `ts::versions::resolve`.
- **The same leak in `voelin-store`, not closed.** `Store::identity` and
`Store::identities` read the stored JSON of a TeamSpeak identity with `?`, so
an `Error::Json` whose text is the `serde_json` message, which quotes a key
that does not import, as the gate's minor did in the connector. The rows are
written from a `tsclientlib::Identity` (`add_identity`), so a damaged
database is the only way to such a row; the key store (`keystore.rs`) drops
the parse error for the same reason. `ts::identity::from_json` cannot be
used there (`voelin-core` depends on `voelin-store`); the fix is the same
classification in `voelin-store`, or `from_json` moved down.
- **The key store follows task 34 (`phase4/keystore-task34`).** Open question 10
of the accounts design (answered by the owner on 2026-10-24) made
`KeyStore::sign_out` keep every device key, and VoelinProtocol `main`
(`c5bb6b9`) has it. `SqliteKeyStore` runs that trait method, so the follow-up
that Phase 2 task 34 leaves to this repository ("Note for VoelinClient") is
the pin of the three protocol crates, the tests that asserted the deletion
of a key made for the account (now kept, unbound, byte for byte; only
`DeviceKeyChoice::Forget` deletes a key of the device), and the documents:
`keystore.rs` and `docs/architecture.md`, "Identities", which has the three
parts of the question and the duties of the GPUI client (the sign-out
dialog's wording with "Forget this device's identity" and an export first,
the release in Settings → Account, and the delete-account dialog, which
warns that the account's servers become unreachable and offers an export of
the device keys first). A sign-out still deletes the synced copies and the
account record, so `SignOutPass` stays for their one checkpoint, and the
refusal of a device key stored as a synced copy stays, with its reason
reworded: the sign-out keeps the key but deletes every synced copy before it
reads the record. The store gained no release call and no "released" record:
`AccountClient::release` ends in `sign_out` with `Auto`, and the design asks
the client to remember nothing of a release. A note for VoelinProtocol, not
fixed here: when the device key's own row carries a device-only binding, the
trait's provided `sign_out` lists the key twice in `SignOut.unbound` (once in
its loop over the identities bound to the account, once in the `Auto` branch),
which the tests of this repository do not mind (they use `contains`) and which
is a follow-up for the protocol repository.
- **The same leak in `voelin-store`, closed in `phase4/keystore-task34`.**
`Store::identity` and `Store::identities` read the stored JSON of a
TeamSpeak identity with `?`, so an `Error::Json` whose text is the
`serde_json` message, which quotes a key that does not import, as the gate's
minor did in the connector. The rows are written from a
`tsclientlib::Identity` (`add_identity`), so a damaged database is the only
way to such a row. `ts::identity::from_json` cannot be used there
(`voelin-core` depends on `voelin-store`), so the same classification is in
`voelin-store` (`identity_from_json`): the new `Error::Identity { damage,
line, column }` says malformed, cut short, not an identity or unreadable
(`IdentityDamage`), and where, and never the text. The key store
(`keystore.rs`) was checked line by line and does not leak: `check_teamspeak`
and `Columns::level` drop the parse error (`let Ok(..) else` and `map_or`),
and the binding warning names the row's kind and uid, not its data. A test
with six damaged rows (a key that does not import, a field of the wrong type,
syntax, a cut text, bytes that are no UTF-8 as a BLOB and as TEXT) calls
everything of the store and of the key store that reads or writes the row and
looks through the errors (text, `Debug` and sources) and the logs at TRACE for
any 8 characters in a row of what the row held
(`crates/voelin-store/tests/identity_text.rs`); it fails with the reader's
message put back.
- The bookmark tests of `link/connect.rs` that still sit in
`ts/ts_session/mod.rs` (17.2) belong next to it.
- `QueryLogin.allowlisted` goes with the query observer (H5), which becomes a
@@ -1795,7 +1834,8 @@ changes). `Cargo.lock`, `Cargo.toml`, `README.md`, `docs/ui.md`,
`crates/voelin-ui/Cargo.toml`, `app.rs` and `servers.rs` merged without a
conflict: the lock resolves with `--locked`, and its difference to `main`'s is
the branch's alone (the edges of `voelin-core` to `voelin-identity` and
`voelin-proto`, the revision `c8e0e5a` of the three protocol crates, and
`voelin-proto`, the revision of the three protocol crates that the branch
pinned (since moved to `c5bb6b9` by task 34), and
`voelin-model` as a git package). `CHANGELOG.md` is `main`'s entry
(`voelin-ui-vm`); the branch adds none (17.1), and still needs none: nothing
of this round is visible to a user.
@@ -1815,7 +1855,7 @@ included.
|---|---|
| `cargo fmt $(scripts/own-crates.sh) -- --check` | 1.94: clean at the head and at every commit (the merge first differed by the order of one `use` in `voelin-ui-vm`, fixed in the merge commit). Nightly: five files, the baseline's six without `voelin-ui/src/studio.rs`, which `main`'s split removed (`voelin-core/src/history.rs`, `voelin-media/src/ffmpeg/encoder.rs`, `voelin-stream/src/discovery.rs`, `voelin-ui/src/chat.rs`, `tools/voelinctl/src/engine.rs`); `voelin-ui-vm` is clean on both. |
| `cargo clippy $(scripts/own-crates.sh) --all-targets --no-deps --locked -- -D warnings` | 1.94: clean at the merge (and `-p voelin-ui` alone) and at the head. Each of the five new commits was checked out detached in this worktree and passes `fmt` and `clippy`: the merge on all own crates and on `-p voelin-ui` alone, the four others on `-p voelin-core -p voelin-store`. Nightly, `-p voelin-core --all-targets`: the same five errors as in 17.5 (`result_large_err` of `shutdown_connection` in `ts/voice.rs`, four `chunks_exact` in `audio.rs`), none in new code. |
| `cargo test -p voelin-core --locked --no-fail-fast` | At the head, 1.94 and nightly: 246 lib tests pass (244 + the two of this round), 2 are ignored, 2 fail, the two of the baseline (`discover::tests::without_records_the_gateway_itself_is_asked`, `web::tests::pictures_go_through_the_proxy_named_for_each_hop`: `localhost` resolves to `::1` only here); the integration tests pass (`session_fake` 19 and 2 ignored, the others as in 17.5). At the merge, before the minors: 244, the same two, and the integration numbers of 17.5. `cargo test -p voelin-ui -p voelin-ui-vm -p voelinctl`: 35, 146 and 7 pass. `voelin-store` (a comment changed): 31 lib tests and 49 of its integration tests pass, but `store::tests::a_blocked_checkpoint_waits_briefly_and_leaves_the_busy_timeout_as_it_was` failed once, in a run under a load average of 8.5 from other jobs on this machine (it asserts that a checkpoint returned in under a second of wall clock); it passed in five isolated runs and three more runs of the crate; it was not chased (a crate this round left alone). |
| `cargo test -p voelin-core --locked --no-fail-fast` | At the head, 1.94 and nightly: 246 lib tests pass (244 + the two of this round), 2 are ignored, 2 fail, the two of the baseline (`discover::tests::without_records_the_gateway_itself_is_asked`, `web::tests::pictures_go_through_the_proxy_named_for_each_hop`: `localhost` resolves to `::1` only here); the integration tests pass (`session_fake` 19 and 2 ignored, the others as in 17.5). At the merge, before the minors: 244, the same two, and the integration numbers of 17.5. `cargo test -p voelin-ui -p voelin-ui-vm -p voelinctl`: 35, 146 and 7 pass. `voelin-store` (a comment changed): 31 lib tests and 49 of its integration tests pass, but `store::tests::a_blocked_checkpoint_waits_briefly_and_leaves_the_busy_timeout_as_it_was` failed once, in a run under a load average of 8.5 from other jobs on this machine (it asserts that a checkpoint returned in under a second of wall clock); it passed in five isolated runs and three more runs of the crate; it was not chased (a crate this round left alone; the bound was replaced in `phase4/keystore-task34` by a one-hour busy timeout and a 30 s hang detector). |
| The lib suite 10 times in a row (1.94) | `cargo test -p voelin-core --lib`: ten runs, each 246 passed, 2 failed, 2 ignored, the same two failing tests every time, the banner test passing every time. The same ten runs with those two tests skipped (`--skip`): exit 0 every time (246 passed, 2 ignored). `session::banner_tests::a_failing_banner_is_logged_once_with_its_address` (17.5 saw it fail once) did not fail in these 20 full runs, so the test is as it was: a fix would be a guess at a cause nobody has seen. |
| `RUSTDOCFLAGS='-D warnings' cargo doc --no-deps -p voelin-core` | passes, with and without `--features media-desktop`. |
| The acceptance of section 10 | The `rg` is empty from the repository root (`--glob '!**/ts/**'`) and from `crates/voelin-core/src` (`--glob '!ts/**'`), with the four exceptions; `session.rs` names none of `tsclientlib`, `tsproto`, `voelin_query`, `ts_bookkeeping`; the grep of `pub` items outside `ts/` is empty; the rustdoc JSON of `voelin-core` (nightly, `--features media-desktop`; every item of the crate, 5,292 of them, whose type references name `tsclientlib`, `tsproto*`, `ts_bookkeeping`, `voelin_query` or `voelin_observer`) has 11 items with such references, all in `voelin_core::ts` (`to_blob`, `from_blob`, `export`, `write_export`, `improve_level`, `Found::identity`, `resolve`, `native_version`, `KnownVersion::to_version` and the two setters), none elsewhere; `voelin_core::stream` keeps its re-exports; `cargo tree -p voelin-core -e normal` still lists `tsclientlib` and `tsproto*`. |
+153 -35
View File
@@ -22,11 +22,29 @@ crates/voelin-ui-vm/ view models and state, no UI toolkit
studio_bridge.rs the same for the Stream Studio
state.rs AppState, SessionView, Tab, Msg: what the client knows apart from
the window, generic over the list type of a chat tab's lines
servers.rs tree.rs chat.rs social.rs home.rs streams.rs avatar.rs studio/mod.rs
host.rs Host (what a transition asks of its front end), Update (what it
tells: Refresh, status, commands, Persist, ...), Cx
events/ events::apply: what an engine event does to the AppState
(mod.rs; gateway.rs: the gateway's events and directory)
previews.rs pictures linked in chat: which to fetch, the transfers
servers/mod.rs tree.rs chat/mod.rs social/mod.rs home.rs streams/mod.rs avatar.rs studio/mod.rs
pure view models (engine state → bridge structs), unit-tested
chat/logic.rs chat tabs, messages and what is read, pins and topics, files; the
chat view (tabs, lines, divider, drawers) and the user's moves
streams/logic.rs the streams we share and watch: their state, the events and the
user's choices, the streams panel's, the share card's and the
viewer's rows and texts
servers/logic.rs which server is shown and how it is observed, joining a channel;
the rail, the server card and the channel tree as plain data
settings.rs the UI's settings keys, the audio form
settings_pages/logic.rs, studio/logic.rs
the decisions of the settings pages and of the Stream Studio
dev/logic.rs the sample data of `VOELIN_DEMO_UI` as plain values and events
social/logic.rs the friends, the bell and the search as rows, what the user's moves on
them do, and what an event does to the friends, pokes and notices
settings_page/logic.rs
the audio settings page (devices, form, microphone test, push to
talk), the crash notice and the volume dialog of a client
bbcode.rs emoji.rs chat formatting; the Twemoji archive, text → runs of text and emoji
crates/voelin-ui/ the Slint front end
ui/
@@ -53,20 +71,32 @@ crates/voelin-ui/ the Slint front end
phone layout)
assets/ fonts/ (Inter, OFL), icons/ (Lucide, ISC), logo.svg
src/
app.rs setup, the Slint models (`Models`), event dispatch; `App` holds
app.rs setup, the Slint models (`Models`), the event loop; `App` holds
a `voelin_ui_vm::state::AppState` and the window
servers.rs chat.rs members.rs streams.rs settings_page.rs appearance.rs
home.rs social.rs messages.rs events.rs previews.rs popout.rs
the Slint side of each area (social.rs: contacts, the bell and the
search; previews.rs: pictures in chat; popout.rs: the stream's own
window)
host.rs SlintHost (the answers the transitions ask for), `App::handle_event`,
`transition` and `perform`: doing what an `Update` says
members.rs appearance.rs
home.rs messages.rs events.rs previews.rs popout.rs
the Slint side of each area (previews.rs: pictures in chat;
popout.rs: the stream's own window)
chat/ mod.rs, bind.rs: the chat view's Bridge writes and models
servers/ mod.rs, bind.rs: connecting and observing (store, secrets, engine),
the rail, the server card and the tree on the Bridge
social/ mod.rs (the models), bind.rs: contacts, the bell and the search on
the Bridge, the desktop toasts, the navigation after a move
settings_page/ mod.rs, bind.rs: the audio devices, the hotkey, the codec download,
the crash reports and the Bridge writes of the settings page
settings_pages/ mod.rs (Pages), bind.rs: the settings pages on the Bridge
streams/ mod.rs (Share: the capture), bind.rs: the streams panel, the share
dialog and the viewer on the Bridge, the capture and the decoder
studio/ mod.rs (StudioState), bind.rs: the Stream Studio's windows and engine
bind/ callbacks of each area, wired once; convert.rs, convert/items.rs
(plain values → Slint values), rows.rs (a Slint model kept in step
with a plain list)
images.rs the image cache (LRU, bounded by `ui.image_cache_mb`)
dev.rs development switches (screenshots, sample data)
dev/ mod.rs (the switches, listed), bind.rs: the window's size, the
screenshot, the screens opened at start, the sample data fed through
the app's own events
```
Models are created once (`app::Models`) and updated row by row with
@@ -87,12 +117,18 @@ this file is `voelin_ui_vm::chat`. The boundary:
- **Values.** A picture is an `ImageRef` (`Arc<ImageSource>`: a file of the
engine's cache with its stamp, decoded RGBA pixels, SVG or memory bytes,
or none; `size()` reads a file's header). A colour is an `Rgb(u32)`, a
or none; `size()` decodes a raster file once to tell it shows, and parses an SVG, so a
picture with a size is one a front end can draw). A colour is an `Rgb(u32)`, a
shared string an `Arc<str>`, a list a `Vec`. The bridge structs (51 in
`bridge.rs`, 10 in `studio_bridge.rs`) are plain `Clone + PartialEq + Debug`
structs with the field names of the Slint structs in `bridge.slint` and
`studio-bridge.slint`; `MytsBadge` and `MytsForm`, which have no data source
in this build, stay Slint-only.
in this build, stay Slint-only. The crate warns about undocumented public
items (`#![warn(missing_docs)]`) and has none, the mirror modules' 559
fields (460 in `bridge.rs`, 99 in `studio_bridge.rs`) included: 210 carry
the comments of the `.slint` files, and the other 349 (288 in `bridge.rs`,
61 in `studio_bridge.rs`), which had none there, were described from the
code that fills them. No module is exempt from the lint.
- **Lists.** `list::diff(old, new)` gives `Changes`: updates, removals and
insertions by index, in the order to apply them. `bind/rows.rs` applies
them to a `VecModel` and converts only the changed rows; a GPUI view
@@ -106,44 +142,124 @@ this file is `voelin_ui_vm::chat`. The boundary:
`voelin_ui_vm::state`, generic over the list type `L` of a chat tab's
lines: the Slint app plugs in `Rows<ChatLine>` (`app::ChatRows`), a front
end that re-renders can use a `Vec`. `App.state` is the one `AppState`.
- **Events.** `voelin_ui_vm::events::handle(state, social, host, event)` is
the one dispatch: it lets `social::logic::event` look at the event first
(the friends, pokes, offline messages and the notices, which need the state
as it was before the event), then `events::apply` changes the `AppState`,
and returns an `Update`, which says what the front end has to do: the parts
to draw again (`Refresh`, each once however many events set it), the status
line, the engine commands in order, what to keep (`Persist`: a bookmark,
the UI's settings, the audio settings, the clients' volumes), pictures to
decode again, the password dialog, notices for the bell, the chats that
changed and a stream to watch. `Host` is what the transitions ask while
they run: whether the chat or a private chat is on screen, the store's read
markers, the preview limit, the time. The Slint client's
`App::handle_event` is `handle` and then `perform`, which carries the update
out in `host.rs`; a GPUI client calls `handle` and draws what
`Update::refresh` names. The vm tests replay tapes of events against a fake
`Host` (`events/tests.rs`, `social/logic.rs`). `Update::rest` hands back the
events whose state is not in the `AppState`: the Stream Studio's stream
(`StreamState` and `StreamViewers` while `Host::studio_streams_to`),
`SettingChanged`, the answers to the offline message requests
(`RequestDone`, a list that failed; `messages.rs` keeps those for now), and
the rest that no screen looks at. `perform` handles `rest` before it draws
what `Update::refresh` names, as what the front end keeps may be on screen.
The text of an offline message is not in `rest`: `Event::OfflineMessage`
changes the `Social` state (`mail`, and the inbox row turns read) in
`social::logic::event`, so the redraw shows it (a tape test in
`social/logic.rs`). The streams we share and watch are in the `AppState`
(`share`, `watch`; the capture and the decoder are the front end's, and an
update says when to attach or drop them). The friends, the pokes, the
bell's notices, the text of the open
offline message and what the friends page and the search keep are in
`Social` (`social::logic`), which a front end passes to `handle` besides
the `AppState`.
- **Logic and bind.** An area that interleaves decisions with Bridge writes
is split into `<area>/logic.rs` in `voelin-ui-vm` (functions over the
settings service, the `AppState` and plain rows; they return rows,
commands or messages for the status line, and write no Bridge) and
`<area>/bind.rs` in `voelin-ui` (the Bridge and model writes, windows,
timers, threads, engine commands). Done: `settings_pages` and `studio`.
timers, threads, engine commands). Done: `settings_pages`, `studio`, `streams`, `chat`, `servers`, `settings_page`, `social` and `dev`.
The pure code is tested in `voelin-ui-vm` (`cargo test -p voelin-ui-vm`,
no display); the Slint crate's tests are what needs the window types.
### Controllers still to split
Counted as `.set_` calls per file (`grep -c '\.set_'`, the status line's
`set_status` included) before this round's splits; Bridge writes alone are
about four fifths of each. Each one is a slice of the same shape as
`settings_pages` and `studio`: move the decisions into
`voelin-ui-vm/src/<area>/logic.rs`, keep the writes in
`voelin-ui/src/<area>/bind.rs`.
Plan section 6 step 2 (the toolkit-free `voelin-ui-vm` crate) is done: the
view models, the state, the state transition of every engine event and the
decisions of every area controller that interleaved them with Bridge writes
are in `voelin-ui-vm`, and the Slint crate keeps the writes. What is left
for step 3 (the GPUI front end) is the list at the end of this section.
Status at the merge of main 6e0df51 (2026-10-24): the branch carries the
session seam of main (c60acf9) and, since, the CI deploy key, the media codec
test and the seam follow-ups. None of them touches `voelin-ui` or
`voelin-ui-vm`, and the `.set_` counts below were counted again on the merged
tree and are as stated. The colour of a chat's avatar (the server's own for a
server's chat, the title's colour for any other and for a server that is
gone, never black) is `servers::logic::conversation_tint`, which `messages.rs`
calls and a test pins.
The measure is the number of `.set_` calls in the file (`grep -c '\.set_'`):
every setter counts, those of the Bridge, `Nav`, the window, models and the
engine, and the status line's `self.set_status(…)`, which writes the Bridge's
status text too. In the seven largest files before this round's splits
(230 calls: `streams.rs`, `chat.rs`, `app.rs`, `servers.rs`, `settings_page.rs`,
`social.rs` and `dev.rs`) 150 are direct writes to the Bridge (140 written as
`bridge.set_…`, ten as `ui.global::<Bridge>().set_…` or a chained setter;
one of the ten is `set_status_text`, the write inside `set_status`, so it is
not one of the 36) and 36 go through the status line, so Bridge writes are 186
of the 230, about four fifths of those files, and direct ones about two
thirds; the rest are `Nav`, window and engine setters (in `dev.rs` mostly
those). Each controller was a slice of the same shape as `settings_pages` and
`studio`: the decisions moved into
`voelin-ui-vm/src/<area>/logic.rs`, the writes stayed in
`voelin-ui/src/<area>/bind.rs`. The `.set_` calls of each file before and
after, every number counted with that command:
| Area | Before | After |
|---|---|---|
| Stream Studio | `studio.rs` 64 (62 once the view models had moved) | `studio/bind.rs` 58 |
| Settings pages | `settings_pages.rs` 52 | `settings_pages/bind.rs` 51 |
| Streams | `streams.rs` 45 | `streams/bind.rs` 38 |
| Chat | `chat.rs` 38 | `chat/bind.rs` 31 |
| Servers | `servers.rs` 37 | `servers/bind.rs` 31 |
| Audio settings page | `settings_page.rs` 26 | `settings_page/bind.rs` 26 |
| Friends, the bell, search | `social.rs` 23 | `social/bind.rs` 5 and `social/mod.rs` 15 (the models handed to the Bridge once) |
| Development switches | `dev.rs` 23 | `dev/bind.rs` 21 |
| Event dispatch and setup | `app.rs` 38 | `app.rs` 31 and `host.rs` 8 (carrying out an `Update`) |
The Bridge and model writes stay where the toolkit is, and what each write
says now comes from `logic.rs`, which has tests of its own.
Why the studio went before `streams.rs`: it had the most calls, and it is
self-contained. It has its own state (`StudioState`), windows and bridge
(`studio-bridge.slint`), so its decisions moved without touching the event
dispatch of `app.rs`. `streams.rs`, `chat.rs` and the rest of the list were
driven by that dispatch (the watch, share and history events), so they
followed it: the state transition of every engine event came first
(`events::apply`), then the controllers that show the result, `streams` first
as the one whose events were still the front end's.
Still to split before or while the GPUI front end is written (the files as they
stand):
| File | `.set_` calls | What it mixes |
|---|---|---|
| `streams.rs` | 45 | the streams panel, viewer and share dialog: what the voice card, the viewer header and the share form say, with the watch and share bookkeeping |
| `chat.rs` | 38 | the chat view: lines, the unread divider, pins, topics and downloads, with the engine's history batches |
| `app.rs` | 38 | event dispatch and the status line, the toolbar and tree refreshes |
| `servers.rs` | 37 | the rail, the server dialog and the channel tree's refresh |
| `settings_page.rs` | 26 | the audio settings page and the devices |
| `social.rs` | 23 | home's contacts, the bell and the search |
| `dev.rs` | 23 | development switches and the sample data (the switches stay with the window; the sample rows can move) |
| `app.rs` | 31 (4 in tests) | setup and the model hand-off, the status line, `setting_changed` (which setting touches what); the event dispatch itself is `vm::events::handle` and `events::apply`; the toolbar and tree refreshes are `servers/bind.rs` (`refresh_toolbar`, `refresh_tree`), which `app.rs` only calls |
| `images.rs` | 13 | the decoded-picture cache |
| `messages.rs` | 12 | direct messages |
| `messages.rs` | 11 | direct messages |
| `appearance.rs` | 11 | theme, font scale and breakpoints |
| `popout.rs` | 8 | the viewer's own window |
| `members.rs`, `links.rs`, `inbox.rs`, `home.rs`, `events.rs` | 6, 5, 5, 5, 4 | small; split with their neighbours |
Before this round: `studio.rs` had 62 and `settings_pages.rs` 52 (the two
with the most). Their `bind.rs` files still show 58 and 51 `.set_` calls: the
Bridge and model writes stay where the toolkit is, and what each write says
now comes from `logic.rs`, which has tests of its own.
The gate that accepted `voelin-ui-vm` asked for the `app.rs`/`events.rs` split
before the GPUI client. The dispatch is what moved (the `app.rs` part:
`handle` and `apply` in the crate, `host.rs` here); `events.rs` of
`voelin-ui` is no dispatch but the controller of the gateway's events page
(the event form, RSVP, the channels an event can be in), and it is not split.
Neither is the rest of `app.rs` named above: they are the next slices.
## Theme tokens
@@ -423,14 +539,16 @@ with the sample studio's sources, live at once with sample viewers.
## Adding a server
The add-server dialog (`BookmarkDialog` in `screens/dialogs.slint`, logic in
`servers.rs`) asks for the address (host, host:port, IP or server
`servers/`: the decisions in `voelin-ui-vm`'s `servers::logic`, the Slint side
in `servers/bind.rs`) asks for the address (host, host:port, IP or server
nickname; the resolver finds the port through SRV records and TSDNS) and
an optional server password. *Advanced* (open when editing) has the name
and the nickname, and empty fields there are filled in: the name is the
address until the first connection, then the server's own name
(`adopt_server_name`); the nickname is the default identity's (one imported
from TeamSpeak keeps its nickname there), else the system user's, else
"Voelin user"; the identity is the default one, there is no default channel.
(`adopt_server_name` in `voelin-ui-vm`'s `events`); the nickname is the
default identity's (one imported from TeamSpeak keeps its nickname there),
else the system user's, else "Voelin user"; the identity is the default one,
there is no default channel.
There are no gateway or ServerQuery fields: the gateway is looked up from
the address (DNS SRV records, else the gateway's `/.well-known/tsgw`) when
the server is saved, selected or connected
@@ -515,7 +633,7 @@ for importing the official clients' identities on start
the Slint side as `impl App` in `voelin-ui/src/<name>.rs`, with the
decisions in the view-model crate (`<name>/logic.rs`, [Two
crates](#two-crates)).
5. A development switch to open it (`dev.rs`, `VOELIN_OPEN=<name>`), a
5. A development switch to open it (`dev/bind.rs`, `VOELIN_OPEN=<name>`), a
screenshot (below) and a line in this file.
## Settings
@@ -601,7 +719,7 @@ notifications and the home's news show the text on one line
## Development switches and screenshots
Environment variables (see `src/dev.rs`):
Environment variables (see `src/dev/mod.rs`):
- `VOELIN_DEMO_UI=1`: sample servers, channels, members, chat with
formatting and emoji (and two pages of older messages, which load when