Files

2042 lines
182 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# The session seam: the engine on `voelin_proto::link::Session`
Status: design (2026-10-20); slices 1, 2 and 3 are implemented (section 13
says how slice 1 differs from this text, sections 14 and 15 what its reviews
changed, section 16 what slice 2 built, found and corrected, section 17 what
slice 3 moved, changed and ran, 17.7 the round after its review, which
brought the branch onto main `ad20979`, 17.9 the move of the pin to the tag v0.2.0, and 17.8 the round after the gate of the
merge; 17.6 has the complete edge list for the second half); section 10 has
the slices.
Design for the first half of plan step 7 (Phase 4): the engine consumes
`voelin_proto::link::Session`, `ServerLink` becomes an adapter over it, and
the TeamSpeak link (`TsLink`) becomes a `Session` implementation that still
lives in this repository, in process. The second half (the TeamSpeak
`Session` implementation moves to VoelinGateWay as `voelin-gateway-ts`, and
`voelin-stream`'s dependency on `voelin-media` is split) is out of scope
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 at the pin of that round; moved by task 34, and since then to the tag `v0.2.0`, 17.9)
`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
`docs/protocol.md` sections 1.2, 1.3, 2.4, 2.5, 4.7, 5, 6, 9.1, 11 and 13.8.
## 1. Terms and the decisions in one place
| Term | Meaning here |
|---|---|
| **engine** | `voelin-core` without the TeamSpeak implementation: `lib.rs`, `session.rs`, history, contacts, cache, settings, the audio thread, the adapter below. |
| **SessionLink** | New, engine side. A `ServerLink` whose connections are `Arc<dyn Session>`s from the registry: it turns `LinkCmd`s into `Session` calls and pushes, signals and media into `LinkEvent`s. `session.rs` keeps talking `LinkCmd`/`LinkEvent` to it. |
| **Backends** | New, engine side. The registry of connectors by address scheme: `voelin_proto::link::Connectors` plus the in-process connectors that also hand the engine local ports (below). |
| **LinkSession** | New, TeamSpeak side. A `Session` over any `ServerLink`, generic in the link. `LinkSession<TsLink>` is the in-process TeamSpeak `Session`; `LinkSession<FakeLink>` is what the link tests run through. |
| **TsConnector** | New, TeamSpeak side. The `Connector` for `ts3server` and `teamspeak` (and addresses without a scheme) that makes `LinkSession<TsLink>`s. |
| **StreamPort** | New, local extension. The in-process channel that carries `LinkCmd::Stream` and the stream events past the `Session` trait while TeamSpeak 6 streams are not yet v1 entities (section 6.4). |
| **old model** | The client's TeamSpeak-shaped types (`Presence`, `ChannelInfo`, `ClientInfo`, `ChatMessage`, `ServerDetails`) that `session.rs` and the UI use. |
Decisions:
1. **Two adapters, one vocabulary in the middle.** `session.rs` is not
rewritten: it keeps `LinkCmd`/`LinkEvent`. SessionLink translates them to
and from v1; LinkSession translates v1 to and from the inner link's
`LinkCmd`/`LinkEvent`. With a fake link inside, the pair round-trips, so
the existing FakeLink tests check both translations (slice 1).
2. **The engine keeps a replica.** SessionLink feeds every push into
`voelin_model::replica::Replica` and projects it into the old model with
`replica::convert` plus the fix-ups of section 5.3. This needs the
protocol's `voelin-model` (a superset of the client's, byte for byte the
same in `presence.rs`, `server.rs`, `chat.rs`, `percent.rs`), so slice 1
switches the client's `voelin-model` to the protocol crate (the plan's
section 4 already moves it there). Two crates named `voelin-model` in one
graph would make `scripts/own-crates.sh`'s `-p voelin-model` ambiguous, so
there is no half-way.
3. **Streams stay on a local port in this half.** TeamSpeak 6 streams are
peer to peer; v1 carries only their signalling (`Stream`, `Viewer`,
`RespondViewer`, `KickViewer`, `Signal{stream}`, protocol 6.11 and 11.1).
Moving the str0m peer out of the TeamSpeak stream task and mapping its
signalling is the second half's first item; here `LinkCmd::Stream` and
the stream events pass through `StreamPort`, unchanged.
4. **File transfers go through v1 now.** `read_file`/`write_file` carry them;
the engine does the copying, progress and cancel itself, and the
TeamSpeak side hands out the raw transfer connection (two new inner
commands, section 8).
5. **TeamSpeak-only connect options ride the `ts3server://` link** that
`voelin_model::link::ServerLink::to_url` already writes (`channel`/`cid`,
`channelpassword`), until v1 has a field for them (follow-up P1); the
client version `TsConnector` impersonates rides it too, as a parameter of
our own (`client_version`).
6. **No TeamSpeak type crosses the seam**: what crosses is `voelin_proto`
types, the old model (TeamSpeak-shaped, but the client's own types),
`voelin-audio` packets and the core-owned stream types. Section 10 says
which public items still name `voelin-stream` peer types, and why.
## 2. Shape after this half
```
UI ── Engine (Command / Event) ── session.rs (merge, dedup, history, contacts)
│ LinkCmd ↓ ↑ LinkEvent
SessionLink (engine side: replica, projection,
│ media framing, transfers, talk tracker)
│ Arc<dyn Session> + pushes + MediaSink
│ (+ StreamPort for in-process connectors)
Backends ─────┼──────────────────────────┐
(scheme registry) ▼ ▼
TsConnector → LinkSession<TsLink> any Connector: FakeConnector
(ts3server, teamspeak, no scheme) (tests), QuicConnector (later)
│ LinkCmd ↓ ↑ LinkEvent (inner, TS side)
TsLink: voice.rs, book.rs, stream.rs, versions.rs,
identity.rs on tsclientlib, voelin-stream
```
The gateway (`tsgw`) and ServerQuery sources of a session are not behind
the seam in this half: they are the other two sources of `session.rs`
(`gateway.rs`, `query.rs`) and become a second `Session` to a gateway daemon
later (protocol 11.2, follow-up H5). Only their public command types change
in slice 3 (section 10).
## 3. The mapping
### 3.1 `LinkCmd` → `Session`
Every variant of `voelin_core::link::LinkCmd`. "SessionLink" is what the
engine does; "LinkSession" is how the TeamSpeak side answers. `S` is the
server id from the connect sequence (section 4.2), `P` our participant id,
`slot` our media slot. Text in errors is reproduced exactly as `TsLink`
writes it today (section 4.6).
| `LinkCmd` | Session call (SessionLink) | Answer and what the engine reports | LinkSession (TeamSpeak side) |
|---|---|---|---|
| `SendChat(target, text)` | `request(Put{writes:[Message{channel_id, text, format, nonce}]})`. `Channel(cid)`: that channel. `Server`: the channel of kind `SERVER_CHAT` in SERVER(S). `Private(uid)`: the DM channel in HOME whose other recipient's `User` has that uid; without one, first `request(Put{Channel{server_id:0, kind:DM, recipients:[user]}})`. `format`: `BBCODE` when the session offers `chat.bbcode`, else `MARKDOWN`. | `Entities` ignored (the `Change` that follows is the echo, section 3.2). `Rejected` → `LinkEvent::Error("message: {Error.message}")`. No `User` for `uid` → `Error("private message: the client is not on the server (send an offline message instead)")`, without a request. | Inner `SendChat`. A VOICE channel other than our own is refused `NOT_IN_CHANNEL`. Answered at once with the message as written (local id and rev): `TsLink` reports success of a text message nowhere, failures come later as a notice (section 3.2). The answer adds no `Change`: the inner link's echo is the `Change`, with an id of its own, because the inner link does not tie the echo to the send (H1 does). A `Put Channel{DM}` answers the synthetic DM channel (section 5.2) and puts it in HOME. |
| `Move(channel, password)` | `request(JoinVoice{server_id:S, channel_id, password})` (`None` → empty). | Own `VoiceState` → nothing (the move shows in LIVE). `Rejected` → `Event::JoinFailed{channel, reason}`: `PASSWORD` → `JoinFailure::Password`, `FULL` → `Full`, any other → `Other(Error.message)`. | Already in that channel and no move of ours on its way: answer the own `VoiceState`, send nothing (today `ChannelAlreadyIn` is silent too). While a move is on its way the snapshot is where we were, not where that move leaves us, so the request goes to the link whatever channel the snapshot shows (a move back into the channel we never left is answered when the first move is refused, or when its channel is the snapshot's). Else inner `Move`; answered when our channel becomes `channel_id` (own `VoiceState`), refused when the inner link reports `Event::JoinFailed` for it (`Password` → `PASSWORD`, `Full` → `FULL`, `Other(text)` → `FORBIDDEN` with `text`), `SessionError::Timeout` after 10 s. The first `JoinVoice` of a connection confirms the seat (section 4.2). |
| `SetInputMuted(b)` | `notify(Put{Write{VoiceState{S, P, self_mute:b}, paths:[self_mute]}})` (protocol 4.7: own voice flags are fire and forget). | `Err` only for a closed session: ignored. | Inner `SetInputMuted(b)`. |
| `SetOutputMuted(b)` | `notify(Put{Write{VoiceState{S, P, self_deaf:b}, paths:[self_deaf]}})`. | As above. | Inner `SetOutputMuted(b)`. |
| `Audio(EncodedVoice)` | `send_media(MediaClass::Voice, MediaPacket{flow: FlowId::new(slot, voice_sub::CHANNEL), rtp})`, RTP as in section 6.1. | `Dropped`: counted (stats). `NotOwned` (no slot yet), `TooLarge` (over `stats().max_rtp`): dropped, logged once per connection. `Closed`: ignored. | Inner `Audio(EncodedVoice{codec, payload})` for our own slot only (section 6.2). |
| `Stream(StreamCmd)` | None in this half: `StreamPort::send(cmd)` (section 6.4; the v1 mapping of every `StreamCmd` is table 6.4). Without a port the engine reports no `streams` capability, so `session.rs` never sends it. | Bus events and `OwnStream`/`StreamAudio`/`StreamAudioEnded` come back through the port. | Inner `Stream(cmd)`, in issue order with everything else (one queue). |
| `Poke{client, message}` | `request(Signal{to:SignalTarget{server_id:S, participant_id:client}, body:Poke{message}})`. | `Ack` → nothing. `Rejected` → `Error("poke: {Error.message}")`. | Inner `Poke`; answered `Ack` at once (failures come as a notice). |
| `ListFiles{request, dir}` | `request(List{kind:FILE, parent:dir.channel, path:dir.path, password})` (refused locally without `files`). | `Event::FileList{request, channel, path: files::normalize_dir(path), result}`: `Ok` with each `FileEntry` as `files::FileEntry{name, size, modified_s: modified_ms/1000, is_dir}`, or `Err(text)`. | Inner `ListFiles` with a request id of its own; its `Event::FileList` becomes the `Entities` answer (`modified_ms = modified_s * 1000`), or `Rejected` with the text. |
| `Download{transfer, file, sink, report}` | `report(Requested)`, then `read_file(FileRead{target: Path(FilePath{channel_id, path, password}), offset: sink.offset(), length:0})`; the engine runs `files::download` (made generic over `AsyncRead`) on `Download.body` with `FileEntry.size` from `head`. A picture (`transfer: None`) keeps today's limit (`cache::MAX_PICTURE_BYTES`) and deadline (`image_download_time`), now applied here. | `TransferState`s through `report`, as today. `Err` → `report(Failed(text))`. The task is kept under `transfer` for `CancelTransfer`. | Inner `OpenRead` (new, section 8): the TeamSpeak transfer connection itself becomes `body`, `head` is `FileEntry{size}`. No deadline of its own: the engine puts one on a picture's negotiation (`IMAGE_NEGOTIATION`) and none on a file the user asked for, and a caller that drops the call takes the inner job with it. |
| `Upload{transfer, file, from, overwrite, resume, report}` | Size and kind of `from` checked here (today's texts: "{path} is not a file", "{path}: {error}"). With `resume`, the offset is the `size` of the target in `List{FILE}` of its directory (0 when absent). `write_file(FileWrite{target: Path(...), size, offset, overwrite})`; the engine runs `files::upload` (generic over `AsyncWrite`) into `Upload.body`, then awaits `Upload.done`. | `TransferState`s as today; `Done` after `done` resolved. | Inner `OpenWrite` (new): the transfer connection becomes `body`; the server's seek position must equal `offset`, else `CONFLICT` "the server has N bytes" (follow-up P4). `done` resolves when the inner job reports the end. No deadline of its own, as for a download. |
| `CancelTransfer(id)` | No call: the engine aborts its copy task (dropping the body cancels on both v1 and TeamSpeak), removes the `.part` file, reports `Cancelled`; an unknown id is logged, as today. | — | The dropped connection ends the TeamSpeak transfer. |
| `DeleteFiles{request, channel, password, paths}` | `request(Delete{keys:[FileEntry{channel_id, path: dir, name, password}...]})`, one key per path (`/dir/name` split at the last `/`). | `request: Some` → `Event::RequestDone{request, result}`; `None` → nothing (best effort). | Keys grouped by channel → inner `DeleteFiles{request: Some(own id)}` each; `RequestDone` → `Ack` or `Rejected`. |
| `RenameFile{request, from, to}` | `request(Put{writes:[Write{FileEntry{channel_id: to.channel, path, name, password: to.password, from_channel_id: from.channel, from_path: from.path, from_password}}]})` (a create of an unused key: no `paths`). | `RequestDone{request, result}`. | Inner `RenameFile`. |
| `CreateDirectory{request, dir}` | `request(Put{writes:[Write{FileEntry{channel_id, path, name, is_dir: true, password}}]})`. | `RequestDone{request, result}`. | Inner `CreateDirectory`. |
| `SetAvatarHash{request, hash}` | `request(Put{writes:[Write{User{id: own user, avatar: Image{hash}}, paths:[avatar.hash]}]})` (the leaf path, so the myTeamSpeak `url` in the same `Image` stays). | `Some(request)` → `RequestDone`; `None` → `Rejected` becomes `Error("avatar: …")`. | Inner `SetAvatarHash`. (`replica::convert` reads the TeamSpeak avatar from `User.avatar.hash`; follow-up P7 on `Member.avatar`.) |
| `OfflineList{request}` | `request(List{kind:MAIL})` (refused locally without `mailbox`). | `Event::OfflineMessages{request, result}` from the `Mail`s (`OfflineMessageInfo` fields from `id`, `from_uid`, `from_name`, `subject`, `ts_ms`, `read`). | Inner `OfflineList`; its event becomes `Entities[Mail…]`. |
| `OfflineGet{request, id}` | `request(List{kind:MAIL, ids:[id]})` (v1: `List{MAIL, ids}` returns the text). | `Event::OfflineMessage{request, result}`. | Inner `OfflineGet`. |
| `OfflineAdd{request, to_uid, subject, text}` | `request(Put{writes:[Write{Mail{id:0, to_uid, subject, text}}]})`. | `RequestDone`. | Inner `OfflineAdd`; answers the mail as written (id 0: `messageadd` returns none). |
| `OfflineDelete{request, id}` | `request(Delete{keys:[Mail{id}]})`. | `RequestDone`. | Inner `OfflineDelete`. |
| `OfflineFlag{request, id, read}` | `request(Put{writes:[Write{Mail{id, read}, paths:[read]}]})`. | `RequestDone`. | Inner `OfflineFlag`. |
| `Disconnect` | `close(CloseCode::Normal, "")`, then `closed()`. A closed command channel does the same. | `LinkEvent::Disconnected(None)` (section 4.5). | Inner `Disconnect`; `closed()` resolves `Local(Normal)` when the inner link reports its end. |
Requests with a `RequestId` that cannot be sent (no session yet, closed)
answer as today: `session.rs` already reports "not connected with voice"
before a link exists; SessionLink reports `SessionError` texts (4.6).
`LinkSession::notify` follows the `Session` contract (it errors for a closed
session or a misplaced op, as `FakeSession` does): `Hello`, `List`,
`FileRead` and `FileWrite` are `Protocol` errors, because they have a stream
and an answer of their own (`placement`); our own mute flags go to the link;
any other op of the control stream is run as the request it is, and its
answer, or its refusal, is told to nobody.
### 3.2 `Session` → `LinkEvent`
Every variant of `voelin_core::link::LinkEvent`.
| `LinkEvent` | Source on the `Session` side | Rule |
|---|---|---|
| `Connected{name, backend, capabilities, own_client, server_uid, own_uid}` | `Welcome`, the SERVER(S) sync, the answer to the first `JoinVoice`, the own `User`. | Sent once, after the connect sequence (4.2). `name` = `Server.name`; `backend` from `Welcome.host.backend` (table 4.7); `capabilities` from `features()` (table 4.7); `own_client` = `P` as `u16`; `server_uid` = `server_key(Server.uid)` (5.3, F3); `own_uid` = `uid_text` of the own `User` (the `User` of our `VoiceState.user_id`, else `Welcome.user_id`), `None` when the replica has none yet. |
| `Presence(Box<Presence>)` | `Change`/`SyncEnd` of SERVER(S) and LIVE(S); talk tracker. | After the pushes that are there now are applied (drain, then one snapshot), if SERVER or LIVE changed: `replica.presence_model(S)` with the fix-ups F1-F10. One TeamSpeak book update is one inner `Presence`, one or two `Change`s, and still one snapshot. |
| `OwnChannel(cid)` | Our `VoiceState.channel_id` in LIVE. | After every `Presence`, when known and not 0 (as `TsLink` does after every snapshot). Our `VoiceState` is the one of the seat, and behind a TeamSpeak server it follows the seat to the participant that is us after the link's own reconnect (4.4); the `OwnChannel` of the inner link only tells `LinkSession` that a move has arrived. |
| `Chat(ChatMessage)` | `Change.put` of a `Message`, and messages of a `SyncBegin`..`SyncEnd`, in a subscribed CHAT scope (4.3). | Once per `(channel_id, id)` per connection, and only once the replica can show it: a full sync stages its messages until its `SyncEnd`, so the messages of a CHAT scope are reported at its `SyncEnd` as well (4.3). `replica.chat_message(channel, id)` gives target, author name, author uid, author participant, `ts_ms`, `via_relay` (`MESSAGE_FLAG_RELAYED`). Answers to our own `Put` are not applied to the replica: our own message is reported when its `Change` arrives, which is today's echo, and `session.rs` merges it with the row it stored (test `a_sent_message_and_its_echo_are_one_message`). |
| `Poke{from, from_uid, from_name, message}` | Push `Signal{from_user, from_participant, body: Poke{message}}`. | `from` = `from_participant` as `u16`; `from_uid` = `uid_text` of `User(from_user)`; `from_name` = the participant's `VoiceState.nick`, else the `User.name`. A sender outside our view is delivered as a bare `User` first (5.2). |
| `Audio(VoicePacket)` | `MediaSink` packets on a voice slot. | Section 6.1. |
| `Talking{client, talking}` | `MediaSink` packets on a voice slot (protocol 6.4: talking in the own channel comes from media), and `Signal{speaking}` (below). | The first packet of a slot → `true`; 400 ms without one → `false` (250 ms tick): the rule of `voice.rs` today. `TsLink` also hears talkers whose packets it does not forward as Opus (Speex, CELT): `LinkSession` passes the inner link's `Talking` on as `Signal{speaking}`, and SessionLink holds such a talker as talking until the host says `on: false` (no silence ends it). Also fills `ClientInfo.talking` (F8). |
| `OwnStream(OwnStreamEvent)` | `StreamPort` events. | Passed through. |
| `StreamAudio{stream, time, data}` | `StreamPort` events. | Passed through. |
| `StreamAudioEnded(stream)` | `StreamPort` events. | Passed through. |
| `Error(text)` | (a) `Rejected` answers to commands that have no `RequestId` (`SendChat`, `Poke`, `SetAvatarHash{request: None}`); (b) push `Signal{notice{level: ERROR or WARNING}}`; (c) `ScopeClosed` of SERVER(S) or LIVE(S). | (a) `"{what}: {Error.message}"`, `what` = `message`, `poke`, `avatar` (today's labels); (b) `Notice.text`; (c) `ScopeClosed.message`, and the presence is emptied. |
| `Disconnected(reason)` | `closed()`; a failed `connect`; a connect sequence that does not finish. | Section 4.5. Sent once; the `StreamPort`'s closing events may follow, as the contract of `link.rs` already allows. |
What the `Session` side produces and no `LinkEvent` carries, with the
decision for each:
| Session output | Decision in this half |
|---|---|
| `Push::SyncBegin`/`SyncEnd`/`Change` of HOME | Applied to the replica: DM channels (CHAT subscriptions, 4.3), the own `User`, bare `User`s of senders. No event of their own. |
| `Push::Heads` | Ignored: no unread source in the engine uses it yet (TeamSpeak sends none). |
| `Push::HostUpdate` | Updates the feature set SessionLink checks requests against. Capabilities are not announced again: `LinkEvent` has no update, and TeamSpeak never sends one. Follow-up (client): `Event::ServerInfo` again on a `HostUpdate`. |
| `Push::ScopeClosed` | CHAT: unsubscribed, nothing reported. SERVER or LIVE: `Error` and an empty presence (row `Error` above). HOME: logged. |
| `Signal{typing}` | Ignored (the engine has no typing indicator; TeamSpeak types only in DMs). |
| `Signal{stream}`, `Signal{layer_target}` | Not sent by `LinkSession` (streams use the port). Ignored with a log. Second half: the engine's stream task (H2). |
| `Signal{encoder_hint}` | Ignored. Follow-up (client): Opus bitrate and `packet_loss_perc` from it (protocol 6.7). |
| `Signal{reminder}` | Ignored (no events feature in the engine). |
| `Signal{notice{level: INFO}}` | Logged at info. |
| `Signal{speaking}` | A hint next to the media: the host says a participant talks or stopped (`LinkSession` sends it for the inner link's `Talking`, which is all there is for a talker without Opus). Not asked for with `SUBSCRIBE_OPTION_SPEAKING`; talking in other channels stays a follow-up (P13). |
| Media on stream slots (sub 0-4), `FlowId::FEEDBACK`, `FlowId::PROBE` | Dropped (no SFU streams in this half). |
| `stats()` (`LinkStats`) | Section 4.7. |
| `Connected.host_uid` | Not pinned for TeamSpeak (`[0; 32]`, no host key). Kept for a later pin store for `voelin://` hosts. |
| `Welcome.resume_token`, `Welcome.ice`, `Welcome.observed_addr`, `Welcome.time_ms` | Kept by SessionLink, unused in this half (4.4). |
| `Welcome.limits` | `max_chat_subscriptions` bounds the CHAT scopes (4.3). `max_message_chars` is not enforced (the UI's own limit stays). |
## 4. How the engine owns a `Session`
### 4.1 The registry
`voelin_core::link::Backends` holds the connectors by scheme:
- `connectors: voelin_proto::link::Connectors` for plain connectors
(`Backends::register(Arc<dyn Connector>)`: `FakeConnector` in tests, the
QUIC connector later);
- in-process connectors that also give local ports: a crate-private trait
`LocalConnector: Connector` with
`connect_local(params, LocalCtx) -> BoxFuture<Result<LocalConnected, SessionError>>`,
where `LocalCtx` is what an in-process backend needs besides
`ConnectParams` (session id, the event bus, the frames bus, the settings,
the stream peer configuration, whether audio is open) and `LocalConnected`
is `Connected` plus `Option<StreamPort>`.
Lookup: the scheme of `ConnectParams.address` (lowercase, before `://`); an
address without a scheme is a TeamSpeak bookmark and gets `ts3server`. A
local connector for the scheme wins over a plain one; none → `Disconnected`
with "no connector for {address}" (the text of `Connectors::connect`, but with the address cut at `?` and `#`: the text is shown and logged, and a TeamSpeak link carries a channel password and a pin).
`Engine::start` and `start_with` use `Backends::default()`, which registers a
`TsConnector` (schemes `ts3server`, `teamspeak`) of its own. The connector owns
the myTeamSpeak account (4.8: since `a451f02` it holds the senders and has the
setters; an application that sets the account registers its connector with
`Backends::register_teamspeak`). New:
`Engine::start_with_backends(settings, history, backends)`.
`Engine::start_with_link(settings, history, link)` stayed in slices 1 and 2: it
registered a local `LinkConnector` that answers every scheme with a
`LinkSession` over the given link, so the link tests went through the whole
adapter. Slice 3 removed it (17): the tests that needed it build the same
registry themselves.
### 4.2 Connect sequence
SessionLink is a `ServerLink`: `session.rs` calls `spawn` exactly as today
and shows `Connecting` until `Connected`.
1. Build `ConnectParams` (section 7 for the credential). In slice 1 the
options still carry TeamSpeak types, so one function of the TeamSpeak
module, `ts_session::connect_params(&ConnectOptions)`, builds them; it
also writes the resolved client version into the link parameter
`client_version` in a text form of its own. Slice 3 moves the building
into SessionLink over the neutral `VoiceOptions`, and `client_version`
carries the user's spec instead. The fields:
`address` = the `ts3server://` link of the bookmark address with
`channel`/`cid` and `channelpassword` (`ServerLink::to_url` of the model's
`link.rs`; a name clash with the trait, nothing more), or the address as
given when it has a scheme; `hello` = `Hello{version:1, client:
ClientInfo{name:"Voelin", version, platform, kind}, nickname, password:
server password, invite_code: privilege key, ..}`; `host_pin: None`;
`trust`: refuses (no TOFU dialog yet; TeamSpeak has no host key);
`media`: SessionLink's sink; `push_capacity: 1024`; `timeout: 35 s` (the
TeamSpeak connect gives up at 30 s with its own text, which should win);
`account: None`, `issuer_trust: Unknown`, `linked: []`.
The link can hold a channel password: neither side logs it (the
connector logs the host and port), and `session.rs` keeps keying history
and aliases by the bookmark address, not by the link.
What the link round trip (`address_link` here, `inner_options` on the
TeamSpeak side) does to an address, since a link cannot say all an address
can: a bookmark `host[:port]` whose port is not a number from 1 to 65535
(`host:99999`, `host:abc`, `[::1]:`) is **refused** in words, where the
link would drop the port and connect to the default one; so is a bookmark
whose host holds a `?`, `#`, `/` or `%`, white space or a control
character (the link ends a host at the first three, decodes the fourth, and
a `?` would hide the channel behind the next one), or is empty or an
unclosed `[`. The TeamSpeak library could not resolve any of them
either. **Normalised**, not refused: blanks around a bookmark are cut;
`[v6]` with no port comes back as `v6` (the library reads both); an empty
server password, channel, channel password or privilege key is none (the
channel password already was); an address that is a `ts3server://` link
keeps the model's rules for links (a `port=` that is no port is ignored,
other keys are ignored), and the options given next to it win over its
parameters. The error shows the address without its query (the connect
fails with `Disconnected(Some(text))` before any connector is asked).
2. `Backends::connect`. `Err(e)` → `Disconnected(Some(text(e)))`, end.
3. `request(List{kind: SERVER})`; the server `S` is the only one listed (or
the lowest id; follow-up P3 for hosts with several). `FakeHost` files no
`Server` stub in HOME (follow-up P9), so HOME is not used to find it.
4. `Subscribe` HOME, SERVER(S) and LIVE(S), each after `replica.subscribe`.
5. Apply pushes until the three `SyncEnd`s. 30 s without them → close,
`Disconnected(Some("timed out while connecting"))`. If the push channel
ends meanwhile the session has ended: `closed()` says why, and that is
the reason of `Disconnected` (a kick during the syncs is shown as one).
6. `request(JoinVoice{server_id:S, channel_id, password})`: `channel_id` from
the bookmark's channel (`/<id>` directly, a path resolved in the synced
tree with `split_channel_path`), else `Server.default_channel_id`. The
answer is our `VoiceState`: `P`, `slot`. TeamSpeak seats a client at
connect, so `LinkSession` answers the first `JoinVoice` of a connection
with the seat it has (participant = our client id, channel as far as it
knows it, 0 before the first snapshot) and moves nothing; the seat was
chosen by the link's `channel` parameter. A refused first `JoinVoice` →
close, `Disconnected(Some(Error.message))`.
7. Report `Connected`, then `Presence`, then `OwnChannel` (the order
`session.rs` and its tests expect).
8. Subscribe CHAT for the server chat, our channel and each DM (4.3).
9. Loop, `select!` biased in this order: the command channel, media,
pushes, the stream port, the session's own notices, `closed()`, the 250 ms
tick (talk tracker, stats). The bias is no order: the events that come from media (`Talking`,
`Audio`) and the ones that come from pushes (`Presence`, `Chat`, `Poke`,
`Error`) travel in two channels, and nothing in the engine, the tests
included, may rely on one coming before the other (section 13). A packet
from a slot the replica does not know yet fetches the queued pushes first
and tries again (`on_media`).
`LinkSession` answers `List{SERVER}`, `Subscribe` and `Unsubscribe` from its
own state, without an inner command; an op it does not implement is
`UNSUPPORTED` with the op's feature in `Error.feature`.
### 4.3 Which CHAT scopes
TeamSpeak delivers the chat of our own channel, the server chat and private
messages; everything else needs a gateway. SessionLink subscribes exactly
that: CHAT(server chat channel), CHAT(our channel) (re-subscribed when we
move, the old one unsubscribed), and CHAT(dm) for each DM channel HOME
holds.
The number of CHAT scopes is `Welcome.limits.max_chat_subscriptions` (0 or
no `Limits`: the v1.0 default, 16). `LinkSession` says 65,536 and enforces
it: it is no limit a connection reaches, because a private message from
somebody new makes a conversation, and a connection on a busy server meets
more than 16 people. Against a host with a small limit the server chat and
our channel come first, then the private conversations, the newest
(highest id) first.
A message that arrives before its
scope is subscribed is not lost: `LinkSession` keeps the messages of the
connection per channel (the 50 newest, the default CHAT window of
protocol 5.4) and sends them in the full sync; SessionLink reports each
`(channel, id)` once. A full sync is staged by the replica until its
`SyncEnd`, so a message of its `Change`s cannot be read when the `Change`
is applied (and `SyncBegin`, `Change` and `SyncEnd` may come in different
batches): SessionLink marks a message as reported only once it has shown it,
and at the `SyncEnd` of a CHAT scope it shows the messages of that channel
it has not shown yet (test
`the_messages_of_a_chat_sync_are_reported_when_the_sync_ends`). A first private message from someone new therefore
arrives as: HOME `Change` (the DM channel), Subscribe CHAT(dm), its sync.
A cursor kept per CHAT scope makes a re-subscription after moving back a
delta where the session offers `sync.delta` (`LinkSession` does, within one
connection).
### 4.4 Reconnect and resume
- **Engine-initiated** (`Command::ConnectVoice` again): unchanged.
`session.rs` gives the old link `StreamCmd::Shutdown`, then `Disconnect`;
both reach the old session through one ordered queue (4.5), and the
generation filter drops what the old one still says.
- **Transport**: TeamSpeak's own reconnect inside `tsclientlib`
(`DisconnectedTemporarily`) stays invisible at the seam, as it is today
(the snapshots go on). The connection comes back as another client: a new
client id, the same unique id and database id. `LinkEvent::Connected` is
not repeated (as today), but the engine does not stay the client of the
connect: *we are the client of our unique id*.
`LinkSession` takes the client it was for as long as that client is in
the snapshots, and when it is gone the client of our unique id (the
newest, when a ghost of the old connection lingers: while the ghost is
there we stay on it, as a second client of one identity may be a second
connection of ours); the own client keeps the database id when two
clients share it, so the user we are is the same through the reconnect;
`Session.send_media` follows the slot. SessionLink (behind a TeamSpeak
host only: a participant is ours for the life of any other session) keeps
its seat while the participant is ours, and moves it to the participant
that carries our user id when the seat is gone or no longer carries it; a
seat whose user id changed by itself (the snapshot that tells our database
id came after the seat) is followed. `OwnChannel`, the voice flags, the
uplink slot and the chat scope of our channel follow the seat (tests
`the_engine_follows_a_reconnect_that_makes_us_another_client`,
`we_stay_the_client_we_were_while_it_is_there`). The native TeamSpeak
session of the second half starts a new epoch instead (H1).
- **Resume**: `LinkSession` does not offer `resume`. SessionLink keeps the
last `Welcome.resume_token` and the CHAT cursors per session and address,
and sends neither in this half: no `voelin://` connector is registered.
Reconnecting with backoff (protocol 2.5) is the SDK's (H8). Until then a
reconnect to a v1 host replays the window of each CHAT scope: the engine
stores every replayed message again, and shows again those that `Dedup` no
longer holds (F3, 16.5).
### 4.5 Close
| How it ended | `closed()` | `LinkEvent::Disconnected` |
|---|---|---|
| `LinkCmd::Disconnect`, or the command channel closed | `Local(Normal)` | `None` |
| The inner link ended unasked without a reason | `Remote{code: Normal, reason: ""}` | `None` |
| The inner link ended with a reason (kicked, server gone, timeout) | `Network(reason)` | `Some(reason)` |
| A v1 host closed with a code | `Remote{code, reason}` | `Some(reason)`, or the code's name when `reason` is empty; `None` for `Normal` with no reason |
| Idle timeout | `TimedOut` | `Some("timed out")` |
`LinkSession` keeps one queue for everything that reaches the inner link:
`Session` calls, `StreamPort` sends and `close`. The order a caller issues
them in is the order the inner link sees (the `Session` contract for
mutations, and what `a_reconnect_shuts_the_streams_down_before_the_old_connection`
checks: `Stream(Shutdown)` before `Disconnect`).
### 4.6 Errors and their texts
`text(SessionError)`: `Rejected(e)` → `e.message`; `Closed(reason)` → the
reason as in 4.5; `Timeout` → "timed out while connecting" during connect,
"timed out" otherwise; `Unsupported(f)` → "not offered by this server: {f}";
`HostIdentity(t)`, `Protocol(t)` → `t`; `Io(e)` → `e.to_string()`.
`LinkSession` puts `TsLink`'s own texts in `Error.message` and
`CloseReason::Network`, so what the user reads does not change.
### 4.7 Where `Features`, `BackendInfo` and `LinkStats` surface
`Welcome.host.backend` → `BackendInfo`:
| v1 `BackendInfo{product, flavor}` | engine `BackendInfo.product` |
|---|---|
| `teamspeak`, `ts3` | `TeamSpeak 3` |
| `teamspeak`, `ts6` | `TeamSpeak 6` |
| `teamspeak`, empty (not recognised) | empty (`version` = what the server said) |
| anything else | `product` as given |
`LinkSession` writes the inverse from the inner `Connected.backend`
(`TeamSpeak 3` → `teamspeak`/`ts3`, ...), so every value round-trips.
`features()` (narrowed by `Server.features`) → `Capabilities`. SessionLink keeps
the host's set (`Session::features()`, replaced by each `HostUpdate`) and the
set of the server (`Features::narrowed(&Server.features)`, recomputed when
the SERVER scope changes or syncs and after a `HostUpdate`); `Capabilities`,
the local refusals (`Features::require`) and the presence fix-ups use the
narrowed one. `LinkSession` files no `Server.features` (an empty list keeps
all of them):
| `Capabilities` | from |
|---|---|
| `streams` | `streams`, and the connection has a `StreamPort` (this half) |
| `file_transfer` | `files` |
| `offline_messages` | `mailbox` |
| `raw_query`, `ssh_query`, `http_query` | no feature: they describe ServerQuery access to a TeamSpeak server, not the session. Derived from the flavor as `ServerFlavor::capabilities` does (`ts3`: raw and SSH; `ts6`: SSH and HTTP). They go with the query observer (H5); follow-up P10. |
`LinkSession`'s features are what it implements: `voice`, `chat`,
`chat.bbcode`, `dm`, `sync.delta`, `roles`, `roles.channel`; with file
transfer `files`, `files.upload`; with offline messages `mailbox`; with
streams `streams`, `streams.p2p`, `streams.audio`, `streams.approval`. Not
`voice.whisper`, `chat.typing` or the moderation set: the inner link cannot
do them (the native session of H1 offers the whole TeamSpeak column of
protocol 9.1). SessionLink refuses locally (`Features::require`) what needs a
missing feature: `List{FILE}`, file reads and writes (`files`,
`files.upload`), `Mail` (`mailbox`).
`LinkStats`: no UI surface in this half (the engine has no event for
connection quality). SessionLink reads `stats()` on the tick: `max_rtp`
bounds outgoing voice packets; `rtt`, `loss`, `media_dropped` and `degraded`
are logged at debug every 10 s and when `degraded` changes. `LinkSession`
reports `max_rtp: MAX_RTP` and zeros. Follow-ups: an engine event for
connection quality, and the encoder's FEC and loss from `LinkStats` and
`encoder_hint` (protocol 6.7).
### 4.8 What `LinkCtx` becomes
| `LinkCtx` field | Where it goes |
|---|---|
| `session` | SessionLink (it reports with it); `LocalCtx.session` for the stream task. |
| `events` | SessionLink reports answers itself; `LocalCtx.events` for the stream task's bus events. Inside `LinkSession`, the inner link gets a bus of its own: `FileList`, `JoinFailed`, `OfflineMessages`, `OfflineMessage` and `RequestDone` from it answer pending requests, every other event (the stream task's) is forwarded to the engine's bus unchanged. Capacity 4096, and every pending request has a timeout, so a lagging receiver cannot hang one forever. |
| `frames` | `LocalCtx.frames`, passed to the inner link as is. |
| `settings` | SessionLink (progress cadence `files.progress_ms`); `LocalCtx.settings` for the stream task. |
| `myts_identity`, `myts_data` | `TsConnector` (it got the engine's watches in slices 1 and 2; since slice 3 it owns the senders and has the setters, 17); the account hook of section 7 replaces them later (H4). |
## 5. Presence across the seam
### 5.1 The rule
`project(translate(p)) == p` for every presence a TeamSpeak link reports:
`translate` is `LinkSession`'s old model → v1 entities, `project` is
SessionLink's replica → old model. A unit test checks it on the book
fixtures of `book.rs` (TeamSpeak 3 and 6) and on a generated set of
TeamSpeak-shaped presences; the FakeLink tests check it end to end.
### 5.2 Ids and entities on the TeamSpeak side
Protocol 11.1 "Ids", made concrete for `LinkSession`:
| v1 | from the old model |
|---|---|
| server id | 1 (one virtual server per connection) |
| `Server` (SERVER(1)) | `ServerDetails` and `server_name`; `uid` = `ts:` + the server uid `TsLink` computes; `host_message_mode`, banner, host button, icon (`Image{hash: id}`), `max_members`, `priority_dim_db`, `default_role_id` = sgid, `default_channel_role_id` = cgid with bit 62; `foreign{system:"teamspeak", kind:"server", json:{"platform", "version"}}`, the strings the server sent (F4, F5) |
| channel id | cid; `kind: VOICE`; `position` from the order chain (1024 per step); `needed{TALK}`; `icon`; banner; `max_members` (with `foreign{"max_clients":0}` for a limit of 0, F7) |
| server chat | `Channel{id: 1 << 63, kind: SERVER_CHAT}` in SERVER(1) |
| DM channel | `Channel{id, server_id: 0, kind: DM, recipients: [own user, peer user]}` in HOME, made when a message to or from the peer needs it; `id` has bit 63 set and the FNV-1a 64 hash of the peer's uid in the low 63 bits (1 when they come out 0, so it never equals the server chat's id) |
| role id | sgid (`RoleScope::SERVER`); cgid with bit 62 (`RoleScope::CHANNEL`); `position` = −`sort_id`; `name_mode`; `kind`; `icon` |
| user id | `database_id`; a sender with none, or outside our view, gets bit 63 set and the FNV-1a 64 hash of its uid in the low 63 bits |
| `User` | `uid` = base64-decoded unique id, `uid_kind` `TS3` (`TS6` on a TeamSpeak 6 server); a uid that is not canonical base64 (a ServerQuery client's login name) leaves `uid` empty and goes into `foreign{system:"teamspeak", kind:"user", json:{"uid"}}` (F10); `name`; `avatar: Image{hash: avatar MD5, url: myTeamSpeak avatar}`; `badges`; `country` |
| `Member` | `roles` = server groups; `channel_roles` = {channel: channel group with bit 62}; `description`; `foreign{system:"teamspeak", kind:"client", json:{"icon"}}` (F6) |
| `Presence` | `status: IDLE` with `text` = away message when away, else `ONLINE` |
| participant id | client id; `VoiceState{nick, channel_id, slot: client id + 1, self_mute, self_deaf, talker, talk_power, priority_speaker, channel_commander, recording, streaming, kind: QUERY for query clients}` |
| message id | per connection: milliseconds since the Unix epoch shifted left by 12 bits, plus a counter in the low 12 bits |
| rev, epoch | one counter per `LinkSession` from 1; the epoch is new per connection |
| `Mail` id | the TeamSpeak offline message id |
Each inner `Presence` is diffed against the previous one: changed entities
are put, gone ones deleted, one `Change` per scope. A poke or chat message
from someone the snapshot does not hold is preceded by a `Change` that puts a
bare `User` (synthetic id, uid, name) into LIVE: it shows in no presence (no
`VoiceState`) and lets the engine name the sender (follow-up P5). A sender
the link names by its client id only (no unique id) gets the same: a `User` of
the synthetic id of `client:<id>` with the name the link gave and no uid,
replaced when the same client id comes back with another name (the link hands
a client id to whoever connects next).
### 5.3 The engine's projection: `presence_model` and its fix-ups
`replica::convert` targets the old model already. Where it says less than
`TsLink` does, SessionLink fixes the result up in one module
(`link/project.rs`), each fix with a follow-up for the protocol repository
(P6, P7). The old model is TeamSpeak-shaped, and these fix-ups apply the
TeamSpeak gateway's id rules of protocol 11.1 so the UI keeps the ids it
has; they go when the UI reads the replica (H7).
| | Fix-up | Why |
|---|---|---|
| F1 | Leave out channels of kind `SERVER_CHAT`, `DM`, `GROUP_DM`, `THREAD`. | `presence_model` leaves out threads only; the server chat would show as a channel. |
| F2 | On a TeamSpeak backend (`backend.product == "teamspeak"`), clear bit 62 of `RoleScope::CHANNEL` role ids (channel groups, `ClientInfo.channel_group`, `ServerDetails.default_channel_group`). | Today's ids are TeamSpeak's cgids; requests to the gateway and the UI's group lookups use them. |
| F3 | `server_key(uid)`: `Server.uid` without a leading `ts:`; used for `server_uid` and `ServerDetails.uid`. | History rows, aliases and the merge with the gateway and query sources are keyed by today's form. Goes with H5 (and a history key migration). |
| F4 | `ServerDetails.version` from `Server.foreign` (`teamspeak`/`server`, key `version`), else `Welcome.host.backend.version`. | `server_details` leaves it empty by design, and `BackendInfo.version` is the parsed version, not always the string the server sent. |
| F5 | `ServerDetails.platform` from `Server.foreign` (`teamspeak`/`server`, key `platform`). | v1 has no field for the server's OS. |
| F6 | `ClientInfo.icon` from `Member.foreign` (`teamspeak`/`client`, key `icon`). | v1 has no client icon; `client_info` sets 0. |
| F7 | `ChannelInfo.max_clients = Some(0)` from `Channel.foreign` key `max_clients`. | `max_members: 0` means unlimited; a TeamSpeak limit of 0 cannot be said. |
| F8 | `ClientInfo.talking` = `Some(talk tracker)` where the session offers `voice`, else `None`. | Talking comes from media (protocol 6.4); `client_info` sets `None`. |
| F9 | `ClientInfo.streaming = None` where the session lacks `streams`. | `client_info` always gives `Some`; TeamSpeak 3 reports none. |
| F10 | `ClientInfo.uid`, a message author's and a poke sender's uid from `User.foreign` (`teamspeak`/`user`, key `uid`) when `User.uid` is empty. | ServerQuery clients' uids are login names, which `User.uid` (bytes, base64 for TeamSpeak) cannot hold. |
### 5.4 Normalised fixtures
A TeamSpeak link never reports some states the FakeLink fixtures use; through
the adapter they come back normalised, so slice 1 changes the fixture
builders, never the assertions (except one, below):
- sibling channels form an order chain (`GAMES.order = LOBBY`, not both 0);
- every client has a `database_id`, `talking: Some(false)` and the
`channel_group` it would have (`None` stays `None`);
- `presence().server` names the server and its uid as `TsLink` fills them;
- `Talking` is played as a voice packet of the talker (`LinkEvent::Audio`),
because the engine derives it from media; the test still expects
`Event::Talking{client: 8, talking: true}`;
- `commands_reach_the_link` no longer expects the engine's request id (5)
in the inner `ListFiles`: the id the inner link sees is `LinkSession`'s
(v1 request ids belong to the session). This is the one changed
assertion.
- `presence_follows_the_link_until_it_disconnects` is the second changed test
(after the request id, above): it plays the voice packet and waits for
`Talking` before it plays the `Poke` and the `Error`, where the baseline
played `Talking`, `Poke` and `Error` in one go and waited for them in that
order. Its assertions are the baseline's; the steps are reordered because
the media path and the push path have no order between them (section 13),
and the first version of the test relied on one (it failed in 22 of 300 isolated runs on the first implementation; the fixed test, 0 of 300).
## 6. Media across the seam
### 6.1 Voice, engine side
`voelin-audio`'s `EncodedVoice`/`VoicePacket` stay what the audio thread
speaks; SessionLink frames them in the v1 media codec (`voelin_proto::media`).
Sending (`LinkCmd::Audio`): flow `FlowId::new(slot, voice_sub::CHANNEL)`
(the engine has no whisper or priority voice yet), `RtpHeader::new(PT_OPUS,
seq, timestamp)`, SSRC = flow; `seq` counts every packet from 0;
`timestamp` advances by the previous packet's Opus duration
(`media::opus::packet_ticks`, 960 for 20 ms); marker on the first packet of a
spurt; `EncodedVoice::is_end()` becomes an RTP packet with an empty payload,
sent once (protocol 6.4 sends it twice; the TeamSpeak side would turn that
into two TeamSpeak end packets, so twice waits for H1). `MediaClass::Voice`.
Receiving (`MediaSink::media`, never blocking: into the loop's queue): a
voice flow is `slot` → our replica's `VoiceState` with that slot →
`TalkerId(participant as u16)`; `sub` 1-6 → `whisper: true`; `seq` = RTP
sequence; `payload` = RTP payload (empty ends the spurt; `VoicePacket::is_end`
also takes one byte); `codec` = `Music` when the Opus TOC has the stereo flag,
else `Voice`. The codec is informational on this path: the jitter buffer
decodes every talker with one stereo decoder (`jitter.rs`), so a frame coded
mono inside a music stream decodes the same. Unknown slots are dropped
(logged once). The talk tracker sees every voice packet.
### 6.2 Voice, TeamSpeak side
`LinkSession` re-wraps, never transcodes (protocol 1.2): an inner
`VoicePacket` becomes RTP on the talker's slot (client id + 1), sub 1 for
whispers else 0, `seq` = TeamSpeak packet id, timestamp from the TOC
durations on an unwrapped packet-id counter and wall-clock time across
silences, marker after an end or 250 ms of silence, empty payload for the
end. Sub 7 (priority voice) is not used: the mixer dims by the presence's
`priority_speaker` flag, as today. Uplink: RTP on our slot loses its header
and becomes `EncodedVoice{codec: Music if the TOC is stereo else Voice,
payload}`; the engine encodes `VoiceCodec::Voice` only (`audio.rs`), so
TeamSpeak keeps receiving Opus Voice. Packets of another slot are
`NotOwned`, over `MAX_RTP` `TooLarge`.
### 6.3 Media classes
| Class | Used in this half |
|---|---|
| `Voice` | our voice |
| `StreamAudio`, `Video`, `Feedback`, `Probe` | not used: TeamSpeak 6 streams are peer to peer, so no stream media crosses a `Session` (protocol 6.11, 11.1); the SFU path comes with VoelinServer |
### 6.4 Streams: the port now, v1 later
`StreamPort` is `{ cmds: UnboundedSender<StreamCmd>, events:
UnboundedReceiver<StreamEvent> }`, `StreamEvent` = `OwnStream`, `StreamAudio`,
`StreamAudioEnded`; the stream task's bus events go to the engine's bus,
its frames to the frames bus (both through `LocalCtx`). The watched streams'
video (`StreamFrame`) and audio never cross the `Session` trait in this half.
The v1 mapping the second half implements (H2), per `StreamCmd` variant:
| `StreamCmd` | v1 (peer to peer, what TeamSpeak 6 needs) | SFU (VoelinServer, later) |
|---|---|---|
| `Start{setup, auto_accept}` | `Put Stream{kind, title, mode: P2P, access: OPEN if auto_accept else ASK, viewer_limit, audio, bitrate_kbps}`; `accessibility` and `mode` 1 in `Stream.foreign` | `mode: SFU`, `layers` |
| `Stop` | `Delete Stream{id}` | same |
| `Respond{viewer, accept}` | `RespondViewer{stream_id, participant_id, accept, offer}` (offer from the engine's peer) | without offer |
| `Kick{viewer}` | `KickViewer{stream_id, participant_id, reason: KICKED}` | same |
| `Watch{stream_id}` | `Put Viewer{stream_id, participant_id: P, audio, decodes}` | same |
| `Leave{stream_id}` | `Delete Viewer` (own) | same |
| `RequestKeyframe{stream_id}` | inside the WebRTC peer (PLI) | RTCP PLI on `FlowId::FEEDBACK` (`MediaClass::Feedback`) |
| `Undecodable{stream_id}` | renegotiate without the codec (`Signal{stream: offer}`) | `Put Viewer{decodes}` |
| `WatchLayer{stream_id, layer}` | `Signal{stream: layer}` (`x-voelin-layer`) | `Put Viewer{max_layer}` |
| `Layers(specs)` | `Put Stream{layers}` and the local encoders | same |
| `LayerFormat{layer, format}` | local (encoder to peer) | local |
| `SrtpProfiles(names)` | local (peer configuration) | n/a |
| `Frame(frame)`, `VideoFrame(frame, format)` | local (the peer sends them) | `send_media(Video, RTP on the stream slot, sub = layer)` |
| `Friends(clients)` | local (`stream.permissions` decides who is admitted) | `access: FRIENDS` on the host |
| `Directory(streams)` | the gateway daemon's session (protocol 11.2) | n/a |
| `Shutdown(reason)` | local (peer teardown), then `close` | same |
And back: `OwnStream` ← our `Stream` in LIVE (put, viewer count, delete);
`StreamAudio` ← the peer (SFU: stream slot sub 4, `MediaClass::StreamAudio`);
`StreamAudioEnded` ← the stream or our `Viewer` deleted; the bus events
`StreamsChanged`, `StreamViewers`, `StreamViewerRequest` (a `Viewer` in state
`PENDING`), `WatchState` ← `Stream` and `Viewer` entities; `StreamLayerBitrate`
← the peer's estimate (SFU: `Signal{layer_target}`).
## 7. Identity and credentials
- **TeamSpeak identities** go as `Credential::Foreign{kind: "teamspeak",
blob}`, `blob` = the JSON of the `KIND_TEAMSPEAK` `IdentityBlob` of the
KeyStore (`voelin-store` keeps tsproto's `Identity` JSON verbatim).
`TsConnector` parses it back into the `tsclientlib::Identity` it connects
with. No identity in the options (`voelinctl` without `--identity`) is an
empty blob, and the connector generates one as `tsclientlib` does today
(follow-up P11 writes the convention down).
- **The Voelin key** goes as `Credential::Voelin(Arc<dyn Signer>)`: a
`KIND_VOELIN` blob's `voelin_key()` (`IdentityKey` implements `Signer`), or
a `FileSigner`. Nothing uses it in this half (no `voelin://` connector), but
the conversion is there and tested.
- **The account** is a hook: `ConnectParams.account` is `None` and
`issuer_trust` `Unknown`. `Backends` gets an
`Option<Arc<dyn AccountAgent>>` slot, set by nobody yet. A blob whose
binding has custody SERVICE (no local secret) would be
`Credential::Account{kind: "teamspeak", integration_id}`; without an agent
the connector fails the connect (its contract in `ConnectParams`), and the
engine reports that as `Disconnected`. No such blob reaches the engine
yet. myTeamSpeak keeps going through `TsConnector`'s
watches (4.8) until it moves to `AccountAgent::use_integration`
(`myteamspeak.handshake`, protocol 13.8; H4).
- **Host trust**: `TsConnector` ignores `trust` and `host_pin` (no TLS). The
engine passes a `HostTrust` that refuses until the UI has a TOFU dialog.
- **Slice 1 keeps the API**: `VoiceOptions.identity` is still a
`tsclientlib::Identity`; one function in the TeamSpeak module turns it into
the `Credential`. Slice 3 makes it an `IdentityBlob` (section 10).
## 8. Files
The engine owns transfers end to end: progress (`files.progress_ms`), the
`.part` file and its rename, cancel, resume, the picture limits. The
TeamSpeak side only opens the transfer connection, through two inner
commands added to `LinkCmd` in slice 1:
- `OpenRead{file: Remote, offset, reply: oneshot<Result<(u64, BoxRead), String>>}`:
`download_file`, then the `FileDownload` stream and its size go to `reply`
instead of into `files::download`; `FiletransferFailed` → `Err` with the
text `transfer_error` writes today.
- `OpenWrite{file, size, overwrite, resume, reply: oneshot<Result<(u64, BoxWrite), String>>}`:
`upload_file`, then the `FileUpload` stream and its `seek_position`.
`files::download` and `files::upload` take `AsyncRead`/`AsyncWrite` instead
of `TcpStream` (their tests keep using TCP). The old `Download`, `Upload` and
`CancelTransfer` handling in `voice.rs` is dead for `LinkSession` from
slice 1 (it never sends them inward) and is deleted in slice 3. Avatars and
icons keep their channel-0 paths (`/avatar_<uid>`, `/icon_<id>`) as
`FilePath` reads; v1 has them as attachments (H6).
## 9. Tests
### 9.1 `tests/link_fake.rs` through the adapter (slice 1)
`Engine::start_with_link(FakeLink)` now wraps the link in `LinkSession` and
drives it through SessionLink, so all seven tests run both translations:
| Test | What it proves through the adapter |
|---|---|
| `presence_follows_the_link_until_it_disconnects` | connect sequence and event order, presence round trip, poke, talking from media, notice → `Error`, `Disconnected(Some)` |
| `commands_reach_the_link` | `SendChat`, `Move`, `SetInputMuted`, `Poke`, `ListFiles` survive both translations; no streams without the capability; stream commands through `StreamPort`; replaced link gets `Disconnect` |
| `a_reconnect_shuts_the_streams_down_before_the_old_connection` | `StreamPort` and `close` share one ordered queue |
| `a_sent_message_and_its_echo_are_one_message` | our message's `Change` is today's echo |
| `a_message_that_comes_twice_is_shown_once` | four `Change`s, `RELAYED` flag, dedup in `session.rs` |
| `history_is_kept_across_the_connection` | DM channel in HOME, late CHAT subscription, `Private(uid)` target |
| `a_replaced_connection_is_ignored` | generation filter with a link that keeps talking after `Disconnect` |
### 9.2 FakeSession and FakeHost (slice 2)
New `tests/session_fake.rs`: `Engine::start_with_backends` with a
`FakeConnector` (scheme `fake`) registered, `VoiceOptions::new("fake://host",
...)`, the `FakeHost` filled with `Server`, VOICE `Channel`s, `Role`s,
`User`s, `Member`s and `VoiceState`s through `FakeHost::put` (it stores what
a client cannot set, such as authors), `FakeHandle` for pushes, media,
scripts, held requests and kills. `voelin-proto` with `test-util` is a
dev-dependency of `voelin-core`.
| link_fake test | FakeSession version |
|---|---|
| `presence_follows_the_link_until_it_disconnects` | host state + `JoinVoice` (the fake assigns `P` and `slot`); `Welcome.host.backend` set with `FakeHost::set_welcome`; poke as `FakeHandle::push(Signal{poke})`; talking by `inject_media` on alice's slot; `Signal{notice}` → `Error`; `kill(Network("server shut down"))` → `"voice: server shut down"`. |
| `commands_reach_the_link` | `FakeHandle::requests()` shows `Put{Message}`, `JoinVoice{password}`, the `notify` (id 0) of `self_mute`, `Signal{poke}` (the fake answers signals `Ack`), and `List{FILE}` (the fake refuses `List.path`: scripted with `Script::answer("list", ...)`). The stream half stays a link test (below). |
| `a_reconnect_shuts_the_streams_down_before_the_old_connection` | stays a link test: it checks the `StreamPort` ordering, which a `FakeSession` has no part in (until H2). |
| `a_sent_message_and_its_echo_are_one_message` | the fake stores our `Put` and pushes its `Change` to CHAT(our channel). |
| `a_message_that_comes_twice_is_shown_once` | four `FakeHost::put(Message)`, one with `MESSAGE_FLAG_RELAYED`. |
| `history_is_kept_across_the_connection` | a DM `Channel{server_id: 0}` (HOME) and its messages; `close` and reopen. |
| `a_replaced_connection_is_ignored` | stays a link test: a closed `FakeSession` stops pushing, so the stale events cannot be produced on purpose. |
New tests the v1 path needs: a connect that fails (`FakeConnector::fail_next`)
→ `Disconnected(Some(text))`; CHAT re-subscription after moving back is a
delta (`sync.delta`); `ScopeClosed` of CHAT and of LIVE; `Rejected` answers
→ `RequestDone`/`Error` texts; our voice in `FakeHandle::sent_media()` (PT
111, SSRC = flow, marker, empty end, sequence); download and upload against
the fake's channel files, resume offset from a scripted `List`; offline
messages through scripted `Mail` answers (the fake does not store `Mail`);
`HostUpdate` changing the refused features; the conformance suite run
against a `FakeSession` reached through `Backends` (17 cases, a check that
the registry hands the session over untouched).
The link tests that stay (`a_reconnect_shuts_the_streams_down...`, the stream
half of `commands_reach_the_link`, `a_replaced_connection_is_ignored`) remain
in `tests/link_fake.rs` in slice 2 and move into the crate in slice 3, when
`ServerLink` is no longer public.
This table and the list above it are the design; section 16.4 lists where the
running code differs (the CHAT re-subscription is a full sync, not a delta; a
reconnect resumes nothing; the conformance run and the live TeamSpeak tests are
in-crate tests, not files of `tests/`).
### 9.3 The conformance suite against the TeamSpeak `Session`
`conformance::run_case` with a harness that opens a `LinkSession<TsLink>`
through `TsConnector` on the dev servers (`VOELIN_LIVE=1`, TeamSpeak 3 and 6
of `dev/docker-compose.yml`). The suite's `Fixture` needs a `FakeHandle` of
the backend; the TeamSpeak server has none, so the harness passes the handle
of an unrelated `FakeHost` and runs only the cases that never touch it:
| Case | Expected | Why |
|---|---|---|
| `welcome_matches_features` | passes | session only |
| `close_ends_the_session` | passes | session only |
| `a_stale_rev_conflicts_and_a_patch_writes_only_its_paths` | skipped | no `chat.edit` |
| `requests_apply_in_the_order_they_were_issued` | skipped | no `chat.edit` |
| `list_pages_history` | skipped | no `chat.history` (the embedded gateway keeps no history) |
| `idempotency_keys_apply_a_put_once` | skipped | no `idempotency` |
| `subscribe_syncs_the_scope` | cannot pass | writes to channel 4001, which the server lacks; TeamSpeak channel chat reaches only the own channel |
| `subscribe_resumes_from_a_cursor` | cannot pass | same (4002) |
| `put_answers_entities_and_pushes_the_change_with_the_same_rev` | cannot pass | same (4003) |
| `delete_answers_an_ack_and_pushes_the_removal` | cannot pass | TeamSpeak cannot delete a message; the case needs only `chat` instead of `chat.delete`, so it fails instead of skipping (P8) |
| `a_key_names_an_entity_without_its_server` | cannot pass | needs nothing, but creates `ScheduledEvent` and `Emoji`, which TeamSpeak lacks (P8) |
| `cancel_before_apply_is_cancelled` | cannot run | holds the backend (`FakeHandle::hold`) |
| `notifications_are_fire_and_forget` | cannot run | reads the backend's request log; typing goes to channel 1 |
| `renew_account_follows_the_feature` | cannot run | changes the backend's features by `FakeHandle::push` |
| `media_loops_back` | cannot pass | a TeamSpeak server does not return a client's own voice |
| `files_round_trip` | cannot pass | writes an `AttachmentSlot`; TeamSpeak has channel files, no message attachments; the case needs `files` instead of `chat.attachments` (P8) |
| `the_backend_can_end_the_session` | cannot run | `FakeHandle::kill`; and `LinkSession` reports a kick as `Network(text)`, not `Remote{KICKED}`, until H1 |
What the suite cannot reach is covered by TeamSpeak session tests of their
own (live, both servers): an own-channel `Put Message` answered, then
pushed to the other session's CHAT scope and back to ours as a `Change` (ids
agree only with H1's native session); `JoinVoice` refusal codes
(`PASSWORD`, `FULL`); a poke `Signal` between two sessions; voice RTP from
one session's slot reaching the other's `MediaSink` (sequence, marker, end);
a channel file written with `write_file` and read back from an offset with
`read_file`.
The table above is the prediction. Section 16.2 has the verdicts the run
gave, on both servers, and what the run found on the way: the first version
of the harness ended its sessions by itself (16.5, F2), which made
`close_ends_the_session` pass for the wrong reason, and the reasons of the
cases that do not apply are what those cases did when they were run.
## 10. Slices
Every slice: `cargo fmt --all --check`; `cargo clippy $(scripts/own-crates.sh)
--all-targets --no-deps --locked -- -D warnings`; `cargo test -p voelin-core
--locked` (also `--features media`), the tests of every crate the slice
touches; `cargo check --workspace --locked`; `cargo deny --locked check`;
`scripts/notices.sh` with `THIRD_PARTY_NOTICES.md` regenerated whenever
`Cargo.lock` changes; docs on new public items; the live tests and
`scripts/it-smoke.sh` engine scenarios against the TeamSpeak dev servers
(this repository's `dev/docker-compose.yml`, the same as VoelinGateWay's)
with the results compared to the baseline. One commit per step is fine; no
history rewrite.
### Slice 0 (precondition): baseline
On `main` (`59fec5b`), before any code: `VOELIN_LIVE=1 cargo test -p
voelin-core --features media-desktop --test live --test voice_features
--test stream_live --test media_live`, and `scripts/it-smoke.sh ts3 ts6`.
Record which pass, which fail and why: the plan notes they have not run
since Phase 4 step 1, and slice 1's "no behaviour change" is measured
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 (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`,
`-gateway`, `-gateway-proto`, `-observer`, `-android`, `voelinctl`: a
one-line manifest change each, the UI's being a compile fix); the
`[patch]` recipe of `docs/building.md` gains `voelin-model`.
Acceptance: whole workspace builds, all tests green, no source change
besides manifests. Of the model crate's files only `lib.rs` (two more
modules, `perms` and `replica`) and `badges.rs`, `link.rs`, `tree.rs`
(a doc comment and two equivalent expressions) differ.
2. **The seam.** `link/` (Backends, SessionLink, project, media),
`ts_session.rs` (LinkSession, TsConnector, `LinkConnector` for
`start_with_link`), `OpenRead`/`OpenWrite` in `voice.rs`, `files.rs`
generic, `Engine::start_with_backends`.
Acceptance:
- `git diff main -- crates/voelin-core/src/session.rs` is empty;
- the seven tests of `tests/link_fake.rs` pass through the adapter with
only the fixture changes of 5.4;
- unit tests: the presence round trip of 5.1 (book fixtures and generated
presences), `LinkCmd` → v1 → inner `LinkCmd` for every row of
table 3.1 with a recording link, v1 media framing both ways (sequence,
marker, end, whisper, TOC codec), talk tracker timing (400 ms), the close
table of 4.5, the error texts of 4.6, the backend and capability tables
of 4.7;
- live tests and smoke scenarios: no result worse than the baseline
(section 0), in particular `engine_voice_check` (files, avatar, poke,
private and offline messages, friend online, blocked poke), voice
round trip, the TeamSpeak 6 stream scenarios;
- `rg -n 'tsclientlib|tsproto|voelin_query'` over the new
Session-facing modules (`link/backends.rs`, `link/session_link.rs`,
`link/project.rs`, `link/media.rs`) is empty; TeamSpeak types appear
only in `ts_session.rs` and the files that had them before
(`link/mod.rs` keeps `ConnectOptions` and `LinkCtx` until slice 3).
No public item is removed in this slice.
### Slice 2: tests on FakeSession and FakeHost
Implemented; section 16 says how, what it found, and what ran.
- `tests/session_fake.rs` as in 9.2, the conformance run through `Backends`
(17 of 17), the live TeamSpeak conformance subset of 9.3 with the expected
verdicts asserted per case (2 pass, 4 skipped, the rest not run, each with
the reason of the table in a comment), and the TeamSpeak session tests of
9.3.
- `tests/link_fake.rs` keeps only the three link tests named in 9.2.
- Acceptance: all of it green on both dev servers; a deliberately broken
translation (for instance a dropped `self_mute` path) makes a
`session_fake` test fail, shown once in the report.
### Slice 3: the `ServerLink` layer where it is redundant; TeamSpeak types out of the API
Implemented; section 17 says how, what differs from this list, and what ran.
- `ServerLink`, `TsLink`, `Engine::start_with_link`, `LinkCtx`, `LinkCmd`,
`LinkEvent` and `Remote` are no longer public (the engine keeps `LinkCmd`
and `LinkEvent` as `session.rs`'s private vocabulary; the TeamSpeak module
keeps the inner trait). The remaining link tests become unit tests in the
crate.
- `src/ts/` holds the TeamSpeak implementation: `ts_link.rs`, `voice.rs`,
`book.rs`, `ts_session.rs`, `versions.rs`, `identity.rs` (moved with
history). Public as `voelin_core::ts`: `TsConnector` (with
`set_myts_identity` and `set_myts_data`), `versions`, `identity`. This
module is what moves to VoelinGateWay.
- `VoiceOptions` (no longer an alias of `ConnectOptions`): `identity:
Option<IdentityBlob>`, `client_version: Option<String>` (a spec for
`ts::versions::resolve`, passed to `TsConnector` as the link parameter
`client_version`; `Link::parse` ignores unknown keys), `stream_peer:
PeerConfig`, the rest unchanged.
- `Command::SetMytsIdentity` and `SetMytsData` removed (nothing sends them;
`TsConnector`'s setters replace them). `ObserveGateway.identity` becomes a
`Box<IdentityBlob>` (`gateway.rs` parses it); `ObserveQuery.connect`
becomes a core-owned `QueryLogin` (transport, address, user, secret,
server port, server id) that `query.rs` turns into `voelin_query::Connect`.
The public `gateway::connect(url, identity)` takes the blob too (nothing
outside the crate calls it today).
- `voice.rs` loses `Download`, `Upload`, `CancelTransfer`; the picture limits
live in SessionLink only.
- `docs/architecture.md`: "The server link" becomes "The session seam"
(registry, SessionLink, the TeamSpeak module, `StreamPort`, the fix-ups of
5.3, what is still TeamSpeak-shaped: `u16` client ids and the old model);
the crate table row of `voelin-core` follows; this document's status line.
- `CHANGELOG.md`: it lists user-visible changes only. An entry under
"Changed" only if a difference against the baseline remains visible (none
is intended); the reviewer confirms none was needed.
- UI and `voelinctl`: compile fixes only (identity blob instead of
`tsclientlib::Identity`, the spec string for `client_version`,
`voelin_core::ts::{versions, identity}` paths, `QueryLogin`).
- Acceptance:
- `rg -n 'tsclientlib|tsproto|voelin_query' crates/voelin-core/src --glob
'!**/ts/**' --glob '!gateway.rs' --glob '!query.rs' --glob '!stream.rs'`
from the repository root (from `crates/voelin-core/src` the first glob is
`'!ts/**'`: a glob is relative to the directory `rg` runs in) is
empty, and the four exceptions use them privately: `gateway.rs` and
`query.rs` are the two observer sources (H5), `stream.rs` is the
TeamSpeak 6 stream task behind `StreamPort` (H2, H3);
- `session.rs` names no TeamSpeak crate;
- no public item outside `voelin_core::ts` names a type of
`tsclientlib`, `tsproto*` or `voelin-query` (checked with `cargo doc`
and a grep of `pub` items); `voelin_core::stream` still re-exports the
WebRTC peer types of `voelin-stream` (`PeerConfig`, `MediaFrame`,
`MediaKind`, `MediaTime`, `Frequency`, `VideoFormat`, `VideoCodec`,
`Codec`, `FrameSource`, `SyntheticSource`): they belong to the peer,
which protocol 6.11 and 11.1 keep in the client, and land in a crate of
their own when `voelin-stream` is split (H3);
- `cargo tree -p voelin-core -e normal | grep -E 'tsclientlib|tsproto'`
may still list them (the TeamSpeak module is still in the crate);
- all of slice 1's and slice 2's checks, live tests and smoke included.
## 11. Follow-ups
### 11.1 For the protocol repository (seam, schema, model, suite)
Nothing here blocks this half: each has a workaround above.
| # | What | Workaround meanwhile |
|---|---|---|
| P1 | `Hello` has no initial voice channel (path or id, password) for backends that seat a client at connect; a Voelin host could also take it to save the `JoinVoice` round trip. | `ts3server://` link parameters `channel`/`cid`, `channelpassword` (4.2). |
| P2 | Write down that the first `JoinVoice` of a session that its backend seated at connect answers the seat without moving (11.1). | `LinkSession` does it. |
| P3 | A host with several servers: the address (or `Welcome`) should name the one to use. | `List{SERVER}`, the only or lowest one. |
| P4 | `write_file` should answer the offset the backend appends at (`Upload.offset`), so a resume needs no `List`. | `List{FILE}` before a resumed upload; `CONFLICT` on a mismatch. |
| P5 | No sender name or uid for a `Signal` (poke) or message author outside the receiver's view (hidden ServerQuery clients). | A bare `User` with a synthetic id before the signal (5.2). |
| P6 | Schema gaps of TeamSpeak presence: a client icon, a channel limit of 0, the server's platform and version string as sent, a uid that is no byte string (ServerQuery login names). | `Foreign` keys `icon`, `max_clients`, `platform`, `version`, `uid` (F4-F7, F10). |
| P7 | `replica::convert`: SERVER_CHAT and DM channels in `presence_model`; the per-server TeamSpeak avatar read from `User.avatar` instead of `Member.avatar`; `streaming: Some(false)` without the feature; empty `version`; channel role ids not given back; client icon 0; `talking` always `None`. | Fix-ups F1-F10. |
| P8 | Conformance suite: a backend driver trait (hold, release, kill, push, request log) instead of `FakeHandle`, so backend-driven cases run on any backend; chat channel and server chosen by the harness instead of 4001-4020; `needs` fixed (`chat.delete` for the delete case; events and emoji for `a_key_names_...`; `chat.attachments` or a `FilePath` variant for `files_round_trip`); a two-session `media_loops_back` for backends that do not loop back. | The subset of 9.3 and TeamSpeak tests of our own. |
| P9 | `FakeHost` files no `Server` stub or own `Member` in HOME (protocol 5.2). | `List{SERVER}` (4.2). |
| P10 | ServerQuery capabilities (raw, SSH, HTTP) have no feature string. | From the flavor (4.7); they leave with the observer (H5). |
| P11 | Protocol 11.1 could name `Hello.invite_code` ↔ `client_default_token` (privilege keys), and section 13.8 the empty `Credential::Foreign` blob as "generate an identity". | Done that way here. |
### 11.2 The second half (TeamSpeak `Session` to VoelinGateWay)
| # | What |
|---|---|
| H1 | A native TeamSpeak `Session` replaces `LinkSession<TsLink>`: `voice.rs` speaks v1 (book → entities without the old model, notifications → `Change`s), real answers for chat and pokes (read-your-writes, errors on the request), a kick as `Remote{KICKED}`, `tsclientlib`'s own reconnect as a new epoch and a full resync, ping and loss in `LinkStats`, whispers (sub 1-6), priority voice (sub 7), typing, the end of a spurt sent twice collapsed to one TeamSpeak packet, every TeamSpeak feature of protocol 9.1. |
| H2 | Streams on v1: the stream task's WebRTC peer moves to the engine and speaks `Stream`/`Viewer`/`RespondViewer`/`KickViewer`/`Signal{stream}` (table 6.4); the TeamSpeak session translates TeamSpeak 6's stream commands (`setupstream`, `joinstreamrequest`, `respondjoinstreamrequest`, `removeclientfromstream`, `streamsignaling`, the notifications); `StreamPort` and `LocalConnector`'s stream part go. |
| H3 | `voelin-stream` split rather than inverted: the TeamSpeak 6 signalling (commands, notifications, signal JSON) goes to VoelinGateWay with the TeamSpeak session; the str0m peer with `PeerConfig`, `MediaFrame`, `VideoFormat`, codecs and simulcast stays client side (with `voelin-media`, or a crate of its own), because protocol 6.11 and 11.1 put the peer in the client. Then nothing in VoelinGateWay depends on `voelin-media`, and the cycle the plan worries about cannot form. |
| H4 | myTeamSpeak through `AccountAgent` (`myteamspeak.handshake` with the 32-byte digest, the presentation, sign-out clearing, protocol 13.8) instead of `TsConnector`'s watches; `Credential::Account` for custody SERVICE identities. |
| H5 | The gateway (`tsgw`) and query sources become a second `Session` to a gateway daemon (protocol 11.2); then F3's `ts:` rule (with a history key migration) and the query capabilities go. |
| H6 | Avatars and icons as attachments (`Image.attachment_id`, content-addressed cache) instead of channel-0 paths. |
| H7 | The UI on the replica (Phase 5): the old-model projection and F1-F10 go; `u16` client ids widen to `u32` participants. |
| H8 | Reconnect with backoff, resume tokens and persisted cursors move to `voelin-sdk` once it exists; the engine consumes the SDK. |
| H9 | Move `src/ts/` (with its live tests) to `voelin-gateway-ts` (features `basic`, `streams`), first behind a `ts` feature of `voelin-core`, then by git tag; the exit check of plan step 6, `cargo tree -p voelin-core -e normal \| grep -E 'tsclientlib\|tsproto'` empty, holds after H1-H3, H5 and this (17.6 has the complete list of the edges between the engine and `src/ts/`, the stream split and the other crates that carry `tsclientlib`). The first two to cut run from the engine into `src/ts/`: `Backends::default` registers `ts::TsConnector` (the `ts` feature makes it optional), and `link/project.rs` and `link/session_link.rs` import `ts::ts_session::{entities::user_uid, ids}`, the id and uid rule that the projection undoes the synthetic ids with (it moves to the engine side, or into `voelin-model`'s replica conversion, which already has `uid_text`). |
### 11.3 Coordination
- `phase5/ui-vm` adds `crates/voelin-ui-vm` and moves UI logic (servers,
settings) into it. Slice 1's model switch needs its manifest on
`voelin-model.workspace = true`; slice 3's API changes (identity blob,
`client_version` spec, `ts::` paths, `QueryLogin`) need compile fixes where
that branch moved `VoiceOptions` and `ObserveQuery` construction. Merge
`phase5/ui-vm` before slice 3, or plan the fixes on top of it.
- Branches that still edit `crates/voelin-model` must make those changes in
VoelinProtocol after slice 1.
## 12. Risks
| Risk | Mitigation |
|---|---|
| A presence field gets lost between the two translations (a UI detail disappears). | Round-trip tests on the book fixtures and generated presences; F1-F10 listed; live smoke against the baseline. |
| Event timing changes: `Connected` now follows three syncs and a `JoinVoice`; snapshots are coalesced. | All in process for TeamSpeak (microseconds); the FakeLink tests pin the order; `session.rs` is unchanged. |
| The inner bus of `LinkSession` lags and a request never gets its answer. | Capacity 4096, a timeout on every pending request, lag logged. |
| The consumer of the push channel lags and stalls the voice and the commands that share the task. | The task never waits on the channel: what does not fit is dropped and the scope is sent again whole when there is room (14). |
| A uid that round-trips through `User.uid` on one side and through `Foreign` on the other (F10) would key contacts and private history differently. | Both sides use one rule (canonical base64 → bytes, anything else → `Foreign`), asserted by the round-trip test on TeamSpeak 3 and 6 uids, ServerQuery login names and the FakeLink fixtures' `alice=`; checked live (contacts and private history keyed by uid). |
| The model crate switch collides with other branches. | 11.3; the switch is manifest-only. |
| Two adapters cost CPU per voice packet (RTP wrap and unwrap in process). | About a hundred bytes copied per 20 ms per talker; measured in slice 1 by a unit test (`a_voice_packet_costs_microseconds_through_both_adapters`, section 13). |
## 13. Slice 1 as implemented
Slice 1 (the adapter, section 10) is in `phase4/session-seam`: step 1 is the
commit that takes `voelin-model` from the protocol repository, step 2 the
commit that puts the engine on the `Session`. `session.rs` is unchanged
(`git diff 59fec5b -- crates/voelin-core/src/session.rs` is empty), and no
public item was removed. Where the code differs from the text above:
- **Files.** `ts_session` is a directory (`mod.rs` with `LinkConnector`,
`TsConnector`, `connect_params` and the `Session` impl; `driver.rs`, the
task that plays the host; `entities.rs`, the presence as v1 entities and
its diff; `ids.rs`; `media.rs`, voice as RTP and back). The unit tests of
the mapping are `link/tests.rs`; the presence round trip is in `book.rs`,
next to the book fixtures. `bytes` is a direct dependency now (the RTP
packets of `MediaPacket`).
- **`LinkSession` is not generic.** It holds the inner link as an
`Arc<dyn ServerLink>`; `LinkConnector::new(link, schemes)` and
`LinkConnector::any(link)` are the generic part, and `TsConnector` is a
`LinkConnector` over `TsLink` for `ts3server` and `teamspeak`.
- **The account-proof watches** (`myts_identity`, `myts_data`) travel in
`LocalCtx`, from the engine's `LinkCtx` to the connection, not in
`TsConnector` (section 4.8): `Engine::start_with_backends` takes a
registry that is made before the engine exists, so the watches cannot be
handed to a connector in it. `LocalCtx::standalone()` makes a context
(with the watches' senders kept alive) for a connector called outside an
engine; the plain `Connector::connect` of `LinkConnector` uses it.
- **`OpenWrite` hands a connection, not a write half** (`BoxDuplex`): the
upload's `done` has to see the server close it. `UploadBody` reports the
shutdown of the body to `done`, which then waits for the end of the
connection (30 s at most), as `files::upload` always did.
- **Media and pushes have no order between them.** `Talking` and `Audio` come
from the media queue (a `MediaSink` that never blocks), `Poke`, `Chat`,
`Error` and `Presence` from the push channel, and the loop of SessionLink
cannot order two channels: it polls the media queue before the pushes (the
design text had the reverse), which makes a talker's packet reach the
engine early when both are there, and that is all it does. `Talking` and
`Audio` therefore have no defined order relative to `Poke`, `Chat`, `Error`
and `Presence`, and the engine and its tests must not depend on one. (A
packet from a slot the replica does not know yet fetches the queued pushes
first and tries again, so a talker's first packet is not lost either way.)
The first version of the fake-link test of presence played `Audio`, `Poke`
and `Error` in one go and waited for `Talking`, the poke and the error in
that order; it failed in 22 of 300 isolated runs, whenever the pushes were
polled first. It waits for `Talking` before it plays the rest now (5.4).
- **The stream task's reports wait for the engine's announcement.** The
TeamSpeak 6 stream task puts `Event::StreamsChanged` and the like on the
engine's bus itself. Behind a session the engine learns of the connection
only after the connect sequence (a few requests through the driver), while
the stream task lists the server's streams as soon as the server tells it;
a client that acts on the first list (`voelinctl gateway --engine
--watch-streamer`, the `directory_check` of `scripts/it-smoke.sh`) sent
`WatchStream` before the engine knew it had voice, and failed with `not
connected with voice` in half of the runs (3 of 6; the baseline binary
passed all 4 runs the server's clone limit did not end first, the two
alternating on one TeamSpeak 6 server). The
driver of `ts_session` therefore holds the stream task's bus events back
(`Held` in `ts_session/driver.rs`; only for a link with streams, and only
the events that are no answer to a request) until the engine's first
stream command, which `session.rs` sends in its handling of `Connected`
right after it has emitted the state, or for 3 seconds. Three unit tests
pin it (`link/tests.rs`: held until the first stream command, not held for
ever, not held for a link without streams); the same probe passes 8 of 8
with it.
- **CHAT scopes are re-subscribed in full.** The replica drops a scope's
cursor and entities when it is unsubscribed and refuses a delta sync
without a baseline, so SessionLink does not keep cursors for a delta
after moving back (section 4.3); the full sync repeats the window and the
engine's `seen` set reports each `(channel, id)` once. `LinkSession` does
answer `Subscribe.since` of its own epoch with a delta.
- **Fixtures** (section 5.4), beyond the builders listed there:
`presence()` gives the own client the unique id the `Connected` event names
and the server the version of the backend; in
`a_replaced_connection_is_ignored` the new connection's presence puts the
own client in the lobby, where its `OwnChannel` and its channel chat are
(a TeamSpeak server delivers channel chat for the channel we are in only,
section 4.3). In the book round trip a TeamSpeak 6 client with no
streaming flag in the book comes back as `Some(false)` (v1 has no
"unknown").
- **Known limits.** Two clients with one identity (one database id) are two
users of the replica (the own client keeps the database id, else the lower
client id; the other gets a user id made of its client id). A `Put Message` before any snapshot is handed to the link
whatever the channel. `Welcome.limits` is partly filled. `Backends` has a
slot for an `AccountAgent` and for a `HostTrust` (refusing by default);
nothing sets either yet.
Follow-ups for the protocol repository, found while writing the code:
- **P12.** `FileEntry.from_path` should say whether it includes the file's
name. The TeamSpeak side reads it as the whole old path (`/dir/name`),
with `path` and `name` of the entry the new place.
- **P13.** `Signal{speaking}` is for talking in channels the user is not in
(protocol 5.6, 6.4). A host that hears a talker in our own channel and
does not carry the voice as media (TeamSpeak's Speex and CELT talkers) has
no way to say so but that signal, which `LinkSession` uses for them
(SessionLink believes it until `on: false`). The protocol should say that
the signal may do this, or give such a talker a flag on the `VoiceState`.
- **P14.** Say what a backend that reconnects inside a session (TeamSpeak's
`tsclientlib`) tells its consumer: today the participant id of the session
changes without a word, and a consumer has to find itself again by its
user. A `Change` that puts the new `VoiceState` and deletes the old one is
all there is; the native session of H1 starts a new epoch instead.
What ran against the baseline (main `59fec5b`; the dev servers of
`dev/docker-compose.yml` as the compose project `voelin-seam`, TeamSpeak
3.13.8 and 6.0.0-beta13.1):
| Check | Baseline | Adapter |
|---|---|---|
| `scripts/it-smoke.sh ts3 ts6`, every per-server scenario (connect and tree, server and channel chat, voice tone, invisible presence, relay chat, gateway, history, pins and reactions, streams and late and elsewhere streams on TS6, the engine's voice features: file upload, link, list, download and delete; avatar; poke; private and offline messages; friend; blocked poke) | all pass | all pass, the same output apart from counters and ids (the run before the fix of the stream reports, above, failed `directory_check`) |
| the script's last stage, `cargo test -p voelin-core --features media-desktop --test live --test stream_live --test media_live` (parallel) | 5 pass, `ts6_banners` fails (4 HTTP requests where 0 are expected: another test's engine shares the mock server) | the same |
| `live` (serial, `--test-threads=1`) | 6 of 6 | 6 of 6 |
| `voice_features`, `stream_live`, `media_live` (serial) | 3, 3, 2 pass | 3, 3, 2 pass |
`cargo test -p voelin-core` has two failures that exist on the baseline too
(`discover::tests::without_records_the_gateway_itself_is_asked`,
`web::tests::pictures_go_through_the_proxy_named_for_each_hop`: both reach a
server bound to `127.0.0.1` through the name `localhost`, which resolves to
`::1` only on the machine the tests ran on; the modules are unchanged).
The CPU cost of the second adapter per voice packet (section 12) is measured
by the unit test `a_voice_packet_costs_microseconds_through_both_adapters`
(`link/tests.rs`): 5,000 Opus packets of 20 ms each way through both
adapters and the recording link, in a debug build, took about 7 microseconds
per packet to the host and 10 microseconds from it. At one talker that is
well under a tenth of a percent of a core; the test bounds each direction at
500 microseconds. `tests/session_backends.rs` adds two integration tests:
the engine over the protocol repository's `FakeConnector` through
`Engine::start_with_backends` (connect, the server's name, the channels, a
move, disconnect), and the registry's error text for an address no connector
serves.
## 14. Review round 2 of slice 1
The review of the first implementation found eight defects; each is fixed in
its own place above and tested.
| Finding | Fix | Test |
|---|---|---|
| Chat messages of a CHAT scope's initial full sync were lost when `SyncBegin` and `Change` were in one batch and `SyncEnd` in the next: `(channel, id)` was marked as reported before the replica could show the message. | A message is marked as reported only when it was shown; at the `SyncEnd` of a CHAT scope the messages of that channel not shown yet are (4.3). | `the_messages_of_a_chat_sync_are_reported_when_the_sync_ends`, `a_message_that_comes_before_its_scope_is_reported_with_the_sync` (`link/session_link.rs`) |
| The own client id was pinned for the connection: after `tsclientlib`'s reconnect (a new client id) `OwnChannel` and the own channel's chat stopped. | Both sides find us again by our unique id and user (4.4); the own client keeps the database id of an identity that is there twice. | `the_engine_follows_a_reconnect_that_makes_us_another_client`, `we_stay_the_client_we_were_while_it_is_there`, `the_own_client_keeps_the_database_id_of_an_identity_that_is_there_twice` |
| CHAT subscriptions were capped at 16 in process: the 15th private peer's messages were never delivered. | `LinkSession` says 65,536; SessionLink sizes its scopes from `Welcome.limits` (16 only when the host says nothing), server chat and own channel first, newest private conversations next (4.3). | `private_messages_from_more_than_16_peers_all_arrive`, the limits in `the_welcome_names_the_host_the_user_and_what_the_link_can_do` |
| `LinkSession::notify` accepted `List`, `FileRead` and `FileWrite` and ignored them. | A misplaced op is a `Protocol` error; any other op of the control stream is run (3.1). | `a_notify_needs_the_control_stream_and_is_run_as_the_request_it_is` |
| A push channel that ended during the connect syncs threw the session's close reason away. | The reason of `closed()` is the reason of `Disconnected` (4.2). | `a_session_that_ends_during_the_connect_syncs_says_why` |
| `LinkSession` awaited `pushes.send()`: a lagging consumer stalled voice and commands. | Nothing in the task waits: a push that finds the channel full is dropped, the scope is marked as lagged and sent again whole (`SyncBegin`..`SyncEnd`, all or none) when the channel has room, as `ConnectParams.push_capacity` documents; a scope bigger than the channel is sent in bigger chunks, so that it fits an empty channel. Signals have no scope: they are dropped. | `a_consumer_that_lags_loses_the_queue_and_gets_the_scope_again`, `a_scope_bigger_than_the_channel_is_sent_in_bigger_chunks` |
| An address no connector serves was echoed in full, with `?channelpassword=`. | The text cuts the address at `?` and `#` (4.1). | `the_text_of_an_address_nobody_serves_keeps_the_channel_password_out`, `an_address_is_shown_without_its_secrets` |
| `LinkEvent::Talking` of the inner link was ignored, and its documentation unchanged: Speex and CELT talkers were no longer shown as talking. | The docs of `Talking`, `OwnChannel` and `Connected.own_client` say what the adapter derives; the inner link's `Talking` goes on as `Signal{speaking}`, a hint that SessionLink believes until it is over (P13). | `a_talker_the_link_hears_but_does_not_forward_is_shown_as_talking`, `a_host_that_says_someone_talks_is_believed_until_it_says_otherwise` |
## 15. Review round 3 of slice 1
The third review found seven defects (two major, five minor); each is fixed in
its own commit, in its own place above, and tested. The tests that exercise
the engine's behaviour fail on the code before the commit that fixes them.
| Finding | Fix | Test |
|---|---|---|
| **Major.** `presence_follows_the_link_until_it_disconnects` failed in about 7 % of isolated runs (22 of 300 on the first implementation): `Talking` comes from the media queue, `Poke` and `Error` from the push channel, and the loop cannot order two channels; with the push polled first the wait for `Talking` swallowed the other two events and the next wait timed out. | The test is the second changed test of the fixtures (5.4): it plays the voice packet, waits for `Talking`, and only then plays the poke and the error. Section 13 says that `Talking` and `Audio` have no defined order relative to `Poke`, `Chat`, `Error` and `Presence` (it had implied media first), 4.2 step 9 says the bias is no order, and 5.4 records the change of the test. | the test itself: 0 failures in 300 isolated runs, and 0 in 40 runs of the whole `link_fake` binary |
| **Major.** `Driver::join` answered a `JoinVoice` with the own voice state and sent no `Move` whenever the snapshot showed us in the channel: a second request back into the old channel, made while the first move was still on its way, was dropped without an error and the user stayed in the first move's channel. | The shortcut stays for the first `JoinVoice` (the seat) and for a move into the channel we are in while no move of ours is pending; otherwise the request goes to the link in order. The link says nothing to a move into the channel it is in, so a refusal of the first move (`JoinFailed`) now settles the pending moves into the channel the snapshots show, instead of leaving them to the ten seconds (3.1). | `a_move_made_while_another_is_on_its_way_reaches_the_link`, `a_move_back_after_a_refused_move_is_answered_though_the_link_says_nothing` |
| `Session::features()` was never narrowed by `Server.features` (4.7 said it was). | SessionLink keeps the host's set and the server's (`Features::narrowed`), recomputed when the SERVER scope changes or syncs and after a `HostUpdate` (4.7). | `the_features_of_a_server_are_the_hosts_narrowed_by_the_servers_list` |
| User-initiated file transfers got a 30 s negotiation deadline they never had (pictures had one, `IMAGE_NEGOTIATION`, and keep it in SessionLink). | `LinkSession` waits for the link's `OpenRead` and `OpenWrite` without a deadline; a caller that drops the call is noticed through the closed reply channel and takes the inner job with it (3.1). | `a_transfer_waits_for_the_server_for_as_long_as_the_caller_does` (virtual time) |
| A poke from a sender with no unique id who is not on the snapshot lost its name (no `User` entity in LIVE for the synthetic `client:N` id). | The driver puts a bare `User` with the name and no uid into LIVE for that id, replaced when the same client id comes back with another name (5.2). | `a_poke_from_a_sender_with_no_unique_id_outside_the_snapshot_is_named` |
| The `ts3server://` round trip of `address_link` and `inner_options` changed what the link was given for odd bookmark addresses: a port that is no `u16` was dropped silently, empty option strings became none, a bare host with a `?` lost the channel. | A port that is not a number from 1 to 65535 and a host that a link cannot carry (empty, `?`, `#`, `/`, `%`, white space, an unclosed `[`) fail the connect in words (`connect_params` returns a `Result`); the remaining normalisations are listed in 4.2. | `a_bookmark_the_link_would_change_is_refused`, `the_bookmarks_a_server_has_come_back_with_their_channel`, `empty_options_come_back_as_none` (`ts_session/mod.rs`), `a_bookmark_with_a_port_that_is_no_port_does_not_connect` |
| One nightly rustfmt difference in `link/tests.rs` (`.count()` and `== 3` on separate lines). | The count is bound to a local, so both rustfmt versions format it alike. | `cargo fmt` stable (1.94) clean; nightly differs from the baseline's six diffs only (`history.rs`, `encoder.rs`, `discovery.rs`, `chat.rs`, `studio.rs`, `engine.rs`) |
What the fixes leave as it was: a move into the channel we are in, with none
pending, is still answered without asking the link (the baseline's link answered
it with nothing, so the user saw nothing either way), as 3.1 designed. One window
remains, where the baseline sent the `Move`: a move that the server made by
itself (a moderator moving the user) and that the snapshot has not shown yet
makes a `JoinVoice` into the channel the snapshot still shows a no-op, until the
snapshot catches up. The reviewer offered dropping the shortcut altogether; the
cost of that is the ten seconds a swallowed `ChannelAlreadyIn` leaves a request
waiting (and a request per click on the own channel), so it is kept for the
case where nothing is pending. And the 30 s `ANSWER_TIME` still bounds the
requests that are answered with data (file lists, deletes, offline messages),
which the baseline did not bound.
### What ran
Checks of this round, on the head of the branch (Rust 1.94 and nightly
2026-10-19, in a nix shell with the native libraries; the baseline was not run
again, the comparison with it is the table of section 13):
- `cargo fmt` on the own crates (`scripts/own-crates.sh`): clean on 1.94;
nightly shows the baseline's six differences only. (`cargo fmt --all` on 1.94
rewrites the vendored `crates/proto`, which has a nightly-only style, so it
is not the check.)
- `cargo clippy $(scripts/own-crates.sh) --all-targets --locked --no-deps --
-D warnings`: clean on 1.94. Nightly clippy reports five lints in code this
branch did not touch (`result_large_err` of `shutdown_connection` in
`voice.rs`, four `chunks_exact` in `audio.rs`) and none in the new code.
Every commit of the round passes it on 1.94 alone.
- `cargo test -p voelin-core --locked --no-fail-fast`: everything passes on
1.94 and on nightly but the two tests that fail on the baseline too
(`discover::tests::without_records_the_gateway_itself_is_asked`,
`web::tests::pictures_go_through_the_proxy_named_for_each_hop`). The
presence test of `link_fake` passed 300 isolated runs of 300 (22 failures
of 300 with the test as it was), and the whole `link_fake` binary 40 of 40.
- `cargo check --workspace --all-targets --locked` on 1.94 and on nightly
(includes `voelin-ui`, `voelinctl` and the gateway binaries).
- Live, against fresh dev servers (compose project `voelin-seam3`, TeamSpeak
3.13.8 and 6.0.0-beta13.1): `scripts/it-smoke.sh ts3 ts6`, every per-server
scenario passes; the script's last stage fails in `ts6_banners` only (its
assertion "disabled policy must prevent HTTP requests"), as it does on the
baseline. Run by hand, serially:
`live` 6 of 6, `media_live` 2, `stream_live` 3, `voice_features` 3 and
`voelin-stream`'s `live_ts6` 1 pass.
## 16. Slice 2 as implemented
Slice 2 (section 10: the tests on `FakeSession` and `FakeHost`, the conformance
suite, the TeamSpeak session tests) is in `phase4/session-seam`. It adds tests
and two small changes to the code under test, each found by a test, each in a
commit of its own (F1 and F2 in 16.5); a third finding (F3) is open, and a
fourth (F4) is an observation.
### 16.1 What was built
| File | What | Tests |
|---|---|---|
| `tests/session_fake.rs` | The engine through `Engine::start_with_backends` with a `FakeConnector` (scheme `fake`) and a `FakeHost` filled with `put`; `FakeHandle` plays the backend of one session. Public API only. | 16 run, 2 ignored (F3); 18 run since the review of slice 2 split two tests out (17.1) |
| `tests/link_fake.rs` | Trimmed to the three tests that need the inner link: the stream commands (`stream_commands_reach_a_link_with_streams`), the order of a reconnect's shutdown, a replaced connection that keeps talking. Slice 3 made the inner link crate-private and moved the file into the crate (`src/link/fake_link_tests.rs`, 17.1). | 3 |
| `src/link/fake_tests.rs` | What needs the crate's private parts: our voice as RTP read from `sent_media`, the voice of other slots, our own voice coming back, the conformance suite through `Backends::connect`. | 4 |
| `src/link/tests.rs` | One more test: a session made outside an engine keeps its watches open (F2). (Slice 3 replaced it: the connector owns the watches, 17.1.) | 1 |
| `src/ts/ts_session/live_tests.rs` | The TeamSpeak `Session` on both development servers (`VOELIN_LIVE=1`): the conformance subset and the session scenarios of 9.3. It raises the servers' anti-flood limits itself before the first connection (16.8). | 12 live, 2 ignored |
`scripts/it-smoke.sh` runs the live module before its engine stage.
The scenarios of `link_fake.rs` that moved:
| Was in `link_fake.rs` | Now | What is new in the version on the fake host |
|---|---|---|
| `presence_follows_the_link_until_it_disconnects` | `presence_follows_the_host_until_it_ends` | the server's name and backend from `Welcome`, the tree from `Channel`s with `position`, participants from `VoiceState`s and `User`s, talking from `inject_media`, the poke as a `Signal`, the notice as `Error`, the end as `kill(Network(..))` |
| `commands_reach_the_link` (minus streams) | `commands_reach_the_host_as_requests` | what the host received: `Put{Message}` (Markdown without `chat.bbcode`), `JoinVoice` with the password, the flags as notifications (id 0) patching one leaf path, `Signal{poke}`, `List{FILE}` (the fake refuses `List.path`, so the answer is scripted) |
| `a_sent_message_and_its_echo_are_one_message` | same name | the fake stores our `Put` and pushes its `Change` |
| `a_message_that_comes_twice_is_shown_once` | same name | four `FakeHost::put(Message)`, one with `MESSAGE_FLAG_RELAYED` |
| `history_is_kept_across_the_connection` | `history_is_kept_across_the_session` | a DM `Channel{server_id: 0}` in HOME, found through the other recipient's unique id |
New in `session_fake.rs`: how a session ends and the text the user reads (a
kick with a reason, an idle timeout, a close with no reason, the user's own
close as `Local(Normal)`); what a host refuses in its own words (`message:`,
`poke:`, `PASSWORD`, `FULL`, other, and a private message to nobody without a
request); closed scopes (a CHAT scope says nothing, a LIVE scope is an error
and an empty presence); a `HostUpdate` that removes `files`, so that the engine
refuses a file list without asking, and adds it and `mailbox` again; offline
messages as scripted `Mail` and the `Put`/`Delete` the host received; a file
written with `write_file`, read back with `read_file`, a missing file, and a
resumed upload that continues where the host's copy ends (the copy is left by
another session of the host that dropped its upload); `CreateDirectory`,
`RenameFile` and `DeleteFiles` as `FileEntry` puts and deletes; media routed to
the talker of its slot (an unknown slot, a whisper, 400 ms of silence); a
reconnect (the host sees the first session closed, the second has another
participant, a message said while away arrives, and the replay of the one
message seen is not shown again, because `Dedup` still holds it; every
replayed message is stored again, and one older than `Dedup`'s 4 s is shown
again, which the two ignored tests of F3 pin); a connect that fails, and a
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 the protocol's suite (still 17, in the same order, at the
pin of task 34 and at the tag `v0.2.0`) 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
request ids the host sees are the session's own (`shared_request_ids`).
**Against TeamSpeak.** `ts3_conformance_subset` and `ts6_conformance_subset`
open a `TsConnector` session per case on the development servers, and give the
suite the `FakeHandle` of an unrelated fake host as its backend. The verdict of
every case is asserted (2 pass, 4 skipped, 11 not run), and a case the suite
gains fails until it is listed in `EXPECTED`. The verdicts are the same on
TeamSpeak 3.13.8 and 6.0.0-beta13.1:
| Case | Verdict | Why (what the case did when it was run) |
|---|---|---|
| `welcome_matches_features` | passes | session only |
| `close_ends_the_session` | passes | session only: `closed()` is `Local(Normal)`, later requests, notifications and media are `Closed`, the push channel ends |
| `a_stale_rev_conflicts_and_a_patch_writes_only_its_paths` | skipped | no `chat.edit` |
| `requests_apply_in_the_order_they_were_issued` | skipped | no `chat.edit` |
| `list_pages_history` | skipped | no `chat.history` |
| `idempotency_keys_apply_a_put_once` | skipped | no `idempotency` |
| `subscribe_syncs_the_scope` | cannot pass | writes to channel 4001: rejected (`NotFound`) no such channel |
| `subscribe_resumes_from_a_cursor` | cannot pass | channel 4002, the same |
| `put_answers_entities_and_pushes_the_change_with_the_same_rev` | cannot pass | channel 4003, the same |
| `delete_answers_an_ack_and_pushes_the_removal` | cannot pass | channel 4004, the same; and TeamSpeak cannot delete a message, where the case needs `chat` only (P8) |
| `a_key_names_an_entity_without_its_server` | cannot pass | server 4020: rejected (`NotFound`) no such server; and it creates a `ScheduledEvent` and an `Emoji`, which TeamSpeak lacks, though it needs no feature (P8) |
| `files_round_trip` | cannot pass | writes an `AttachmentSlot`: rejected (`Unsupported`) "attachments are not offered by this connection"; TeamSpeak has channel files, and the case needs `files`, not `chat.attachments` (P8) |
| `media_loops_back` | cannot pass | a TeamSpeak server does not return a client's own voice: the packet never loops back |
| `cancel_before_apply_is_cancelled` | cannot run | holds the unrelated fake host, so the request is answered while it "holds" |
| `notifications_are_fire_and_forget` | cannot run | reads the request log of the unrelated fake host: the notification never arrives (and it types into channel 1) |
| `renew_account_follows_the_feature` | cannot run | pushes a `HostUpdate` into the unrelated fake session's push channel, which is closed |
| `the_backend_can_end_the_session` | cannot run | kills the unrelated fake session, so `closed()` of the TeamSpeak session never resolves; and a kick is `Network(text)`, not `Remote{KICKED}`, until H1 |
The cases that cannot pass or cannot run are not part of the default run: the
two ignored tests `ts3_cases_that_do_not_apply_fail` and
`ts6_cases_that_do_not_apply_fail` run each of them (with a step of 3 s) and
assert that it fails, printing the first line of the failure, so that a case
that starts to pass (with the native session of H1) is noticed. The table above
is what they printed.
### 16.3 The TeamSpeak session scenarios
Six live tests per server, on sessions that `TsConnector` made through the
plain `Connector` interface and that were driven the way section 4.2 drives a
session (list the server, subscribe HOME, SERVER and LIVE, take the seat, wait
for the LIVE scope to show it):
| Test | What it checks |
|---|---|
| `chat_in_the_own_channel` | `Put Message` in the channel both sessions are in is answered with the message as written; the other session gets the `Change` in its CHAT scope, ours gets the echo (the ids agree only with H1's native session, so only "not zero" is asserted) |
| `refused_moves` | with a Normal-group key and a locked and a full channel made through ServerQuery: `JoinVoice` without or with a wrong password is `Rejected(PASSWORD)`, with the right one it seats us in that channel, a full channel is `Rejected(FULL)` |
| `poke_between_sessions` | `Signal{poke}` to the other participant reaches it as a `Signal` from our participant with the words |
| `voice_between_sessions` | five Opus frames and an end sent on our slot reach the other session's `MediaSink` on our slot, the first with the marker, the sequence counting up by one (it is TeamSpeak's packet id), the last an empty payload; media on a slot that is not ours is refused before it leaves |
| `channel_file_from_an_offset` | with a Server Admin key (guests may not upload): `write_file` of 3,000 bytes, `read_file` from offset 1,000 gives the file's size in the head and the bytes from the offset; the file is deleted afterwards |
| `conformance_subset` | 16.2 |
### 16.4 Where the code differs from sections 9.2 and 9.3
- **The CHAT re-subscription after moving back is a full sync**, not a delta
(13): `the_chat_of_a_channel_is_resubscribed_when_we_move_back` asserts two
`Subscribe`s of the channel without `since`, the missed message once, and the
messages seen before not again. The `seen` set of `SessionLink` drops them,
within the one connection, before the engine is asked about them: the test
sends two of them 10 s apart, so that `Dedup` (4 s) no longer holds the older
one and could not have dropped it. (With one message only the test passed
without the `seen` check as well, because the newest message seen is held by
`Dedup` too; with the check disabled the two-message test sees "before"
again, 16.8.)
- **A reconnect resumes nothing** (4.4): the second session is another session
of the same host, with a `SessionLink` and a `seen` set of its own.
`a_reconnect_finds_the_state_the_first_session_left` asserts what that gives
(the state of the host, another participant, the first seat gone from the
host, the first session `Local(Normal)`, the message said while away shown
once). What it does not give is a clean replay: the host sends the window of
the CHAT scope again, and every replayed message is stored a second time, and
shown a second time unless `Dedup` still holds an equal one (it holds the
messages up to 4 s older than the last it was asked about). The one message
that test sends before the disconnect is inside that window, so its replay is
dropped. The two ignored tests of F3 (16.5) send two messages more than 4 s
apart and pin both effects.
- **Our voice in `FakeHandle::sent_media()`** is a test of `SessionLink`
(`link/fake_tests.rs`): no `Command` of the engine sends voice, the audio
thread does.
- **The conformance run and the live TeamSpeak tests are in-crate**:
`Backends::connect`, `LocalCtx` and `TsConnector` are crate-private, and
nothing was made public for a test. The live module runs with
`VOELIN_LIVE=1 cargo test -p voelin-core --lib ts_session::live_tests -- --test-threads=1`.
The servers must be the ones of `dev/docker-compose.yml` (the module logs in
to their ServerQuery as `serveradmin`) and may be freshly started: a server
with its default anti-flood limits bans the address of the tests after three
or four connections (`ConnectFailedBanned`), so the module raises
`virtualserver_antiflood_points_needed_ip_block` and
`virtualserver_antiflood_points_needed_command_block` itself, once per server
and run, and clears the bans of an earlier run (`bandelall`), as
`scripts/it-smoke.sh` does in `admin_args`. It leaves the limits raised.
Slice 3 makes `TsConnector` public as `voelin_core::ts` and can move them to
`tests/`.
- **The fake host does not model everything the scenarios use**: it refuses
`List.path` (a file list and the listing before a resumed upload are
scripted), stores no `Mail` and no `FileEntry` (scripted), and its scripts
take every request of their op, so a script is added after the connect, and
the one for `list` answers by the kind asked. A `HostUpdate` or a notice
has no event of its own: a test knows the engine has applied a push when the
notice it sent after it is reported.
- **`welcome_matches_features` and `close_ends_the_session` pass for the right
reason only since F2.** Before it, a session made outside an engine ended by
itself within a moment.
### 16.5 What the tests found
**F1 (fixed, `Drop the media that comes back on our own slot`).** A session
that loops our voice back made the engine hand our own packets to the audio
thread and show us as talking: the slot map holds every participant, ourselves
included. `FakeSession` loops media back by default, so that a test sees media
move; a Voelin host that did the same would have made the engine play us to
ourselves. `on_media` returns for the packets of our own slot. TeamSpeak never
sends a client its own voice, so nothing changes for the servers the engine
reaches. Test: `our_own_voice_coming_back_is_not_played_back` (it heard
`[1, 50]`, us and then alice, before the change).
**F2 (fixed, `Keep the account watches of a session made outside an engine
open`).** `LocalCtx::standalone()` exists to hold the senders of the
myTeamSpeak watches for a connector called outside an engine, but
`connect_link` dropped it when it returned; the TeamSpeak link ends its
connection with "account source closed" when a watch has no sender, so every
session made through the plain `Connector` interface ended by itself a moment
after it was handed out. The engine's path was never affected. The context
now moves into the driver task. Found by the first live run of the suite
(`the_backend_can_end_the_session` saw that text; `close_ends_the_session` had
passed without the session being alive). Test:
`a_session_made_outside_an_engine_keeps_the_watches_of_its_link_open` (fails
with "the identity watch lost its sender" without the change).
**F3 (open; two ignored tests,
`a_message_the_host_sends_again_after_a_reconnect_is_not_shown_again` and
`a_message_the_host_sends_again_after_a_reconnect_is_stored_once`).** After a
reconnect, a Voelin host sends the window of a CHAT scope again (the full sync
of 4.3), and the engine gets it wrong twice, in the store and on the display.
`seen` in `SessionLink` is per connection, so every message of the replay is
reported again; `session.rs` then stores each one (`store_live`, before
anything looks for a copy) and shows each one unless `Dedup` drops it.
- **The store.** The store merges copies from different sources only, so a
replay over the same source is a second row, whatever `Dedup` does, and
`ChatMessage` does not carry the host's message id that would let it merge
them.
- **The display.** `Dedup` (`route.rs`) recognises a copy only while an equal
message (target, author, text, a timestamp within 2 s) is still held, and it
holds the messages up to 4 s older than the last one it was asked about. A
replayed message that is not equal to a held one is shown again as a live
`Event::Chat`, like a new message: every message of the replayed window that
is more than 4 s older than the newest message seen before the disconnect.
The newest message, and what is within 4 s of it, is dropped.
The first version of the stored-once test sent one message before the
disconnect and looked at the rows only, and the display check of
`a_reconnect_finds_the_state_the_first_session_left` passed on that one message
because it is the newest one, so `Dedup` still held it: no test showed that the
display was wrong too. With two messages 10 s apart ("first" at `t`, "second"
at `t + 10 s`, then "while away" at `t + 30 s` said while the first session is
closed) the two tests see:
| Test | Expected | Seen |
|---|---|---|
| `..._is_not_shown_again` | the events `["while away"]` | `["first", "while away"]` ("second" is held and dropped, "first" is shown again) |
| `..._is_stored_once` | the rows `["first", "second", "while away"]` | `["first", "first", "second", "second", "while away"]` |
`a_reconnect_finds_the_state_the_first_session_left` stays in the default run
and proves only that a message inside `Dedup`'s window is not shown again.
TeamSpeak never replays, and no `voelin://` connector is registered, so no host
the engine reaches today meets this. Not fixed here because the cure is the
resume of H8, not a patch: a cursor kept per CHAT scope and sent as
`Subscribe.since`, which makes the reconnect a delta and cures both effects (the
replayed window is never sent), but only within an epoch: after an epoch change
the host sends a full sync again, and then only the host's message id can tell a
copy, in the store (H10) and on the display. The cheaper candidates each carry a
risk (a time floor per channel for the messages of a connect-time sync would
hide a backlog of a host that was restored with older clocks; keeping the
reported ids across connections would hide new messages of a host whose ids
restart; widening `Dedup` would hide a message said twice on purpose). The two
ignored tests are the acceptance tests of whatever is chosen.
**F4 (observation).** The first snapshot of the TeamSpeak link can come after
the session was handed out (the driver waits 250 ms for it, `FIRST_SNAPSHOT`),
so a consumer that subscribes at once gets an empty LIVE sync and the voice
states as changes after it, and the seat the first `JoinVoice` answers can
name channel 0. The engine's replica copes (it is built on changes); a
consumer that reads the seat's channel must wait for its `VoiceState` in LIVE,
as `Client::settle` in the live tests does. H1's native session should hold the
first sync back until it has the snapshot.
### 16.6 Follow-ups from this slice
For the protocol repository (workarounds as above):
| # | What | Workaround meanwhile |
|---|---|---|
| P15 | The suite's `Fixture::backend` is a `FakeHandle` for every harness, so a session of a real backend hands it an unrelated fake host and the cases that touch the backend fail or wait instead of being skipped. Make it `Option<FakeHandle>` and let a case say that it needs the backend (extends P8). | `EXPECTED` in `live_tests.rs` names the cases to run. |
| P16 | Say whether a host sends a sender its own voice. `FakeSession` loops it back by default and `media_loops_back` pins that for the fake; a consumer cannot tell a rule of the protocol from a setting of the fake. | F1: the engine drops its own slot. |
| P17 | Say what a consumer that reconnects without a resume token does with the replay of a CHAT window (protocol 2.5, 5.4): the `Message` id is the key to merge on, and `Subscribe.since` of a previous connection's cursor is a delta only within an epoch. | F3: nothing yet (the replay is shown again and stored again). |
For the second half:
| # | What |
|---|---|
| H10 | CHAT cursors per session and address in `SessionLink` (or the SDK of H8), sent as `Subscribe.since` after a reconnect; then the two ignored tests of F3 run; the cursor cures the display and the store only within an epoch (16.5). For the full sync after an epoch change the host's message id also has to reach the store (or the store has to merge same-source copies by id) and the display. |
| H11 | The native TeamSpeak session of H1 holds the first sync back until it has the first snapshot (F4), and `ts_session/live_tests.rs` moves with `ts_session` to `voelin-gateway-ts`; its `EXPECTED` table is the conformance record of that crate. |
### 16.7 The broken translation
Acceptance asks for a deliberately broken translation that makes a
`session_fake` test fail. With the `self_mute` path dropped from
`LinkCmd::SetInputMuted` in `link/session_link.rs` (the line
`self.voice_flag("self_mute", |voice| voice.self_mute = muted);` removed, the
file restored afterwards), `commands_reach_the_host_as_requests` fails:
```
thread 'commands_reach_the_host_as_requests' panicked at .../voelin-proto/src/test_util/connector.rs:301:3:
timed out after 20s waiting for self_mute
```
### 16.8 What ran
Environment: Rust 1.94 (`rust-toolchain.toml`) and nightly 2026-10-19, in a
`nix shell` with `gcc cmake gnumake pkg-config jq alsa-lib openssl libvpx dav1d
pipewire fontconfig libxkbcommon`. `nix shell` does not run the setup hooks, so
three things were added by hand: the `.dev` outputs of those libraries on
`PKG_CONFIG_PATH` (without them `alsa-sys` does not build), their `lib`
outputs on `LD_LIBRARY_PATH` (`voelinctl` needs `libvpx.so.12`), and
`LIBCLANG_PATH` with `BINDGEN_EXTRA_CLANG_ARGS` for `libspa-sys`. With that
`cargo check --workspace --all-targets --locked` passes on both toolchains. The
development servers were TeamSpeak 3.13.8 and 6.0.0-beta13.1 of
`dev/docker-compose.yml` (compose project `voelin-seam5`, reset with `down -v`
before each smoke run; the review round after the first version of this section
used `voelin-fix2`, reset the same way).
The review round (the corrections of F3, 16.1 and 16.4, the live module's
anti-flood step) ran on 1.94.1 and on the nightly that the store held then,
`rustc 1.101.0-nightly (19833af72 2026-10-20)`: the nightly 2026-10-19 of the
first record was no longer there, so every nightly number below was measured
again on this one. The `nix shell` was the same set plus `expat` and the `.dev`
outputs of `freetype` and `libxkbcommon`; `PKG_CONFIG_PATH` took the `.dev`
outputs of all of them, `LD_LIBRARY_PATH` every output of every one of them
(the `out` output alone left `libvpx.so.12` unfound for `voelinctl`), and
`BINDGEN_EXTRA_CLANG_ARGS` the include directories of `glibc.dev` and of
`clang`'s resource directory.
| Check | Result |
|---|---|
| `cargo fmt $(scripts/own-crates.sh) -- --check` | clean on 1.94. Nightly 2026-10-20 (measured again in the review round): the six differences of the baseline, in the same six files (`history.rs`, `encoder.rs`, `discovery.rs`, `chat.rs`, `studio.rs`, `engine.rs`), none in a file of this slice. (`cargo fmt --all` on 1.94 rewrites the vendored `crates/proto`, so it is not the check.) |
| `cargo clippy $(scripts/own-crates.sh) --all-targets --locked --no-deps -- -D warnings` | clean on 1.94, `voelin-ui` and the binaries included. Nightly 2026-10-20 (measured again in the review round): `-p voelin-core --all-targets` gives the five lints of the baseline in code this slice did not touch (`chunks_exact` four times in `audio.rs`, `result_large_err` in `voice.rs`), none in the new code; over all own crates this nightly stops earlier, in `voelin-audio` and `voelin-media`, on lints that are new to it (`chunks_exact` and `chunks_exact_mut` with a constant chunk size, a manual checked division, `sort_by_key`) in two crates the slice did not touch. Every commit of the slice was checked alone on 1.94 (fmt, clippy, its tests); the first from an archive of its tree, the two code commits of the review round (`81d1de8`: the tests of 16.4 and 16.5; `9283191`: the live module) from detached checkouts in this worktree (fmt of the own crates, clippy of `voelin-core --all-targets`, `session_fake` and `link_fake`), and the record of the round is a commit of this file only. |
| `cargo check --workspace --all-targets --locked` | passes on 1.94 and on nightly |
| `cargo test -p voelin-core --locked --no-fail-fast` | 1.94: 236 lib tests pass, 2 are ignored (the live "do not apply" tests), 2 fail; the integration tests pass (`session_fake` 16 and 2 ignored, `link_fake` 3, `session_backends` 2, `gateway` 8, `live` 6, `stream_live` 3, `voice_features` 3, `settings` 1). Nightly 2026-10-20: the same integration tests, and 235 lib tests pass with 3 failures: the two below and `identity::tests::improve_level_keeps_the_key` once in seven runs (it passed in six reruns of the single test; it makes a random identity and asserts that the counter grew, which it does not when the key already has the level asked for, so a flake, though that cause was not confirmed; `identity.rs` is unchanged since `59fec5b`). (Without `--no-fail-fast` the run stops at the lib's two baseline failures and the integration tests do not run.) The two failures are the baseline's (`discover::tests::without_records_the_gateway_itself_is_asked`, `web::tests::pictures_go_through_the_proxy_named_for_each_hop`: both reach a server bound to `127.0.0.1` through `localhost`, which resolves to `::1` here); they fail on an unchanged copy of `bfc52e2` too. |
| `cargo test -p voelin-core --locked --features media-desktop` | (first version of this record; not rerun in the review round, which changed tests, the live module and this file only) the same, and a third failure, `media::tests::peer_config_follows_codecs`, which depends on the codecs of the machine and fails on the unchanged copy of `bfc52e2` as well. (`--features media` alone does not compile the crate's tests: `src/media.rs` names `voelin_media::ffmpeg`, which only the desktop backends have; that is the baseline's.) |
| `link_fake` and `session_fake`, 15 consecutive runs (again on the head of the review round, with the changed move-back test) | 0 failures (load average about 4; 9 at the last run of the review round) |
| Mutation (16.7) | `commands_reach_the_host_as_requests` fails with the `self_mute` path dropped; the file was restored |
| Mutation (16.4), `if self.seen.contains(&(channel, id))` in `SessionLink::after` made `if false && ...` | `the_chat_of_a_channel_is_resubscribed_when_we_move_back` with its first version (one message seen before the move) still passes, and so does `a_reconnect_finds_the_state_the_first_session_left`: `Dedup` holds the newest message seen. With the two messages 10 s apart of the present version the test fails (`left: "before"`, `right: "while away"`); the file was restored |
| The two ignored tests of F3, `cargo test -p voelin-core --test session_fake -- --include-ignored` | the other 16 pass; `..._is_not_shown_again` sees `["first", "while away"]`, `..._is_stored_once` sees `["first", "first", "second", "second", "while away"]` (16.5); ten more runs of the two (`-- --ignored`): the same two values each time |
| `a_session_made_outside_an_engine_keeps_the_watches_of_its_link_open` without the change of F2 | fails ("the identity watch lost its sender") |
| `our_own_voice_coming_back_is_not_played_back` without the change of F1 | fails (`[1, 50]` heard) |
| Live module, `VOELIN_LIVE=1 cargo test -p voelin-core --lib ts_session::live_tests -- --test-threads=1` | 12 of 12 pass on both servers, in 16 s; three more serial runs and one parallel run the same; with `--include-ignored` the two ignored tests pass too, each non-applicable case failing as `EXPECTED` says (the output of 16.2) |
| The same command on a freshly started stack (`down -v`, `up -d`, nothing else run before) | Before the module raised the anti-flood limits itself: 4 passed, 8 failed (`ts3 did not connect: session closed: Network("Server refused connection: ConnectFailedBanned")`, the same for ts6). The module as it now is, run straight after that failing run (the ban still in force): 12 passed, 2 ignored. After a fresh reset: 12 passed, 2 ignored in 16 s, and 14 of 14 with `--include-ignored` in 51 s; after another reset, the same module in parallel (the default test threads): 12 passed, 2 ignored in 7 s, the tests that start together waiting for the one that raises the limits. Without that step the module passed only after `scripts/it-smoke.sh` had raised the limits (`admin_args`). `banclear` is refused by both servers (`error id=256 command not found`, read on TeamSpeak 3), `bandelall` is accepted by both. |
| `scripts/it-smoke.sh ts3 ts6` on an archive of `bfc52e2` (before) | every per-server scenario passes (connect and tree, server and channel chat, voice tone, invisible presence, relay chat, gateway, history, pins and reactions, the engine's voice features, and on TeamSpeak 6 the streams and the late and elsewhere streams); the last stage fails in `ts6_banners` (`live.rs:375`, "disabled policy must prevent HTTP requests"), as it does on `59fec5b` |
| `scripts/it-smoke.sh ts3 ts6` at the head of the slice (after) | the same output apart from ids and counters (compared line by line with the numbers and identifiers masked), plus the new stage of the live module (12 passed, 2 ignored); the last stage fails in `ts6_banners` at the same line |
| `scripts/it-smoke.sh ts3 ts6` in the review round, at `2089f7c` (before) and at `9283191` (after), each on a freshly reset stack (`COMPOSE_PROJECT_NAME=voelin-fix2`, the state directory under the scratch directory) | both: every per-server scenario of ts3 and ts6 passes, the live module stage gives 12 passed, 2 ignored (16.2 s before, 16.4 s after), and the last stage fails in `ts6_banners` at `live.rs:375` (5 passed, 1 failed), the baseline's failure. The two outputs have 102 lines each and are equal once uids, stream ids, file names and counters are masked (the only residue is the random token in `history-talker: offline-<token>`). The review round changed tests, the live module and this file, so the smoke is unchanged by construction; it also shows that the raising of the limits in `admin_args` and the module's own coexist. |
| the live binaries by hand, serially, on the head (`--features media-desktop`) | `live` 6 of 6, `media_live` 2, `stream_live` 3, `voice_features` 3, `voelin-stream`'s `live_ts6` 1: those of the baseline |
Not run: `cargo deny` (not installed in this environment; `Cargo.lock` and
`THIRD_PARTY_NOTICES.md` did not change, no dependency was added), the
Windows, Android and Flatpak builds.
## 17. Slice 3 as implemented
Slice 3 (section 10: the `ServerLink` layer where it is redundant, TeamSpeak
types out of the API) is in `phase4/session-seam`. The three non-blocking
minors of the review of slice 2 are in the first three commits, each of its
own; the slice itself follows, one commit per step, and every commit passes
`cargo fmt` and `cargo clippy --all-targets --no-deps --locked -- -D warnings`
alone (17.5).
### 17.1 What was done
| Commit | What |
|---|---|
| `dd9140e` | `cases_that_do_not_apply_fail` calls `the_suite_is_known()` first: a case the suite gains is no longer skipped by the zip with `EXPECTED`. |
| `b92379d` | The tail of `a_reconnect_finds_the_state_the_first_session_left` (a second `ConnectVoice` while connected replaces the session) is `connecting_while_connected_replaces_the_session`, and the end of `commands_reach_the_host_as_requests` (a host without streams is refused `StartStream` before any request) is `a_host_without_streams_is_not_asked_for_one`; the tests they were cut from check what their names say. `session_fake` runs 18 tests and ignores 2. |
| `362e2b9` | `presence_follows_the_host_until_it_ends` asserts `uid_of(client)` of the three clients (the base32 of the Voelin uid, the host's name for each) and `ServerDetails.uid`. |
| `029b846` | `ts_link.rs`, `voice.rs`, `book.rs`, `ts_session/`, `versions.rs` and `identity.rs` move under `crates/voelin-core/src/ts/` with `git mv` (`git log --follow` reaches their history), and the commit changes only module declarations, `use` paths and the path of `Versions.csv`. `voelin_core::versions` and `voelin_core::identity` are `voelin_core::ts::versions` and `voelin_core::ts::identity`; the UI and voelinctl follow with the paths. (`ts_session` has been a directory since slice 1: section 10 wrote `ts_session.rs`.) |
| `a451f02` | `Command::SetMytsIdentity` and `SetMytsData` are gone. `ts::TsConnector` is public, owns the account (`TsConnector::set_myts_identity`, `set_myts_data`; clones share it), and each connection holds the senders for as long as it runs, so a session outlives its connector (the F2 guarantee, now by construction: `a_connection_keeps_the_account_open_when_its_link_is_gone` in `ts/ts_link.rs` replaces the test of the standalone context's senders in `link/tests.rs`). `Backends::register_teamspeak(TsConnector)` is the public way to register a connector whose clone the application keeps; `Backends::default` registers one of its own. `LinkCtx`, `LocalCtx`, `SessionHandle` and `Session` lose the two watches. |
| `be84874` | `ObserveGateway.identity` is a `Box<IdentityBlob>` and `gateway::connect(url, &IdentityBlob)` takes the blob: `gateway.rs` reads it itself, and a blob that is no TeamSpeak identity or cannot be read is `ErrorCode::AuthFailed` from `connect` and ends an observation with its reason, without a login (`an_identity_that_cannot_be_read_ends_observing_without_a_login`). `ObserveQuery.connect` is a `Box<QueryLogin>`, which `query.rs` turns into `voelin_query::Connect` (`QueryTransport` is the core's own enum). `voelin_core::IdentityBlob` re-exports `voelin_identity::IdentityBlob`, and `ts::identity::{to_blob, from_blob}` convert (`IdentityError::Blob`, whose text says where the JSON is wrong and never what it says). `voelin-identity` is a dependency of `voelin-core`: `Cargo.lock` gains that one edge. |
| `1edc52c` | `VoiceOptions` is a struct of its own (`identity: Option<IdentityBlob>`, `client_version: Option<String>`, `stream_peer: PeerConfig`, the rest as before). `link/connect.rs` builds the connect parameters (the bookmark's link, the hello, the credential of the identity's kind: a TeamSpeak identity as its JSON, none as the empty blob, a Voelin key as its signer, any other kind refused in words); the client version spec rides the address as `client_version=<base64url of the spec>` and `ts_session::inner_options` resolves it with `ts::versions::resolve` (a spec it refuses fails the connect). `session.rs` holds `Arc<SessionLink>`, the redundant trait between them is gone, and the trait that stays, `ServerLink`, is `ts/ts_link.rs`'s (with the TeamSpeak-typed `ConnectOptions`) for `TsLink` and for the in-memory link of the tests. `LinkCtx`, `LinkCmd`, `LinkEvent` and `Remote` are `pub(crate)`, `TsLink` is `pub(crate)`, `Engine::start_with_link` is removed (not made private), and `tests/link_fake.rs` is `src/link/fake_link_tests.rs` (`git mv`), three unit tests on the same fake link through `Engine::start_with_backends` and `LinkConnector::any`. The module documentation of `link/session_link.rs` carries the contract of the vocabulary that `link/mod.rs` had. |
| `d70a358` | `voice.rs` loses `Download`, `Upload` and `CancelTransfer` (the copying task, the progress cadence, the picture limits, the cancel table, `expire_image_jobs`); it keeps the two connection jobs `OpenRead` and `OpenWrite` and refuses the three commands in words. `files::upload` and its close wait go with it (SessionLink uses `upload_to`; the TCP test of the upload runs through that), and the test of `image_download_time` moves to `cache.rs`. The picture limits and the negotiation deadline are in `SessionLink` alone, tested in `link/tests.rs` as before. |
| `ca34f84` | `QueryLogin.allowlisted`, see 17.2. |
| `f63d459` | The crate's documentation builds with warnings denied: `RUSTDOCFLAGS='-D warnings' cargo doc --no-deps -p voelin-core` failed on `efacb41` and on `59fec5b` alike (eight errors, six with `--features media-desktop`: the cache's module documentation linked to private items, the crate documentation to modules and a type that exist only with the media features), so the acceptance check could not pass without it. Plain code spans now. |
| `d0092e4` | `docs/architecture.md`: "The server link" is "The session seam", and the crate table row of `voelin-core` follows. |
No `CHANGELOG.md` entry: no difference to the baseline is visible to a user
(the UI still checks a bookmark's client version before it connects, and says
the same thing when the spec is none; `QueryLogin` runs the connection with
the options the UI always passed).
### 17.2 Where the code differs from the text of section 10
- **`QueryLogin` has a seventh field, `allowlisted`.** Section 10 lists
transport, address, user, secret, server port and server id. The live tests
(`tests/live.rs`: `ts3_engine`, `ts6_engine`) have always passed
`voelin_query::Connect` with `LineOptions::rate_limit: None`, because the
development servers allowlist their clients; the UI never did, it passed the
query crate's default (nine commands in three seconds). With the six fields
the engine's connections can only have the default limit, and both tests
failed on the first run after the slice (`timed out waiting for relayed
channel message`; the limit is the one difference between that run and the
baseline, and with the bit below the tests pass again, so the relay's
connect is slower than the two seconds the test gives it, behind the limit;
that was not investigated further). `allowlisted` is that one bit: `false`
is what the application says (it cannot know) and what the UI's login says,
so the application's connections are the ones they were; the tests say
`true`.
- **`ServerLink` is not made crate-private, it is moved**: the engine side
needs no trait (`session.rs` holds `SessionLink`), and `SessionLink` and
`TsLink` could not share one `spawn` any more, as the options of the one are
neutral and the options of the other have `tsclientlib` types. The trait is
`ts/ts_link.rs`'s, as the TeamSpeak module "keeps the inner trait".
- **The setters are reachable through `Backends::register_teamspeak`**, which
section 10 did not name: a public setter that nothing could reach would have
been a dead end.
- **`files::upload` and `CLOSE_WAIT` are deleted** (section 10 does not say):
`voice.rs` was their only user.
- **The acceptance `rg` has to be run from `crates/voelin-core/src`**: its glob
`!ts/**` is relative to the directory it runs in. From the repository root,
`--glob '!**/ts/**'` does the same.
- The bookmark-refusal tests that exercise `link/connect.rs` (`a_bookmark_the_link_would_change_is_refused`,
`the_bookmarks_a_server_has_come_back_with_their_channel`, `the_params_carry_what_the_session_needs_and_no_account_yet`)
still sit in `ts/ts_session/mod.rs`, where they were written, next to the
round trip they were part of; moving them is a tidy for later (17.6).
### 17.3 What `phase5/ui-vm-2` has to absorb
The parked branch is not touched. Every change of this slice that reaches an
application that builds `VoiceOptions`, the gateway and query commands or the
TeamSpeak helpers:
- `VoiceOptions` is no alias of `ConnectOptions` any more (`voelin_core::ConnectOptions`
and `voelin_core::link::ConnectOptions` are gone, `VoiceOptions` is
`voelin_core::VoiceOptions`): `identity` is `Option<IdentityBlob>` (was
`Option<tsclientlib::Identity>`; `voelin_core::ts::identity::to_blob(&identity)`),
`client_version` is `Option<String>`, the spec for `ts::versions::resolve` that a
bookmark stores (was `Option<tsclientlib::Version>`; keep the eager
`resolve` for the message and pass the spec string), `stream_peer` is
`PeerConfig` as before; the other fields are unchanged.
- `Command::SetMytsIdentity` and `Command::SetMytsData` are removed: the
account goes to the `TsConnector` the application registered
(`Backends::register_teamspeak`, `TsConnector::set_myts_identity`,
`set_myts_data`, `Engine::start_with_backends`).
- `Command::ObserveGateway.identity` is `Box<IdentityBlob>` (was
`Box<tsclientlib::Identity>`); `gateway::connect(url, &IdentityBlob)` (was
`&tsclientlib::Identity`).
- `Command::ObserveQuery.connect` is `Box<QueryLogin>` (was
`Box<voelin_query::Connect>`): `transport: QueryTransport` (`Raw`, `Ssh`,
`Http`), `address` (was `addr`), `user`, `secret`, `server_port`,
`server_id`, `allowlisted` (`false`); there is no `line`.
- `voelin_core::versions` and `voelin_core::identity` are
`voelin_core::ts::versions` and `voelin_core::ts::identity`;
`ts::identity::{to_blob, from_blob}` are new, `IdentityError` has a `Blob`
variant. `voelin_core::IdentityBlob` re-exports the protocol repository's type.
- No longer public: `ServerLink`, `TsLink`, `Engine::start_with_link`,
`link::{LinkCtx, LinkCmd, LinkEvent, Remote}` and the helper types of
`link` that came with them (`BoxRead`, `BoxDuplex`, `Duplex`).
`voelin_core::link` keeps `Backends` and `VoiceOptions`.
- `voelin_core::ts::TsConnector` is public, with `new`, `set_myts_identity`
and `set_myts_data`.
### 17.4 The acceptance list of section 10
| Item | Result |
|---|---|
| `rg -n 'tsclientlib\|tsproto\|voelin_query'` over `crates/voelin-core/src` without `ts/`, `gateway.rs`, `query.rs` and `stream.rs` | empty (from `crates/voelin-core/src`, `--glob '!ts/**' --glob '!gateway.rs' --glob '!query.rs' --glob '!stream.rs'`). The four exceptions name the crates privately: `gateway.rs` in `login_identity`, `connect_watched`, `attempt` and the tests, `query.rs` in `QueryLogin::connect` and `run`, `stream.rs` in a private `use tsclientlib::ClientId`, and `ts/` is the module. |
| `session.rs` names no TeamSpeak crate | none of `tsclientlib`, `tsproto`, `voelin_query` occurs in it. |
| No public item outside `voelin_core::ts` names a type of `tsclientlib`, `tsproto*` or `voelin-query` | Checked on the rustdoc JSON of the crate (nightly: `RUSTDOCFLAGS='-Z unstable-options --output-format json' cargo doc --no-deps -p voelin-core --features media-desktop`), walking every item the crate exports (5,198 of them): every type reference whose crate is `tsclientlib`, `tsproto`, `tsproto_packets`, `tsproto_types`, `tsproto_structs`, `ts_bookkeeping` or `voelin_query` is in an item of `voelin_core::ts` (11 items: `to_blob`, `from_blob`, `export`, `write_export`, `improve_level`, `Found::identity`, `resolve`, `native_version`, `KnownVersion::to_version` and the two setters of `TsConnector`); none is anywhere else. The grep of `pub` items (`rg '^\s*pub(\(crate\))? .*(tsclientlib\|tsproto\|voelin_query)'` over the crate without `ts/`) is empty, too. |
| `voelin_core::stream` keeps the re-exports | `PeerConfig`, `MediaFrame`, `MediaKind`, `MediaTime`, `Frequency`, `VideoFormat`, `VideoCodec`, `Codec`, `FrameSource`, `SyntheticSource` are re-exported as before (`stream.rs` changed in one doc comment). |
| `cargo tree -p voelin-core -e normal \| grep -E 'tsclientlib\|tsproto'` | still lists `tsclientlib`, `tsproto`, `tsproto-packets` and `tsproto-types`, as the section says it may: the TeamSpeak module is in the crate. |
| The three review minors | `dd9140e`, `b92379d`, `362e2b9`. |
### 17.5 What ran
Environment: Rust 1.94.1 (`rust-toolchain.toml`) and the nightly of the Nix
store, `rustc 1.101.0-nightly (19833af72 2026-10-20)`. The development shell
`dev rust-nightly` does not build here (`cargo-llvm-cov` fails), so both
toolchains were taken from the store paths and put in front of `PATH` in a
`nix shell` of `gcc cmake gnumake pkg-config jq` and the `.dev` outputs of
`alsa-lib openssl libvpx dav1d pipewire fontconfig freetype libxkbcommon
expat`; `nix shell` runs no setup hooks, so `PKG_CONFIG_PATH` (the `.dev`
outputs), `LD_LIBRARY_PATH` (every output of those libraries; `voelinctl`
needs `libvpx.so.12`), `LIBCLANG_PATH` and `BINDGEN_EXTRA_CLANG_ARGS`
(`glibc.dev`'s and `clang`'s include directories) were set by hand. With that
`cargo check --workspace --all-targets --locked` passes on both toolchains,
`voelin-ui`, `voelinctl`, `voelin-android` and the gateway binaries included.
`cargo-about` 0.9.2, which `scripts/notices.sh` insists on (nixpkgs has
0.9.0), was installed with `cargo install` under the scratch directory, and
the TeamSpeak 3.13.8 and 6.0.0-beta13.1 servers of `dev/docker-compose.yml`
were fresh compose projects (`down -v`, `up -d`) for each smoke run.
| Check | Result |
|---|---|
| `cargo fmt $(scripts/own-crates.sh) -- --check` | clean on 1.94. Nightly: the six files of the baseline and no other (`voelin-core/src/history.rs`, `voelin-media/src/ffmpeg/encoder.rs`, `voelin-stream/src/discovery.rs`, `voelin-ui/src/chat.rs`, `voelin-ui/src/studio.rs`, `tools/voelinctl/src/engine.rs`). `cargo fmt --all -- --check` on 1.94 differs in the vendored `crates/proto` only, as it did before (it has a nightly-only style), so it is not the check. |
| `cargo clippy $(scripts/own-crates.sh) --all-targets --no-deps --locked -- -D warnings` | clean on 1.94 at the head. Every code commit of the slice alone (`dd9140e` to `f63d459`, ten of them) was checked out detached in this worktree and passes fmt and clippy: `voelin-core` for the commits that touch tests only, all own crates for the ones that touch the UI or voelinctl. Without `--no-deps`, the command of the task (`cargo clippy -p voelin-core --all-targets --locked -- -D warnings`) stops at the vendored `tsproto-structs` (eight lints) on `efacb41` and on the head alike. Nightly, `-p voelin-core --all-targets`: `result_large_err` of `shutdown_connection` (now in `ts/voice.rs`, the same code) and the `chunks_exact` lints of `audio.rs` that the baseline gave, none in new code. |
| `cargo test -p voelin-core --locked --no-fail-fast` | 1.94: 244 lib tests pass, 2 are ignored (the live "do not apply" tests), 2 fail, both the baseline's (`discover::tests::without_records_the_gateway_itself_is_asked` and `web::tests::pictures_go_through_the_proxy_named_for_each_hop`: `localhost` resolves to `::1` here); the integration tests pass (`gateway` 9, `session_fake` 18 and 2 ignored, `session_backends` 2, `settings` 1, `stream_live` 3, `voice_features` 3, `live` 6, which return at once without `VOELIN_LIVE`). Nightly: the same numbers. With `--features media-desktop` on 1.94: 264 pass, three fail (the two and `media::tests::peer_config_follows_codecs`, which depends on the machine's codecs and failed on the baseline too). `cargo test -p voelin-ui -p voelinctl`: 134 and 7 pass. |
| Repeated runs (1.94) | `session_fake` and the three tests of `link/fake_link_tests.rs`: 15 runs each, 0 failures; the `--lib` suite: 8 full runs. `session::banner_tests::a_failing_banner_is_logged_once_with_its_address` failed once in a full `--lib` run before the last commits (`lines == []`, the test reads the log lines of its own thread with `tracing::subscriber::with_default`) and passed in every run since and in five isolated ones; it was not reproduced and not chased (a module this slice did not touch, a test that depends on a global callsite cache). |
| `RUSTDOCFLAGS='-D warnings' cargo doc --no-deps -p voelin-core` | passes, with and without `--features media-desktop` (it failed on `efacb41`, 17.1). |
| `scripts/notices.sh --check` (cargo-about 0.9.2) | `THIRD_PARTY_NOTICES.md is up to date`: `Cargo.lock` gained one line, the edge from `voelin-core` to `voelin-identity`, a crate already in the graph through `voelin-store`. `cargo deny` is not installed here. |
| `scripts/it-smoke.sh ts3 ts6`, every per-server scenario | the baseline (`efacb41`) and the head both pass them all (connect and tree, server and channel chat, voice tone, invisible presence, relay chat, gateway, history, pins and reactions, the engine's voice features, on TeamSpeak 6 the streams and the late and elsewhere ones). The outputs have 100 lines each and are equal line by line with the digits, base64 runs, uuids and ids masked, but for the random uid of the streamer in the stream-directory line. |
| The script's live module stage | 12 passed, 2 ignored on both (16.35 s before, 16.36 s after); `--include-ignored` at the head: 14 of 14 in 47 s (the two "do not apply" tests call `the_suite_is_known` first now). |
| The script's last stage (`live`, `stream_live`, `media_live`, in parallel) | both: 5 passed, 1 failed, `ts6_banners` ("disabled policy must prevent HTTP requests"), the baseline's failure. The line is `live.rs:375` before and `live.rs:396` after: the file grew by 21 lines in the slice (the `login` helper and its imports, 17.2), the assertion is the same. |
| The live binaries by hand, serially, `--features media-desktop` | before and after alike: `live` 6 of 6 (73.40 s, 73.39 s), `media_live` 2, `stream_live` 3, `voice_features` 3, `voelin-stream`'s `live_ts6` 1. |
| The first smoke run after the slice (head `d70a358`, before `ca34f84`) | `live` failed `ts3_engine` and `ts6_engine` (17.2: `QueryLogin` without `allowlisted`); it is not part of the comparison above, which is the second run on a freshly reset stack. |
### 17.6 Follow-ups
- **H9 starts from the complete edge list below.** The Opus gate of the merge
(2026-10-24) found that 11.2 names two edges and the tree has more. Each
line was checked with `rg` and `cargo tree` on the tree of the follow-up
round (`phase4/seam-followups`); file lines are given where the file did not
change in the round, items by name where it did.
1. **From the engine into `src/ts/`**: what has to be cut or moved before
`ts` can leave the crate.
| Where | What | Goes with |
|---|---|---|
| `link/backends.rs` | `use crate::ts::TsConnector`; `Backends::default` registers `TsConnector::new()`; `Backends::register_teamspeak(TsConnector)` is the only public way to register an in-process connector and goes through the crate-private `register_local(Arc<dyn LocalConnector>)` | H9: the `ts` feature makes `default` optional |
| `link/project.rs:20-21`, `link/session_link.rs:565, 973, 1328` | `ts::ts_session::entities::user_uid` and `ts::ts_session::ids::{self, FOREIGN_SYSTEM}`: the id and uid rule the projection undoes the synthetic ids with | H9: to the engine side, or into `voelin-model`'s replica conversion (`uid_text`) |
| `gateway.rs:98, 1209` | `ts::identity::{from_blob, to_blob}`: 98 is `login_identity` (the blob to the `tsclientlib::Identity` the gateway login is made of), 1209 is a test | H5: the gateway becomes a `Session` and takes the blob as a credential |
| `lib.rs:69` | `pub mod ts`: the public paths `voelin_core::ts::{identity, versions, TsConnector}` | H9: they move or are re-exported |
| outside the crate: `tools/voelinctl/src/{engine,identity,versions,client}.rs`, `crates/voelin-ui/src/{app,servers}.rs` and `settings_pages/bind.rs`, `crates/voelin-ui-vm/src/settings_pages/logic.rs`, `crates/voelin-core/tests/gateway.rs` | users of `voelin_core::ts::identity::*` and `ts::versions::*` (`to_blob`, `Found`, `import`, `import_new`, `discover`, `read`, `write_export`, `improve_level`, `LaunchImport`, `DEFAULT_NICKNAME`, `resolve`, `native_version`, `known_versions`, `client_metadata`) | H9: re-point to the new crate (`crates/voelin-ui*` belong to `phase5/ui-vm-2`) |
| docs: `lib.rs:8` (`ts::TsConnector`), `lib.rs:129` (`Command::ObserveGateway`: `ts::identity::to_blob`), `gateway.rs:103` (`to_blob`), `settings.rs:1138` (`import_new`); in `link/mod.rs` the module doc (`TsConnector`), `VoiceOptions::identity` (`to_blob`) and `VoiceOptions::client_version` (`ts::versions::resolve`) | intra-doc links into `ts`, which `cargo doc` with `-D warnings` resolves only while `ts` is in the crate | H9: reworded, or pointed at the new crate's docs |
A TeamSpeak connector in another crate has only
`Backends::register(Arc<dyn Connector>)`: `register_teamspeak` takes the
crate's own `TsConnector`, and `LocalConnector`, `LocalCtx`,
`LocalConnected` and `StreamPort` are crate-private. A plain `Connector`
is handed neither the `LocalCtx` (the event bus, `audio`, `stream_peer`)
nor a `StreamPort` (`Backends::connect` makes its `LocalConnected` with
`streams: None`), so its sessions have no TeamSpeak 6 streams. Streams
across the crate boundary need H2 first, or a public extension trait that
takes the place of `LocalConnector`.
*Test-only* edges, which move with the tests of each side:
`link/tests.rs` and `link/fake_link_tests.rs` (lines 30-31 of both) use
`ts::ts_session::LinkConnector` and `ts::{ConnectOptions, ServerLink}`;
the tests of `link/session_link.rs` use `ts_session::{backend_to_v1,
features_of}`; `link/tests.rs` uses the helpers
`ts::identity::{json_with_a_cut_key, assert_holds_no_piece_of}` and
`tests/session_fake.rs` builds a `tsclientlib::Identity` and runs
`Backends::default()` in one test (both from this round, with the gate's
minor).
2. **From `src/ts/` into engine-private items**: the reverse edges.
| Module of the engine | Items `src/ts/` uses |
|---|---|
| `crate::link` | `LinkCmd`, `LinkEvent`, `LinkCtx` (its `session`, `events`, `frames`, `settings`, `emit`, `done`), `Remote`, `BoxRead`, `BoxDuplex` (`ts/voice.rs`, `ts/ts_link.rs`, `ts/ts_session/driver.rs`); `LocalConnector`, `LocalCtx`, `LocalConnected`, `StreamPort`, `VERSION_PARAM`, `without_query` (`ts/ts_session/mod.rs`); `StreamEvent` (`driver.rs`) |
| `crate::stream` | `StreamCmd` (`voice.rs`, `driver.rs`), `StreamHandle`, `StreamInput` (`voice.rs`) |
| `crate::files` | `FileEntry`, `RequestId`, `TransferState`, and the functions `normalize_dir` and `join_path` (`voice.rs`, `driver.rs`) |
| `crate::offline` | `OfflineMessage`, `OfflineMessageInfo` (`voice.rs`, `driver.rs`) |
| the crate root | `Event`, `JoinFailure`, `BackendInfo`, `POKE_MESSAGE_MAX` |
| `crate::settings` | `SharedSettings`, through `LinkCtx.settings`, which `voice.rs` hands to the stream task |
| tests only | `crate::link::{Backends, VoiceOptions, connect_params}` (`ts_session/mod.rs`, `live_tests.rs`), `crate::link::media::TalkTracker` and `crate::link::project::{View, presence}` (`ts/book.rs`), `crate::settings::{SharedSettings, Settings}` and `crate::files::{Report, Sink}` (`ts/voice.rs`) |
Together with the first list this is a cycle: `voelin-core` would need
`voelin-gateway-ts` for `TsConnector` and the uid rule, and
`voelin-gateway-ts` needs `voelin-core` for every item above. So the "by
git tag" step of H9 needs **H1 and H2** (the TeamSpeak side speaks v1
through `Session`, which takes the place of `LinkCmd`, `LinkEvent`,
`LinkCtx`, `StreamPort` and the stream task's input) **or a shared
vocabulary crate** that holds the items above for both sides. Without
one of the two, only the first step, the `ts` feature of `voelin-core`,
is possible.
3. **What else keeps `tsclientlib` and `tsproto` in the tree.** The exit
check (`cargo tree -p voelin-core -e normal | grep -E 'tsclientlib|tsproto'`
empty) is not met by moving `src/ts/` alone:
- `voelin-core` itself: its four direct dependencies (`tsclientlib`,
`tsproto`, `tsproto-packets`, `tsproto-types`) leave with `src/ts/`,
but `gateway.rs` uses `tsclientlib::Identity` (`login_identity`,
`connect_watched`, `attempt`: H5) and `stream.rs` uses
`tsclientlib::ClientId` (item 4).
- Three more crates of `voelin-core`'s tree carry the dependency:
`voelin-store` (`store.rs` and `keystore.rs` take, read and check a
`tsclientlib::Identity`), `voelin-stream` (`proto.rs`, `session.rs`,
`discovery.rs`: `tsclientlib::{ClientId, InMessage, messages::c2s}` and
`tsproto_packets::packets::OutCommand`; H3 splits it) and
`voelin-gateway-proto` (`auth.rs`, `client.rs`:
`tsproto_types::crypto::EccKeyPrivP256`, the key of the gateway login;
H5). `cargo tree -p <crate> -e normal` shows it for each of the three.
- `voelin-query` and `voelin-observer` have none, so `query.rs` using
`voelin_query` is not an edge of the exit check; it goes with H5
because the query observer becomes a `Session` of a gateway daemon.
- So the exit check needs H1-H3, **H5**, a way for `voelin-store` to
handle a TeamSpeak identity without `tsclientlib`'s type, and H9.
4. **`stream.rs` must be split.** Stays with the engine: `StreamState`,
`WatchState`, `StreamFrame`, `StreamSink` and `LayerFormat` (public API),
`StreamCmd`, `OwnStreamEvent`, `kind_name`, `parse_kind` and
`parse_srtp_profiles` (`session.rs`), `media_codec` (`media.rs`) and the
re-exports of `stream_types` (`StreamInfo`, `StreamKind`, `StreamSetup`,
`ViewerInfo`, ...). Goes with the TeamSpeak 6 task: `StreamHandle`,
`StreamTask` and its helpers, `StreamInput`, the `StreamLookup` over the
gateway directory, and every use of `tsclientlib::ClientId` (the engine's
own ids are `u16`; `stream.rs` wraps them for `voelin-stream`).
5. **The engine API docs that link into `ts` move with it** (the last row of
the table of item 1): `VoiceOptions::identity` and
`Command::ObserveGateway` link `ts::identity::to_blob`,
`VoiceOptions::client_version` links `ts::versions::resolve`.
- **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` at
the pin of that task (and every release from the tag `v0.2.0`) 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. (Closed in VoelinProtocol
`v0.2.0`: a key is listed once. 17.9 has the tests that now count it.)
- **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
`Session` of a gateway daemon.
- `Backends::default()` keeps its `TsConnector` to itself: an application that
sets the myTeamSpeak account builds its registry (`Backends::empty` and
`register_teamspeak`) and starts the engine with `start_with_backends`.
The account goes through `AccountAgent` with H4.
- Documents that still name the old paths and are not this slice's to change:
the comment of `voelin-store` (`voelin_core::identity`, a crate other
branches own) and `docs/research/ui-review.md` (research notes with line
numbers of `voice.rs`).
### 17.7 The round after the review of slice 3
The review of slice 3 left four minors. This round closes them, one commit
each, and brings the branch onto `main` (`ad20979`), so that the tree the gate
judges is the tree that will be merged. No history was rewritten.
| Commit | What |
|---|---|
| `e13d401` | Merge of `main` (`ad20979`, 13 commits: the merge of `phase5/ui-vm`, the toolkit-free `crates/voelin-ui-vm` and the logic/bind split of `crates/voelin-ui`), see below. |
| `87926e9` | Minor 1. `link::connect::credential` refuses a TeamSpeak `IdentityBlob` whose JSON is empty (or only white space) with `SessionError::Protocol("the TeamSpeak identity cannot be read: it is empty")`, before any connector is asked: sent as it was, it was the empty `Credential::Foreign` blob that the TeamSpeak connector reads as "make an identity up", which only `identity: None` may ask for. Two tests: `link::connect::tests::a_teamspeak_identity_without_json_is_refused` (`""` and `" \n\t"` are refused, none is still the empty blob) and, through the engine on the fake host, `a_teamspeak_identity_without_json_is_refused_and_no_session_is_made` (`ConnectVoice` ends in `Disconnected` with the error `voice: the TeamSpeak identity cannot be read: it is empty`; the connector's `connects()` is empty and `last_session()` is `None`; a connect without identity works afterwards). Both fail with the check switched off. The comment of `ts::identity::to_blob` ("a blob with no JSON is refused when it is used, in words") is unchanged and holds on both paths now: the gateway's `from_blob` always refused it (`ObserveGateway` ends with its reason, without a login). |
| `f0d20cc` | Minor 2. `QueryLogin.transport` has its doc comment, the only public field of the type without one. |
| `76a884a` | Minor 3. 4.1 (the `TsConnector` owns the myTeamSpeak account since `a451f02`; it is not registered "with the engine's watches"), the 16.1 table (`src/ts/ts_session/live_tests.rs`), the section 10 acceptance `rg` (given as run from the repository root, `--glob '!**/ts/**'`, and the glob it takes from `crates/voelin-core/src`), the module documentation of `ts/voice.rs` (it linked `crate::TsLink`, which is `ts::ts_link::TsLink` and crate-private), `link/tests.rs` (`ts/ts_session/driver.rs`), the comment on `IdentityOrigin::Imported` in `voelin-store` (`voelin_core::ts::identity`; one word, the crate is otherwise untouched) and `docs/research/ui-review.md` (`ts/voice.rs`; the line number of the channel subscription, which has moved twice since the note was written, is replaced by where the code is). One more of the same kind that the list did not name: `docs/audio.md` named `voelin-core/src/link.rs` for `LinkCmd::Audio`, which is `link/mod.rs`. |
| `f1df886` | Minor 4. `ts::voice::Voice::command` answered `LinkCmd::Download`, `Upload` and `CancelTransfer` with `anyhow::bail!`. The commit message and the slice 3 review said that this ends the whole TeamSpeak connection; it does not: the `Input::Cmd` arm of `ts/voice.rs` catches the error and sends it as `LinkEvent::Error`, which the driver turns into an error notice, and only an `Input::Item` error breaks the loop. What really happened before the change was one spurious error notice and a transfer whose `report` was never answered, so the transfer hung (the review of this round corrected the record). `Download` and `Upload` now answer their `report` with `TransferState::Failed("this link does not run transfers itself")` and the connection goes on; `CancelTransfer` has no report and nothing to cancel, and is logged at debug. (Making the variants unrepresentable for the inner link would mean a second command enum next to `LinkCmd`; the match arm is smaller.) Test: `ts::voice::account_tests::a_transfer_command_fails_the_transfer_and_not_the_connection` gives an unconnected `Voice` the three commands: each returns `Ok`, the two reports see exactly the `Failed`, nothing is pending. |
**The merge.** Three conflicts:
- `crates/voelin-ui/src/settings_pages.rs` (modify/delete): `main` split it
into `settings_pages/{mod,bind}.rs` and `voelin-ui-vm`'s
`settings_pages/logic.rs`; this branch had only changed its six
`voelin_core::identity::` paths. The file is deleted, and the six paths are
`voelin_core::ts::identity::` where the code now is (five in `bind.rs`,
`Found` in `logic.rs`; the import moves in its group, as `rustfmt` orders
it).
- `crates/voelin-ui/src/identities.rs`: the module comment, which names
`voelin_core::ts::identity::import_new` (this branch) and `settings_pages/`
(`main`).
- `docs/architecture.md`: the `voelin-core` row of this branch with the
`voelin-ui-vm` and `voelin-ui` rows of `main`.
Not conflicts, but needed to compile: `voelin-ui-vm` named the in-tree
`voelin-model` by path, which `fb8e6b6` (an early commit of the branch) had taken out of the
workspace for the protocol repository's (`voelin-model = { workspace = true }`
now). Nothing else of `voelin-ui-vm` or of `voelin-ui`'s new `bind` modules
touched a type of this slice: `VoiceOptions`, `ObserveGateway`, `ObserveQuery`
and the removed commands are only built in `voelin-ui/src/servers.rs`, which
merged on its own and compiles (17.3's list is absorbed with these two
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 of the three protocol crates that the branch
pinned (since moved by task 34, and then to the tag `v0.2.0`, 17.9), 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.
**What ran.** Same environment as 17.5, taken again: the toolchains from the
store paths in front of `PATH` in a `nix shell` of `gcc cmake gnumake
pkg-config jq` and the `.dev` outputs of `alsa-lib openssl libvpx dav1d
pipewire fontconfig freetype libxkbcommon expat`, with `PKG_CONFIG_PATH`
(`.dev` outputs), `LD_LIBRARY_PATH` (the `.out`, `.lib` and `.dev` outputs of
those: the test binary of `voelin-ui` needs `libfontconfig.so.1`),
`LIBCLANG_PATH` and `BINDGEN_EXTRA_CLANG_ARGS` set by hand. With that,
`cargo check --workspace --all-targets --locked` passes on 1.94 at the merge
and at the head, `voelin-ui`, `voelin-ui-vm`, `voelinctl` and `voelin-android`
included.
| Check | Result |
|---|---|
| `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; 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*`. |
| `scripts/notices.sh --check` (cargo-about 0.9.2, built under the scratch directory) | up to date at the merge and at the head; `Cargo.lock` did not change after the merge. |
| `scripts/it-smoke.sh ts3 ts6` | Before (`6a08147`, the head of slice 3) and after (`f1df886`): fresh compose stacks (`down -v`, `up -d`, project `voelin-seam-merge`, state directory under the scratch directory) and the same result: every per-server scenario passes, the TeamSpeak session module stage 12 passed and 2 ignored (16.34 s before, 16.39 s after), the engine stage 5 passed and 1 failed at `live.rs:396` (`ts6_banners`, the baseline's failure, 17.5). The two outputs, 99 lines each (the compose lines left out), are equal line by line with digits, base64 runs and uuids masked, but for the random uid of the streamer in the stream-directory line and the name of the state directory in two paths. |
| The live binaries by hand, serially, `--features media-desktop`, on the same servers | Before and after alike: `ts_session::live_tests --include-ignored` 14 of 14 (46.42 s, 46.43 s), `live` 6 of 6 (73.40 s, 73.39 s), `media_live` 2, `stream_live` 3, `voice_features` 3, `voelin-stream`'s `live_ts6` 1. |
The last bullet of 17.6 (documents that still name the old paths) is closed by
`76a884a`; the others stand.
### 17.8 The round after the gate (`phase4/seam-followups`)
The Opus gate of the merge (`c60acf9`) accepted it with one minor and notes for
H9. This round, on `phase4/seam-followups` from `c60acf9`, closes the minor,
writes the notes down (17.6) and deals with the five tests that failed on
their own on `main`. No history was rewritten. The `mao-*` agents were not
registered in the session, so a general-purpose agent played
`mao-implementer`, attempt 1.
| Commit | What |
|---|---|
| `a856f90` | The gate's minor. `ts::identity::from_json` is the classification `from_blob` had (malformed, cut short, not an identity, unreadable, with line and column, never the value), taking the JSON text; `from_blob` and `ts_session::inner_options` both use it. `inner_options` had put the `serde_json` error into the text, and `tsproto`'s key reader reports a key that does not import as `invalid_value(Unexpected::Str(key), ..)`, so the key reached `LinkEvent::Disconnected(Some(text))`, `Event::Error` and the status line. A credential that is not UTF-8 is "it is not text". Four tests, each with a key that lost its last two characters and none holding 8 characters in a row of the key: `identity::tests` (which also asserts that the reader's own message does quote it), `ts_session::tests` (`inner_options`), `link::tests` (the `Disconnected` text through `SessionLink` and the real connector) and `session_fake` (`ConnectVoice` through the engine with `Backends::default()`: the `Disconnected` state, the `Error` event and every event after it). The three connector-side ones fail with the `serde_json` text put back. |
| `563482d` | `VoiceOptions::nickname` and `server_password` have their docs; `Backends::set_account` says that no connector reads `ConnectParams.account` yet and that H4 moves the myTeamSpeak proof to it. |
| `96ff0e0` | The edge list of 17.6, and the H9 row of 11.2 pointing to it. |
| `9254e08` | `identity::tests::improve_level_keeps_the_key`. |
| `0d67dd7` | `voice_features::contacts_are_kept_in_the_database`. |
| `4be37e1` | `session::banner_tests::a_failing_banner_is_logged_once_with_its_address`, through `web::tests::info_lines`. |
| `e614a1c` | `discover::tests::without_records_the_gateway_itself_is_asked`. |
| `a90bb70` | `web::tests::pictures_go_through_the_proxy_named_for_each_hop`. |
| `c35bbb5` | `voelin-platform`'s `proxy::the_portal_names_the_proxy`. |
**The five flakes: all fixed, none recorded as known.** Two of the fixes are
rewrites of a test helper and a test, not one-line edits.
- `improve_level_keeps_the_key`: a fresh `Identity::create()` stops at the first
counter of level 8 or more and about one in 32 has 13 already, which
`improve_level` returns as it is. The test asks for three levels above what
its identity has. 8 failures in 300 runs of the single test before, 0 in 300
after.
- `contacts_are_kept_in_the_database`: dropping an `Engine` does not close the
history database. The engine task ends later, the history writer is joined
there, and closing the connection checkpoints the write-ahead log under an
exclusive lock with fsyncs; the second `History::open` waits for that lock
for the 5 s busy timeout only and fails with `DatabaseBusy` when a loaded
disk makes the close slower. A connection was still open (the `-wal` file
still there) in 23 of 24 instrumented runs, and 10 of those 24 (eight at a
time on a loaded machine) failed. The test now waits for the `-wal` file to
go (SQLite deletes it when the last connection closes) before it reopens.
With every fsync of the test process delayed by 6 s (`strace -f -e
inject=fsync,fdatasync:delay_enter=6000000`) the old test fails every time at
the reopen, and the new one passes.
- `a_failing_banner_is_logged_once_with_its_address` (`lines == []`):
`web::tests::info_lines` read the log with `tracing::subscriber::with_default`.
While that scoped subscriber is the only one alive, `tracing-core` registers
a callsite that another test's thread meets first against that thread's own
default (none) and the callsite stays disabled for every thread
(`callsite::Dispatchers::rebuilder`, `has_just_one`). Several tests of
`banner_tests` reach the same callsite through `image_finished`. The helper
now installs one recording subscriber as the global default the first time
and records into a buffer per thread. A new test (`info_lines_see_a_callsite_
another_thread_met_first`) fails with the old helper (`lines == []`, the
failure that was seen) and passes with the new one. The old helper failed 1 of
300 runs of `banner_tests`, the new one 0 of 600. The failure of the whole
suite did not occur in the twenty full runs below, so the evidence for this
fix is the mechanism, the new test and these rates.
- The two `localhost` tests fail where `localhost` resolves to `::1` only (the
servers of the tests listen on 127.0.0.1). The discovery test's `probing`
helper and the test SOCKS proxy dial `localhost` at 127.0.0.1; what the tests
check (the name the gateway is asked at, the name the proxy is given) is
unchanged.
- `the_portal_names_the_proxy` did not need `dbus-run-session` only: with a
session bus, on the desktop's or on a private one made by plain
`dbus-run-session`, it failed here three times out of three at "the portal
leaves the bus", because the bus can start the real `xdg-desktop-portal` by
name, which the first call after the stand-in has left does, and the real
one answers instead of the "missing for a minute" the test expects. The test
now runs itself again under `dbus-run-session` with a bus configuration of
its own, a session bus without service directories. Without
`dbus-run-session`, or when the bus does not come up, it prints "skipped,
nothing was checked" and the reason and passes. On the bus with the default
services the same test still fails (checked by hand).
**What ran.** The environment of 17.7, taken again: `nix shell` of `gcc cmake
gnumake pkg-config jq` and the `.dev` outputs of `alsa-lib openssl libvpx dav1d
pipewire fontconfig freetype libxkbcommon expat`, with `PKG_CONFIG_PATH` (the
`.dev` outputs), `LIBCLANG_PATH`, `BINDGEN_EXTRA_CLANG_ARGS` (`-isystem` the
`glibc.dev` headers: `libspa-sys` fails without) and, to run the binaries it
builds, `LD_LIBRARY_PATH` (the `.out` outputs of those: `libvpx.so.12`) set by
hand, and the 1.94 and nightly toolchains from their store paths in front of
`PATH`. The `dev rust-nightly` shell does not build here (`cargo-llvm-cov`).
With that, `cargo check --workspace --all-targets --locked` passes on 1.94, the
`voelin-ui`, `voelin-ui-vm`, `voelinctl`, `voelin-gateway` and `voelin-android`
targets included.
| Check | Result |
|---|---|
| `cargo fmt $(scripts/own-crates.sh) --check` | 1.94: clean at the head and at each of the nine commits, checked out detached one by one. `cargo fmt --all --check` as such is not clean at `c60acf9` on any toolchain: it includes the vendored `crates/proto`, which formats with upstream's nightly configuration, and the nightly `rustfmt` also reformats own files that 1.94's leaves alone (the CI runs the form above). |
| `cargo clippy -p voelin-core -p voelin-platform --all-targets --locked --no-deps -- -D warnings` | 1.94: clean at each of the nine commits, checked out detached one by one. |
| `cargo test -p voelin-core --locked --lib`, ten times in a row, no exclusions | Nightly: ten runs, each 252 passed, 2 ignored. 1.94: the same ten times. (The baseline of 17.5 and 17.7 had two failures in each run and needed `--skip`.) |
| `cargo test -p voelin-core --locked`, once | Both toolchains: green. Integration tests: `gateway` 9, `live` 6 and `stream_live` 3 (they skip without `VOELIN_LIVE`), `session_backends` 2, `session_fake` 20 passed and 2 ignored, `settings` 1, `voice_features` 3. |
| `cargo test -p voelin-platform --locked` | Both toolchains: 24 lib tests, `crash` 3, `proxy` 1 (on its own bus), `x11` 1 (skipped without a display), 2 doc tests. |
| `RUSTDOCFLAGS=-D warnings cargo doc --no-deps -p voelin-core --locked` | 1.94 and nightly: clean. |
| `Cargo.lock`, `THIRD_PARTY_NOTICES.md` | Unchanged: `git diff c60acf9 -- Cargo.lock Cargo.toml` is empty, so there was nothing to regenerate. |
| `scripts/it-smoke.sh ts3 ts6`, on `c60acf9` (before) and at the head (after) | The stack of `VoelinGateWay/dev/docker-compose.yml` as a compose project of its own (`voelin-seam-followups`), the state directory under the scratch directory. On a fresh stack each (`down -v`, `up -d` before each): both pass every per-server scenario of ts3 and ts6 (connect and tree, server and channel chat, voice tone, invisible presence, relay, gateway, history, pins and reactions, the engine's voice features, the TeamSpeak 6 streams), the TeamSpeak session module stage (12 passed, 2 ignored; 16.38 s before, 16.73 s after) and fail in the same place, the engine stage at `ts6_banners` (`live.rs:396`, 5 passed, 1 failed), the failure 17.5 and 17.7 record. Two more runs on the first stack, which was no longer fresh (before, then after), gave the same: the outputs have 100 lines each and differ only in ids, counters, tone ratios and the number of tests filtered out of the module stage (236 before, 240 after: this round's four unit tests). The very first run, on `c60acf9` on the first stack, stopped earlier, at the first gateway request of the admin identity of ts3 (`config_set` not answered, observe stayed `Connecting`); it did not repeat on the fresh stack at `c60acf9`, nor in any later run, and was not chased. |
### 17.9 The pin moves to the tag `v0.2.0` (`phase4/protocol-pin-v0.2.0`)
VoelinProtocol released `v0.2.0` on 2026-10-27 (the tag points at `a45c154`;
its `README.md`, "Releases", says how a consumer pins, and its `CHANGELOG.md`,
"For consumers", what a consumer at the pin of task 34 meets). This round, on
`phase4/protocol-pin-v0.2.0` from `0d32ac2`, moves the three entries of
`[workspace.dependencies]` (`voelin-identity`, `voelin-proto`, `voelin-model`)
from that rev to `tag = "v0.2.0"`, and the `voelin-model` of `spikes/gpui` with
them. The `mao-*` agents were not registered in the session, so a
general-purpose agent played `mao-implementer`, attempt 1. No history was
rewritten.
| Commit | What |
|---|---|
| `dccedf2` | `spikes/gpui/Cargo.lock` loses three dependency edges (tokio's `signal-hook-registry` and `tracing`, zbus's `tokio`) and nothing else. It was stale on `main` since `ed49c28` (`voelin-platform`: notify-rust's `z` instead of `z-with-tokio`, which updated the root lock and not this one): `cargo build --locked` in `spikes/gpui` failed there with "cannot update the lock file", before the pin was touched. Separate from the pin so that the pin's own diff to the lock is the three packages. |
| `6938dbe` | The pin. Both `Cargo.toml` files, both locks, the two tests of the sign-out, and the two strings that named the old rev. |
| the commit of this section | The CHANGELOG line, `docs/building.md`, `docs/ci.md`, `docs/architecture.md`, and the four sentences of this file that named the old rev (the rev is not written in the tree any more; it is in the history of `Cargo.toml`). |
**The lock.** `cargo update -p voelin-identity -p voelin-proto -p voelin-model`
also moved ten edges of the lock that have nothing to do with the protocol
(`windows-sys` 0.61.2 to 0.52.0, 0.48.0 and 0.45.0 in seven crates, `itertools`
0.14.0 to 0.11.0, `base64` 0.23.1 to 0.22.1, `getrandom` 0.4.3 to 0.3.4; the
message of `6938dbe` says eleven, ten is right). The manifests of the three
crates are the same at both revisions but for `voelin-model`'s version (0.1.0
to 0.2.0), so the lock was edited by hand instead: the `source` of the three
packages and that one version, in each of the two locks, and
`cargo metadata --locked` accepts both. Each lock has one revision of each
crate, and `cargo tree -d` lists no `voelin-*` package twice, in either
workspace. The lock's set of third-party packages is the same (only the three
protocol packages changed, and `voelin-model`'s version), and
`THIRD_PARTY_NOTICES.md` lists third-party packages, so
`scripts/notices.sh --check` is clean without a regeneration.
**What "For consumers" meant here.**
- `KeyStore::sign_out` lists a device key once. The client never had a test
that failed on the double listing: `a_device_key_that_carries_a_binding_is_unbound_and_keeps_the_rest_of_its_row`
(the row of the device key carries a device-only binding, the one case in
which the trait listed the key twice, see 17.6) asked `contains`. It counts
now: one entry in `unbound` and none in `removed`. A new test,
`a_device_key_that_carries_a_binding_is_listed_once_as_deleted_when_it_is_forgotten`,
does the same for `Forget` (one entry in `removed`, none in `unbound`; the
key used to be in both lists). Both fail with the pin at the old rev (checked
by putting `Cargo.toml` and `Cargo.lock` of `main` back for the run: the
first sees the key twice in `unbound`, the second once in each list) and pass
at the tag. The other sign-out tests passed unchanged.
- `Debug` of `Hello`, `Welcome`, `Server`, `Channel`, `Member` and the other
messages that `voelin_proto::redact::REDACTED` lists prints `<redacted>` for
their secrets. No code or test of the client formats one of those messages
with `{:?}` and looks at the text: the only `Debug` text a test inspects is
that of the engine's events in
`a_teamspeak_identity_that_cannot_be_read_is_refused_without_the_key`, which
looks for pieces of a TeamSpeak key. Nothing to adapt; the full test run
below is the evidence.
- Every crate is at 0.2.0, `voelin-model` from 0.1.0: visible in the lock only.
The conformance suite still has 17 cases (`fake_tests.rs` and `live_tests.rs`
name the tag where they named the rev).
- The rest of the list is additive and in crates the client does not use.
**What did not change.** The deploy key, `.gitea/known_hosts`, the CI step that
runs `git ls-remote` on the repository, and `deny.toml` (`allow-git` is the
URL): Cargo fetches the tag over the same SSH access as it fetched the commit
(`git ls-remote` shows the tag as an annotated one, `v0.2.0^{}` being
`a45c154`).
**What ran.** The toolchain of `rust-toolchain.toml` (1.95.0, from the pinned
fenix of `spikes/gpui/shell.sh`), on a machine at a load average of about 40.
| Check | Result |
|---|---|
| `cargo fmt $(scripts/own-crates.sh) -- --check` | clean |
| `cargo clippy $(scripts/own-crates.sh) --all-targets --no-deps --locked -- -D warnings` | clean |
| `cargo test --workspace --locked --no-fail-fast`, under Xvfb with `VOELIN_X11_TEST_DISPLAY` | 1,293 passed, 0 failed, 21 ignored. `voelin-store`: 31 unit tests, `identity_text` 4, `keystore` 57 (56 and the new one); `voelin-core`: 273 and 2 ignored, `session_fake` 20 and 2 ignored, `session_backends` 2; the registry's conformance suite passes 17 of 17 |
| `cargo deny --locked --workspace check` (cargo-deny 0.20.2) | advisories, bans, licenses and sources ok; the two warnings, yanked `crypto-bigint` and `clipboard-win`, are of packages this change does not touch |
| `scripts/notices.sh --check` | clean, no regeneration |
| `spikes/gpui`: `cargo build --locked` and `cargo clippy --locked --all-targets -- -D warnings` (`shell.sh`, 1.95) | both clean |