Shell 15: core-status-payload-gaps (#807) #859

Closed
charles wants to merge 0 commits from shell-15-core-status-payload-gaps into shell
Owner

Stacked on: shell-6-core-shell-ports-settings (already merged into shell; the merge was a no-op)

What this builds (Desktop shell plan, Task 15; spec §11, #734)

crates/fluxer-core only.

  • selectors::voice_status: selfStream is the own share once the room published it (what op 4 says as self_stream, LocalVoiceState.getSelfStream), and the local connection's participant shows streaming from it at once, before the server echoes it (resolveVoiceParticipantDisplayState: remoteStreaming || (isLocalConnection && localSelfStream), VoiceParticipantDisplayState.ts:79-88).
  • Default avatars: new voice_status_with(&app, Option<&DefaultAvatarBase>); DefaultAvatarBase::new(addr: SocketAddr, token) builds http://<addr>/avatars/default/<index>.png?token=… (token URL-encoded, Debug redacts it). Index = default_avatar_index(user id) for users without an avatar and for AVATAR_UNSET guild members (getGuildMemberDisplayAvatarURL → getUserAvatarURL({id, avatar: null})). voice_status(&app) is voice_status_with(&app, None), unchanged for the runtime.
  • shell::companion: CompanionOp::{SetMute(bool), SetDeaf(bool), ToggleMute, ToggleDeaf, Disconnect}; companion_action(&app, op) -> Option<UserAction> → ToggleSelfMute / ToggleSelfDeaf / LeaveVoice only while ShellSettings::status_api_control is on; SetMute/SetDeaf return None when the switch already is as asked; Disconnect returns None while idle. companion_section(&app) -> Option<CompanionSection { enabled, control, port_warning }>, CONTROL_SWITCH, port_warning(port).
  • Port warning state: ShellEvent::StatusApiPortInUse(Option<u16>) (appended) → ShellState::status_api_port_in_use; shown only while the API is on, as the original ({settings.enabled && !settings.available && …}).

Strings: "The status API can't start because another program is using port {port}." (copied from DesktopStatusApiSection.tsx, PORT_IN_USE_DESCRIPTOR); "Let companion apps control your voice" (new, spec §11).

Tests

  • crates/fluxer-core/tests/voice_status.rs: self_stream_follows_local_share, local_camera_and_stream_before_echo, default_avatar_gets_local_url.
  • crates/fluxer-core/tests/shell_companion.rs: control_ops_only_when_enabled, set_mute_is_idempotent, port_warning_shown_when_bind_failed.
  • Seen failing (compile errors) at d61a8532, passing after; FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No display tests involved.

Deviations from the plan

  • selfVideo stays false and the camera comes only from the voice states: this client has no camera switch yet (sub-project 5), so local_camera_and_stream_before_echo checks the stream before the echo and the camera from the echo.
  • No AvatarRef type: the selector takes the base (DefaultAvatarBase: address + token) as a parameter and writes the URL itself, so the payload type stays fluxer_proto::status. Task 31/33 pass Some(&base) once the server serves the images.
  • The bind failure reaches core as a new appended ShellEvent::StatusApiPortInUse(Option<u16>) (plus one ShellState field and one reducer arm in shell/mod.rs), because companion_section(app) has to see it in App. The runtime sending it is Task 31/33's.
  • companion_action is a pure mapping the runtime applies, rather than a reducer arm, so the ops go through exactly the actions the tray menu uses.

Closes #807

🤖 Generated with Claude Code

https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K

Stacked on: shell-6-core-shell-ports-settings (already merged into shell; the merge was a no-op) ## What this builds (Desktop shell plan, Task 15; spec §11, #734) `crates/fluxer-core` only. - `selectors::voice_status`: `selfStream` is the own share once the room published it (what op 4 says as `self_stream`, `LocalVoiceState.getSelfStream`), and the local connection's participant shows `streaming` from it at once, before the server echoes it (`resolveVoiceParticipantDisplayState`: `remoteStreaming || (isLocalConnection && localSelfStream)`, `VoiceParticipantDisplayState.ts:79-88`). - Default avatars: new `voice_status_with(&app, Option<&DefaultAvatarBase>)`; `DefaultAvatarBase::new(addr: SocketAddr, token)` builds `http://<addr>/avatars/default/<index>.png?token=…` (token URL-encoded, `Debug` redacts it). Index = `default_avatar_index(user id)` for users without an avatar and for `AVATAR_UNSET` guild members (`getGuildMemberDisplayAvatarURL` → `getUserAvatarURL({id, avatar: null})`). `voice_status(&app)` is `voice_status_with(&app, None)`, unchanged for the runtime. - `shell::companion`: `CompanionOp::{SetMute(bool), SetDeaf(bool), ToggleMute, ToggleDeaf, Disconnect}`; `companion_action(&app, op) -> Option<UserAction>` → `ToggleSelfMute` / `ToggleSelfDeaf` / `LeaveVoice` only while `ShellSettings::status_api_control` is on; `SetMute`/`SetDeaf` return `None` when the switch already is as asked; `Disconnect` returns `None` while idle. `companion_section(&app) -> Option<CompanionSection { enabled, control, port_warning }>`, `CONTROL_SWITCH`, `port_warning(port)`. - Port warning state: `ShellEvent::StatusApiPortInUse(Option<u16>)` (appended) → `ShellState::status_api_port_in_use`; shown only while the API is on, as the original (`{settings.enabled && !settings.available && …}`). Strings: "The status API can't start because another program is using port {port}." (copied from `DesktopStatusApiSection.tsx`, `PORT_IN_USE_DESCRIPTOR`); "Let companion apps control your voice" (new, spec §11). ## Tests - `crates/fluxer-core/tests/voice_status.rs`: `self_stream_follows_local_share`, `local_camera_and_stream_before_echo`, `default_avatar_gets_local_url`. - `crates/fluxer-core/tests/shell_companion.rs`: `control_ops_only_when_enabled`, `set_mute_is_idempotent`, `port_warning_shown_when_bind_failed`. - Seen failing (compile errors) at d61a8532, passing after; `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No display tests involved. ## Deviations from the plan - `selfVideo` stays false and the camera comes only from the voice states: this client has no camera switch yet (sub-project 5), so `local_camera_and_stream_before_echo` checks the stream before the echo and the camera from the echo. - No `AvatarRef` type: the selector takes the base (`DefaultAvatarBase`: address + token) as a parameter and writes the URL itself, so the payload type stays `fluxer_proto::status`. Task 31/33 pass `Some(&base)` once the server serves the images. - The bind failure reaches core as a new appended `ShellEvent::StatusApiPortInUse(Option<u16>)` (plus one `ShellState` field and one reducer arm in `shell/mod.rs`), because `companion_section(app)` has to see it in `App`. The runtime sending it is Task 31/33's. - `companion_action` is a pure mapping the runtime applies, rather than a reducer arm, so the ops go through exactly the actions the tray menu uses. Closes #807 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Refs #807

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
selfStream and the local participant's streaming follow the own published
share before the server echoes it (DesktopVoiceStatusBridge.ts:65-144,
VoiceParticipantDisplayState.ts:79-88); default avatars become the status
API's loopback URL through voice_status_with and DefaultAvatarBase.
shell::companion maps control ops to the tray's actions only while
status_api_control is on, and gives the Companion apps section its control
switch and the port warning of DesktopStatusApiSection.tsx.

Refs #807

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0161qMQMsCyJhjYw4gqa6e4K
Author
Owner

Independent review: Shell 15 (core status payload gaps and companion control)

Reviewed the diff 158c90dd..origin/shell-15-core-status-payload-gaps (c25cee09) cold.

Tests named by the plan: all six exist and pass: self_stream_follows_local_share, local_camera_and_stream_before_echo, default_avatar_gets_local_url (in tests/voice_status.rs), and control_ops_only_when_enabled, set_mute_is_idempotent, port_warning_shown_when_bind_failed (in tests/shell_companion.rs). They assert the spec's values: the URL shape http://127.0.0.1:<port>/avatars/default/<i>.png?token=…, the new switch label, and the original's port string.

Parity spot-checks against the fork:

  • streaming = state.self_stream || (is_local && local_stream) matches VoiceParticipantDisplayState.ts:88 (remoteStreaming || (isLocalConnection && localSelfStream)). is_local is the same user and the same connection, as in DesktopVoiceStatusBridge.ts.
  • The port warning string matches DesktopStatusApiSection.tsx:54 (PORT_IN_USE_DESCRIPTOR) word for word. As in the original (:117), it shows only while the API is enabled.
  • A member with AVATAR_UNSET falls back to default_avatar_index(user.id), as getUserAvatarURL({id, avatar:null}) does.

Invariants: fluxer-core does no I/O. It gains no new dependency (url was already in it). DefaultAvatarBase's Debug redacts the token, and the token is URL-encoded. The new ShellEvent::StatusApiPortInUse variant is added at the end, without touching the existing ones. Review Focus 9 holds: control is off by default (Task 6), it is ignored before the settings load, and it maps only to ToggleSelfMute, ToggleSelfDeaf and LeaveVoice, which the tray also does (TrayAction::ToggleMute, ToggleDeafen and DisconnectVoice).

Findings:

  • minor: The Interfaces block names AvatarRef::Default(index), to be resolved by the server task. The code instead adds DefaultAvatarBase and voice_status_with(app, Option<&DefaultAvatarBase>). No other task's code uses AvatarRef yet, so nothing breaks. However, Task 33 (the runtime, runtime.rs:1223) must switch to voice_status_with(.., Some(&base)), or default avatars stay null. Task 31 needs no resolver. Please carry this note to Tasks 31 and 33.
  • minor: The spec says selfVideo and the local cameraOn follow the local switches. They stay false / echo-only because this client has no camera yet (confirmed: fluxer-core voice has no self_video switch). This is an acceptable deviation, but it is documented only in the code and the README. When the camera lands (sub-project 5), it must be wired here.
  • minor: Once Task 33 passes a base, the avatar_url values in VoiceStatusPayload carry the status API token. The payload's derived Debug would print it. Nothing logs the payload today. Tasks 31 and 33 must keep it out of logs, --record and --debug-info.
  • minor: ShellEvent::StatusApiPortInUse(Option<u16>) is not in the plan's Interfaces block. It is a reasonable addition, appended at the end. Task 33 must send it from Task 31's bind_error() (AddrInUse), and Task 40 reads it through companion_section.

Gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed.

Verdict: APPROVED (no blocking findings, gate green).

## Independent review: Shell 15 (core status payload gaps and companion control) Reviewed the diff `158c90dd..origin/shell-15-core-status-payload-gaps` (c25cee09) cold. **Tests named by the plan:** all six exist and pass: `self_stream_follows_local_share`, `local_camera_and_stream_before_echo`, `default_avatar_gets_local_url` (in `tests/voice_status.rs`), and `control_ops_only_when_enabled`, `set_mute_is_idempotent`, `port_warning_shown_when_bind_failed` (in `tests/shell_companion.rs`). They assert the spec's values: the URL shape `http://127.0.0.1:<port>/avatars/default/<i>.png?token=…`, the new switch label, and the original's port string. **Parity spot-checks against the fork:** - `streaming = state.self_stream || (is_local && local_stream)` matches `VoiceParticipantDisplayState.ts:88` (`remoteStreaming || (isLocalConnection && localSelfStream)`). `is_local` is the same user and the same connection, as in `DesktopVoiceStatusBridge.ts`. - The port warning string matches `DesktopStatusApiSection.tsx:54` (`PORT_IN_USE_DESCRIPTOR`) word for word. As in the original (`:117`), it shows only while the API is enabled. - A member with AVATAR_UNSET falls back to `default_avatar_index(user.id)`, as `getUserAvatarURL({id, avatar:null})` does. **Invariants:** fluxer-core does no I/O. It gains no new dependency (`url` was already in it). `DefaultAvatarBase`'s `Debug` redacts the token, and the token is URL-encoded. The new `ShellEvent::StatusApiPortInUse` variant is added at the end, without touching the existing ones. Review Focus 9 holds: control is off by default (Task 6), it is ignored before the settings load, and it maps only to `ToggleSelfMute`, `ToggleSelfDeaf` and `LeaveVoice`, which the tray also does (`TrayAction::ToggleMute`, `ToggleDeafen` and `DisconnectVoice`). **Findings:** - minor: The Interfaces block names `AvatarRef::Default(index)`, to be resolved by the server task. The code instead adds `DefaultAvatarBase` and `voice_status_with(app, Option<&DefaultAvatarBase>)`. No other task's code uses `AvatarRef` yet, so nothing breaks. However, Task 33 (the runtime, `runtime.rs:1223`) must switch to `voice_status_with(.., Some(&base))`, or default avatars stay `null`. Task 31 needs no resolver. Please carry this note to Tasks 31 and 33. - minor: The spec says `selfVideo` and the local `cameraOn` follow the local switches. They stay false / echo-only because this client has no camera yet (confirmed: `fluxer-core` voice has no `self_video` switch). This is an acceptable deviation, but it is documented only in the code and the README. When the camera lands (sub-project 5), it must be wired here. - minor: Once Task 33 passes a base, the `avatar_url` values in `VoiceStatusPayload` carry the status API token. The payload's derived `Debug` would print it. Nothing logs the payload today. Tasks 31 and 33 must keep it out of logs, `--record` and `--debug-info`. - minor: `ShellEvent::StatusApiPortInUse(Option<u16>)` is not in the plan's Interfaces block. It is a reasonable addition, appended at the end. Task 33 must send it from Task 31's `bind_error()` (`AddrInUse`), and Task 40 reads it through `companion_section`. **Gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: **all steps passed**. **Verdict: APPROVED** (no blocking findings, gate green).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Merged into shell by hand (the merge API returns 405); the commits are in the branch.

Merged into `shell` by hand (the merge API returns 405); the commits are in the branch.
charles closed this pull request 2026-11-18 08:14:50 +00:00
Author
Owner

Independent review: Shell 15 (core-status-payload-gaps), re-check

Reviewed cold: d61a85329 (tests) and c25cee09e (implementation), on origin/shell-15-core-status-payload-gaps at d09841707.

Tests (plan Step 1): all six exist and assert what the plan says: self_stream_follows_local_share, local_camera_and_stream_before_echo, default_avatar_gets_local_url (crates/fluxer-core/tests/voice_status.rs), and control_ops_only_when_enabled, set_mute_is_idempotent, port_warning_shown_when_bind_failed (crates/fluxer-core/tests/shell_companion.rs). The strings are the spec's exactly.

Interfaces: CompanionOp::{SetMute(bool), SetDeaf(bool), ToggleMute, ToggleDeaf, Disconnect}, companion_action, companion_section, CONTROL_SWITCH, port_warning and ShellEvent::StatusApiPortInUse(Option<u16>) (added at the end, so append-only) are all present. The selector takes the default-avatar base as a parameter (voice_status_with(&App, Option<&DefaultAvatarBase>)) and does no I/O.

Invariants: fluxer-core still has no iced, wgpu, winit, reqwest or tokio-tungstenite, and does no I/O (url was already a dependency). DefaultAvatarBase's Debug hides the token. Nothing here can panic on server data (default_avatar_index cannot fail, and URL parsing falls back without panicking). Control is off by default (status_api_control: false).

Parity, checked against the fork:

  • resolveVoiceParticipantDisplayState: streaming = remoteStreaming || (isLocalConnection && localSelfStream). Ported as state.self_stream || (is_local && local_stream). Matches.
  • PORT_IN_USE_DESCRIPTOR in DesktopStatusApiSection.tsx:53 is the same string, and the warning shows only inside settings.enabled &&. Matches.
  • AvatarUtils.getDefaultAvatarIndex = id % DEFAULT_AVATAR_COUNT is the same as default_avatar_index. Matches.
  • LocalVoiceState.getSelfStream maps to the share being published. The mute and deafen semantics (unmuting while deafened undeafens) are the existing toggle_self_mute / toggle_self_deaf.

Review Focus 9 (control off by default, does nothing the tray menu cannot): satisfied. Ops map only to ToggleSelfMute, ToggleSelfDeaf and LeaveVoice, the actions behind the tray's ToggleMute, ToggleDeafen and DisconnectVoice. Every op is ignored while the switch is off or the settings are not loaded.

Findings

  • minor: The Interfaces block names AvatarRef::Default(index). The code exposes DefaultAvatarBase + voice_status_with instead. Task 31's interface does not consume AvatarRef, so nothing breaks, but Task 31 and Task 33 should build against voice_status_with / DefaultAvatarBase.
  • minor: For a default avatar, the payload's avatarUrl now carries the status API token in its query string, as the spec asks. The token is hidden in DefaultAvatarBase's Debug, but the Debug of VoiceStatusPayload would print it. The runtime (Tasks 31 and 33) must not log or --record the payload.
  • minor: selfVideo stays false (this client has no camera yet). The camera comes only from the server's echo. This is documented and fine until sub-project 5.

Gate

FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci on d09841707: all steps passed (exit 0), including all six Task 15 tests.

Verdict: APPROVED. No blocking findings, and CI is green locally.

## Independent review: Shell 15 (core-status-payload-gaps), re-check Reviewed cold: `d61a85329` (tests) and `c25cee09e` (implementation), on `origin/shell-15-core-status-payload-gaps` at `d09841707`. **Tests (plan Step 1):** all six exist and assert what the plan says: `self_stream_follows_local_share`, `local_camera_and_stream_before_echo`, `default_avatar_gets_local_url` (`crates/fluxer-core/tests/voice_status.rs`), and `control_ops_only_when_enabled`, `set_mute_is_idempotent`, `port_warning_shown_when_bind_failed` (`crates/fluxer-core/tests/shell_companion.rs`). The strings are the spec's exactly. **Interfaces:** `CompanionOp::{SetMute(bool), SetDeaf(bool), ToggleMute, ToggleDeaf, Disconnect}`, `companion_action`, `companion_section`, `CONTROL_SWITCH`, `port_warning` and `ShellEvent::StatusApiPortInUse(Option<u16>)` (added at the end, so append-only) are all present. The selector takes the default-avatar base as a parameter (`voice_status_with(&App, Option<&DefaultAvatarBase>)`) and does no I/O. **Invariants:** fluxer-core still has no iced, wgpu, winit, reqwest or tokio-tungstenite, and does no I/O (`url` was already a dependency). `DefaultAvatarBase`'s `Debug` hides the token. Nothing here can panic on server data (`default_avatar_index` cannot fail, and URL parsing falls back without panicking). Control is off by default (`status_api_control: false`). **Parity, checked against the fork:** - `resolveVoiceParticipantDisplayState`: `streaming = remoteStreaming || (isLocalConnection && localSelfStream)`. Ported as `state.self_stream || (is_local && local_stream)`. Matches. - `PORT_IN_USE_DESCRIPTOR` in `DesktopStatusApiSection.tsx:53` is the same string, and the warning shows only inside `settings.enabled &&`. Matches. - `AvatarUtils.getDefaultAvatarIndex = id % DEFAULT_AVATAR_COUNT` is the same as `default_avatar_index`. Matches. - `LocalVoiceState.getSelfStream` maps to the share being published. The mute and deafen semantics (unmuting while deafened undeafens) are the existing `toggle_self_mute` / `toggle_self_deaf`. **Review Focus 9** (control off by default, does nothing the tray menu cannot): satisfied. Ops map only to `ToggleSelfMute`, `ToggleSelfDeaf` and `LeaveVoice`, the actions behind the tray's ToggleMute, ToggleDeafen and DisconnectVoice. Every op is ignored while the switch is off or the settings are not loaded. ### Findings - **minor:** The Interfaces block names `AvatarRef::Default(index)`. The code exposes `DefaultAvatarBase` + `voice_status_with` instead. Task 31's interface does not consume `AvatarRef`, so nothing breaks, but Task 31 and Task 33 should build against `voice_status_with` / `DefaultAvatarBase`. - **minor:** For a default avatar, the payload's `avatarUrl` now carries the status API token in its query string, as the spec asks. The token is hidden in `DefaultAvatarBase`'s `Debug`, but the `Debug` of `VoiceStatusPayload` would print it. The runtime (Tasks 31 and 33) must not log or `--record` the payload. - **minor:** `selfVideo` stays `false` (this client has no camera yet). The camera comes only from the server's echo. This is documented and fine until sub-project 5. ### Gate `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` on `d09841707`: **all steps passed** (exit 0), including all six Task 15 tests. **Verdict: APPROVED.** No blocking findings, and CI is green locally.

Pull request closed

Sign in to join this conversation.
No description provided.