Voice 11: fluxer-core::voice DM calls and status selector (#72) #116
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "voice-11-core-calls-status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this builds
fluxer-core::voice::calls:app.voice.calls(Calls { by_channel: HashMap<Snowflake, Call { ringing, voice_states, message_id, region }>, incoming, not_ringable }), a port of the fork'sCallState/CallStateMachine,CallInitiator,CallCommandsand the ringing rule ofIncomingCallManager.CALL_CREATE/CALL_UPDATE/CALL_DELETEkeep the calls; a liveREADYand logging out forget them (the gateway announces existing calls again on session start).incoming= the longest-ringing call that rings me, that I did not start and whose room I am not in. While there is one and the connection isIdle/Failed,AudioCommand::PlayChime(Chime::IncomingCall)is emitted at once and again everyRING_PERIOD(4572 ms, the length of the original's looped ring) on a timer, until answered, declined,CALL_DELETEor the server stops ringing me.UserAction::{StartCall, AcceptCall, DeclineCall, EndCall}(channel_id);ApiRequest::{CallEligibility, Ring, StopRinging, EndCall}withApiResult::{CallEligibility, RingOk, StopRingingOk, EndCallOk}. Start = eligibility check, then op 4 withguild_id: null, thenRingto the channel's other recipients once the room is joined. Accept = op 4 withguild_id: null. Decline =StopRingingfor everyone (the fork'srejectCall). End =StopRingingfor those I rang who have not answered, then leave.selectors::voice_status(&App) -> Option<VoiceStatusPayload>: a port ofDesktopVoiceStatusBridge.ts(connection state mapping, one participant per user with activity OR-ed across devices and mute/deafen from the local connection, self first then display name then id).Noneonly before login.VoiceStatus*types moved fromfluxer-status-api(tokio, tokio-tungstenite) tofluxer_proto::status, unchanged, and are re-exported fromfluxer-status-api(the plan's "otherwise" branch). Own commit.fixtures/status/voice_status_{connected,disconnected}.json: wholevoice_statusframes with the fork's member names, order and types (DesktopBridgeTypes.ts,local-status-api.md).How it was tested
crates/fluxer-core/tests/calls.rs(20 tests): the four named ones (call_create_with_me_ringing_sets_incoming,accept_joins_with_null_guild,decline_stops_ringing,call_delete_clears) plus the start/ring/end flows, the ring timer (repeat, stale timers, no ring while in voice, queue of two calls), failed requests,READY, logout and unknown channels.crates/fluxer-core/tests/voice_status.rs(7 tests):status_payload_disconnected_shape,status_payload_merges_devices_and_sorts,status_payload_json_matches_fork_fixture(value equality with the fixture, member order of the three objects, and the fixture reading back as the typed payload), plus the connection-state mapping, sorting and a DM call.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciis green locally.Deviations from the plan
voice/mod.rs,app.rs,lib.rs,selectors/mod.rs(wiring);voice/connection.rs(joinis nowpub(super)andLeaveVoicegoes through a newpub(super) fn leave, so the calls reducer can use both; no behaviour change);apps/fluxer/src/runtime.rs(the four newApiRequests mapped to the existingfluxer-apimethods, becauseperformmatches exhaustively);fluxer-protoandfluxer-status-apifor the type move.fluxer-core/Cargo.tomldid not need to change.ApiRequest::EndCallexists but the store never emits it: the fork's server answersPOST /call/endwith 204 without doing anything and the fork's client never sends it. Hanging up is the fork'sleaveCall.Calls::not_ringable(the original's "call not ringable" dialog) and the eligibility'ssilentflag (join without ringing).speakingin the status payload isfalseuntil Voice 8 is onvoice;avatarUrlis the user's own avatar ornull. All three are in follow-up #115.CALL_UPDATEreplacesringingandvoice_states(the proto type cannot tell a missing list from an empty one) and keepsmessage_id/regionwhen the update leaves them out.Stacked on: voice-7-core-voice-connection
Closes #72
🤖 Generated with Claude Code
The ports of Voice spec §5.3 (voice::port), Effect::{Voice, Audio}, CoreEvent::{Voice, Audio, GatewayError}, the connection machine (VoiceConnection, VoiceFailure) with join, leave, move, kick, resume and token refresh, the user's mute and deafen switches (LocalVoiceState) saved in a new [voice] section of the local settings, and effective_mute / effective_deaf. fluxer-platform reads and writes the new settings section; apps/fluxer drops the two new effects until the voice runtime (Voice 14) exists. Refs #68 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>Independent review: Voice 11 (core-calls-status) at
94cdafdReviewed
6962d17..94cdafdcold, against the plan's Task 11, facts §9 and the fork (CallCommands.ts,CallInitiator.ts,IncomingCallManager.tsx,DesktopVoiceStatusBridge.ts,VoiceParticipantDisplayState.ts).1. Tests named by the plan - all seven exist and assert what the plan says:
call_create_with_me_ringing_sets_incoming,accept_joins_with_null_guild(op 4 withguild_id: null,connection_id: null),decline_stops_ringing,call_delete_clears,status_payload_disconnected_shape,status_payload_merges_devices_and_sorts,status_payload_json_matches_fork_fixture(value equality, member order, round trip). 20 + 7 tests pass.2. Interfaces -
Calls { by_channel, incoming },Call { ringing, voice_states, message_id, region },UserAction::{StartCall, AcceptCall, DeclineCall, EndCall}(Snowflake),ApiRequest::{CallEligibility, Ring, StopRinging, EndCall},selectors::voice_status(&App) -> Option<VoiceStatusPayload>are present as written.VoiceStatus*moved unchanged tofluxer_proto::statusand are still re-exported fromfluxer-status-api(the plan's "otherwise" branch; correct, that crate depends on tokio/tungstenite).3. Invariants -
fluxer-core/Cargo.tomlunchanged, no I/O; no indexing/unwrap on server data incalls.rsorvoice_status.rs(unknown channels, users and calls are covered by tests); no secrets in code or fixtures.connection.rschange is visibility plus an extractedleave, no behaviour change.4. Review Focus - no item belongs to this task.
5. CI -
FLUXER_SCREENSHOT_TESTS=1 cargo xtask ciin a fresh worktree and target dir: all steps passed. Remote runners not checked.Findings
voice/calls.rssettle_calls: when the ring stops, the scheduled timer is only forgotten, and the port has no stop-chime. A call that stops and rings again within 4.5 s (or a second call arriving right after a decline) starts a new round over the tail of the old one. Same root as the known "round runs to its end" deviation; keep it in #115.selectors/voice_status.rs: the fork also shows the local user as muted when they lack the speak permission in the channel (isParticipantVoicePermissionMuted:suppress || (isCurrentUser && speak denied)); the port only hassuppress. Not listed among the documented differences in the doc comment.selectors/voice_status.rssort: lowercase code-point compare instead oflocaleCompare; differs for accented and non-Latin names only. Documented; fine for companion apps.voice/calls.rs:Calls::not_ringablehas no dismiss action andring_requestis never cleared onRingOk(harmless: effect ids are unique). Voice 22 will need the dismiss.ApiRequest::EndCall/ApiResult::EndCallOkare never emitted. Agreed with the reasoning (fork client never sends it); kept because the Interfaces block names it.Checked and found faithful to the fork:
DeclineCall=rejectCall(StopRinging with no recipients, leave only if in that call, call stays joinable);EndCall=leaveCall(initiatedRingingRecipients, including "everyone" when this client rang nobody); ring only afterConnectedin the call's room;NEW_CONVERSATIONS_LIMITEDleaves the call; incoming = ringing for me, not initiated by me, not the call I am in; no ring while in or joining voice; per-user merge order is deterministic (connections ordered by id).Verdict: APPROVE - 0 blocking, 5 minor. Local ci green.