Daily use 21: fluxer-core voice refusals, user limit, moderation failures (#507) #554

Closed
charles wants to merge 0 commits from dailyuse-21-core-voice-refusals into dailyuse
Owner

Stacked on: dailyuse-11a-core-dailyuse-ports

What this builds (Daily use 21, spec §3.8)

  • voice::voice_refusal(&App) -> Option<RefusalModal { kind, title, body }> with RefusalKind::{Full, TimedOut, ConnectionLimit, Unavailable, Other}. The table is in RefusalModal::for_code / for_failure, following the original's selectMediaEngineGatewayErrorDecision + handleGatewayError (MediaEngineFacadeStateMachine.ts:395-497, MediaEngineFacade.ts:2625-2698). The strings come from VoiceChannelFullModal.tsx, media_engine_facade/shared.ts and VoiceMessageDescriptors.ts:437-444, and the title is "Something went wrong" except for "Voice channel full". The selector reads Failed { reason: Gateway(code) }, or a refusal that left the connection as it was (Voice.refusal), and the existing DismissVoiceError closes it. No new failure enum was added beside VoiceFailure.
  • VOICE_PERMISSION_DENIED on a fresh join goes back to Idle with no effects and no modal. On a move, the move is abandoned with no modal.
  • A move refused with a code that has a modal keeps the room and shows the modal, as the original does (it is connected, so it does not abort).
  • voice::user_limit(&App, channel_id) -> Option<u32> reads Channel.user_limit. 0, an absent limit or a channel outside a guild means no limit.
  • Pre-check (VoiceChannelConnector.tsx:55-63): a JoinVoice to a guild channel whose other connections reach the limit sends no op 4 and schedules no timer. It shows the Full modal and leaves the current connection alone. The client's own connection is not counted.
  • UpdateMemberVoice failures: voice::moderation_failure(&App) -> Option<ModerationFailureModal> with MemberModerationFailure::{MissingPermissions, UserNotInVoice, UnknownMember, Other}, mapped from the API code with the strings of VoiceMemberModerationFailedModal.tsx:13-62. Other is titled with the action's label ("Community mute", "Community deafen", "Disconnect", "Move to…") over "Something went wrong. Please try again in a moment.". It stays until DismissModerationFailure. Requests in flight are remembered by EffectId, capped at 32, because the success answer names no request.

Tests

  • tests/voice_refusal.rs (new): gateway_failure_full_shows_modal, permission_denied_is_silent, codes_to_refusal_table, local_precheck_at_limit_sends_no_op4, limit_zero_is_unlimited.
  • tests/voice_moderation.rs: moderation_failure_modal_strings.
  • I saw the new tests fail first (unresolved imports), then pass. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. No FLUXER_DESKTOP_TESTS tests apply.

Deviations

  • Outside voice/{moderation.rs,mod.rs}, two files changed:
    • voice/connection.rs: the pre-check, the silent permission denial, recording the refusal of a refused move, and clearing the refusal on dismiss and on a new join.
    • app.rs: a one-line call-site change, because reduce_moderation now takes &mut self.
  • VOICE_UNCLAIMED_ACCOUNT and VOICE_ACCOUNT_VERIFICATION_REQUIRED open the account-gate flow in the original. That flow is not built, so these codes give no modal and only "Connection failed" shows. RefusalKind::Other holds the two P2P refusals.
  • The UI's user_limit() in voice_participants.rs is left for Task 36, as the plan says.

Refs #107, #108

Closes #507

🤖 Generated with Claude Code

Stacked on: dailyuse-11a-core-dailyuse-ports ## What this builds (Daily use 21, spec §3.8) - `voice::voice_refusal(&App) -> Option<RefusalModal { kind, title, body }>` with `RefusalKind::{Full, TimedOut, ConnectionLimit, Unavailable, Other}`. The table is in `RefusalModal::for_code` / `for_failure`, following the original's `selectMediaEngineGatewayErrorDecision` + `handleGatewayError` (`MediaEngineFacadeStateMachine.ts:395-497`, `MediaEngineFacade.ts:2625-2698`). The strings come from `VoiceChannelFullModal.tsx`, `media_engine_facade/shared.ts` and `VoiceMessageDescriptors.ts:437-444`, and the title is "Something went wrong" except for "Voice channel full". The selector reads `Failed { reason: Gateway(code) }`, or a refusal that left the connection as it was (`Voice.refusal`), and the existing `DismissVoiceError` closes it. No new failure enum was added beside `VoiceFailure`. - `VOICE_PERMISSION_DENIED` on a fresh join goes back to `Idle` with no effects and no modal. On a move, the move is abandoned with no modal. - A move refused with a code that has a modal keeps the room and shows the modal, as the original does (it is connected, so it does not abort). - `voice::user_limit(&App, channel_id) -> Option<u32>` reads `Channel.user_limit`. 0, an absent limit or a channel outside a guild means no limit. - Pre-check (`VoiceChannelConnector.tsx:55-63`): a `JoinVoice` to a guild channel whose other connections reach the limit sends no op 4 and schedules no timer. It shows the Full modal and leaves the current connection alone. The client's own connection is not counted. - `UpdateMemberVoice` failures: `voice::moderation_failure(&App) -> Option<ModerationFailureModal>` with `MemberModerationFailure::{MissingPermissions, UserNotInVoice, UnknownMember, Other}`, mapped from the API code with the strings of `VoiceMemberModerationFailedModal.tsx:13-62`. `Other` is titled with the action's label ("Community mute", "Community deafen", "Disconnect", "Move to…") over "Something went wrong. Please try again in a moment.". It stays until `DismissModerationFailure`. Requests in flight are remembered by `EffectId`, capped at 32, because the success answer names no request. ## Tests - `tests/voice_refusal.rs` (new): `gateway_failure_full_shows_modal`, `permission_denied_is_silent`, `codes_to_refusal_table`, `local_precheck_at_limit_sends_no_op4`, `limit_zero_is_unlimited`. - `tests/voice_moderation.rs`: `moderation_failure_modal_strings`. - I saw the new tests fail first (unresolved imports), then pass. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. No `FLUXER_DESKTOP_TESTS` tests apply. ## Deviations - Outside `voice/{moderation.rs,mod.rs}`, two files changed: - `voice/connection.rs`: the pre-check, the silent permission denial, recording the refusal of a refused move, and clearing the refusal on dismiss and on a new join. - `app.rs`: a one-line call-site change, because `reduce_moderation` now takes `&mut self`. - `VOICE_UNCLAIMED_ACCOUNT` and `VOICE_ACCOUNT_VERIFICATION_REQUIRED` open the account-gate flow in the original. That flow is not built, so these codes give no modal and only "Connection failed" shows. `RefusalKind::Other` holds the two P2P refusals. - The UI's `user_limit()` in `voice_participants.rs` is left for Task 36, as the plan says. Refs #107, #108 Closes #507 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every UserAction, CoreEvent, Effect, ApiRequest/ApiResult and chat::Confirm
variant of the Daily use plan (Task 11a), plus the menu types (menus::MenuModel,
MenuItem, MenuItemKind, MenuItemId, MenuModel::flatten). New actions and events
do nothing yet; the runtime answers each new request with 501 CLIENT_NOT_WIRED
and logs Effect::Window until Daily use 28. MessageUser and CloseDm take a
confirmed flag and act as before; Notification gains icon (always None).

Refs #495

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #507

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #507

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

Independent review: Daily use 21 (b286eba, diff 95b0926..origin/dailyuse-21-core-voice-refusals)

Tests named by the plan: all six are there and check the spec's exact strings: gateway_failure_full_shows_modal, permission_denied_is_silent, codes_to_refusal_table, local_precheck_at_limit_sends_no_op4, limit_zero_is_unlimited, moderation_failure_modal_strings.

Interfaces: these match the plan: voice::voice_refusal(&App) -> Option<RefusalModal { kind, title, body }>, RefusalKind::{Full, TimedOut, ConnectionLimit, Unavailable, Other}, voice::user_limit(&App, Snowflake) -> Option<u32> (0 or absent means no limit), MemberModerationFailure::{MissingPermissions, UserNotInVoice, UnknownMember, Other} and UserAction::DismissModerationFailure. The task reuses VoiceFailure::Gateway and DismissVoiceError and adds no new refusal enum: the refusal slot holds a GatewayErrorCode.

Invariants: fluxer-core imports nothing new and does no I/O. Unknown codes return None and nothing panics (try_from(..).unwrap_or). No secrets or fixtures were added.

Parity checks against the fork:

  • VoiceMemberModerationFailedModal.tsx: all three code titles and bodies match. The fallback titles also match: "Community mute", "Community deafen" and "Disconnect" (VoiceMessageDescriptors.ts), and "Move to…" (MoveToChannelSubmenu.tsx:30). The generic body matches CommonErrorModalDescriptors.ts:6.
  • VoiceChannelConnector.tsx countOtherVoiceConnections/checkChannelLimit: only this client's own connection id is left out of the count, and the limit applies only to guild channels. The native pre-check does the same.
  • MediaEngineFacadeStateMachine.ts:395-497 and MediaEngineFacade.ts:2625-2698: these strings match shared.ts: timed out, connection limit and no longer available. The two P2P strings exist in the fork. A refused move also shows the full modal, as in the original (the p2pRefusal channel-full path).

Findings:

  • minor: the original shows "no longer available" through clearUnavailableVoiceTarget(..., {showToast}), which is a toast, not a modal. The native client shows a modal because spec §3.8 and the plan ask for one. This is fine as built, but worth listing as a deliberate difference.
  • minor: the runtime still answers UpdateMemberVoice with 501 (#134). Until Task 28 lands, every moderation action will show the "" / "Something went wrong. Please try again in a moment." modal. That is correct behaviour for a failed request, but it will be visible in daily use until then.
  • minor: RetryVoice skips the user-limit pre-check, so a retry into a full channel relies on the server's VOICE_CHANNEL_FULL. The server still refuses with the right modal.
  • minor: Moderation.pending loses an entry only when its request fails or when the 32-entry cap pushes it out, because the success answer carries no EffectId. Memory stays bounded and the ids are unique, so this is harmless.
  • note: VOICE_UNCLAIMED_ACCOUNT and VOICE_ACCOUNT_VERIFICATION_REQUIRED show no modal, since the account-gate flow is not built. This deviation is disclosed and acceptable.

Implementer's reviewer notes, verified: a refused move keeps the room as Connected and sets the refusal slot, but only for codes that have a modal. DismissVoiceError clears both the refusal slot and Failed, which the test covers on both paths. The VOICE_PERMISSION_DENIED fresh join closes to Idle with no effects.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci printed "all steps passed" in the review worktree at b286eba.

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

## Independent review: Daily use 21 (b286eba, diff 95b0926..origin/dailyuse-21-core-voice-refusals) **Tests named by the plan:** all six are there and check the spec's exact strings: `gateway_failure_full_shows_modal`, `permission_denied_is_silent`, `codes_to_refusal_table`, `local_precheck_at_limit_sends_no_op4`, `limit_zero_is_unlimited`, `moderation_failure_modal_strings`. **Interfaces:** these match the plan: `voice::voice_refusal(&App) -> Option<RefusalModal { kind, title, body }>`, `RefusalKind::{Full, TimedOut, ConnectionLimit, Unavailable, Other}`, `voice::user_limit(&App, Snowflake) -> Option<u32>` (0 or absent means no limit), `MemberModerationFailure::{MissingPermissions, UserNotInVoice, UnknownMember, Other}` and `UserAction::DismissModerationFailure`. The task reuses `VoiceFailure::Gateway` and `DismissVoiceError` and adds no new refusal enum: the `refusal` slot holds a `GatewayErrorCode`. **Invariants:** fluxer-core imports nothing new and does no I/O. Unknown codes return `None` and nothing panics (`try_from(..).unwrap_or`). No secrets or fixtures were added. **Parity checks against the fork:** - `VoiceMemberModerationFailedModal.tsx`: all three code titles and bodies match. The fallback titles also match: "Community mute", "Community deafen" and "Disconnect" (`VoiceMessageDescriptors.ts`), and "Move to…" (`MoveToChannelSubmenu.tsx:30`). The generic body matches `CommonErrorModalDescriptors.ts:6`. - `VoiceChannelConnector.tsx` `countOtherVoiceConnections`/`checkChannelLimit`: only this client's own connection id is left out of the count, and the limit applies only to guild channels. The native pre-check does the same. - `MediaEngineFacadeStateMachine.ts:395-497` and `MediaEngineFacade.ts:2625-2698`: these strings match `shared.ts`: timed out, connection limit and no longer available. The two P2P strings exist in the fork. A refused move also shows the full modal, as in the original (the p2pRefusal `channel-full` path). **Findings:** - minor: the original shows "no longer available" through `clearUnavailableVoiceTarget(..., {showToast})`, which is a toast, not a modal. The native client shows a modal because spec §3.8 and the plan ask for one. This is fine as built, but worth listing as a deliberate difference. - minor: the runtime still answers `UpdateMemberVoice` with 501 (#134). Until Task 28 lands, every moderation action will show the "<label>" / "Something went wrong. Please try again in a moment." modal. That is correct behaviour for a failed request, but it will be visible in daily use until then. - minor: `RetryVoice` skips the user-limit pre-check, so a retry into a full channel relies on the server's `VOICE_CHANNEL_FULL`. The server still refuses with the right modal. - minor: `Moderation.pending` loses an entry only when its request fails or when the 32-entry cap pushes it out, because the success answer carries no `EffectId`. Memory stays bounded and the ids are unique, so this is harmless. - note: `VOICE_UNCLAIMED_ACCOUNT` and `VOICE_ACCOUNT_VERIFICATION_REQUIRED` show no modal, since the account-gate flow is not built. This deviation is disclosed and acceptable. **Implementer's reviewer notes, verified:** a refused move keeps the room as `Connected` and sets the refusal slot, but only for codes that have a modal. `DismissVoiceError` clears both the refusal slot and `Failed`, which the test covers on both paths. The `VOICE_PERMISSION_DENIED` fresh join closes to `Idle` with no effects. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` printed "all steps passed" in the review worktree at b286eba. **Verdict: APPROVED.** No blocking findings and CI is green.
Author
Owner

Review: Daily use 21 (core voice refusals), b286eba

Scope: git diff 95b0926..origin/dailyuse-21-core-voice-refusals.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci on b286eba passed every step: fmt, clippy, deny, core-isolation, parity, test, vendored-tests, screenshot-tests and livekit-interop.

Plan tests: all six named tests exist, and each checks what the plan says it should, using the spec's exact strings:

  • gateway_failure_full_shows_modal
  • permission_denied_is_silent
  • codes_to_refusal_table
  • local_precheck_at_limit_sends_no_op4
  • limit_zero_is_unlimited
  • moderation_failure_modal_strings

Interfaces: these match the plan as written:

  • voice_refusal(&App) -> Option<RefusalModal{kind,title,body}>
  • RefusalKind::{Full,TimedOut,ConnectionLimit,Unavailable,Other}
  • voice::user_limit(&App, Snowflake) -> Option<u32> (0 or absent means no limit)
  • MemberModerationFailure::{MissingPermissions,UserNotInVoice,UnknownMember,Other}
  • DismissModerationFailure

The change reuses VoiceFailure::Gateway and DismissVoiceError; the only new state is a slot holding a GatewayErrorCode, not a new refusal enum.

Invariants: no new dependencies, no I/O and no fixtures. Server data cannot cause a panic: user_limit is converted with u32::from(u16) and the count uses try_from with a saturating fallback. The pending-moderation queue is capped at 32 entries.

Parity spot-checks against the fork:

  1. VoiceChannelConnector.tsx countOtherVoiceConnections and checkChannelLimit: own connection excluded, guild channels only, at or over the limit gives the Full modal. Matches.
  2. MediaEngineFacade.ts:2625-2698 with showVoiceErrorModal: the title is "Something went wrong"; the timed-out and connection-limit bodies come from media_engine_facade/shared.ts; the P2P bodies come from VoiceMessageDescriptors.ts:438,442. Matches.
  3. VoiceMemberModerationFailedModal.tsx: the three code-specific strings, the fallback body "Something went wrong. Please try again in a moment." and the fallback titles "Community mute", "Community deafen", "Disconnect" and "Move to…" (VoiceParticipantMenuData.tsx:1199,1221,1244, MoveToChannelSubmenu.tsx:94). Matches.

Findings

  • minor: the not-found codes map to the Unavailable modal. The original shows a toast for these (showUnavailableToast in selectMediaEngineGatewayErrorDecision), not an error modal. The spec and plan ask for a modal kind, so the UI task can still draw this kind as a toast.
  • minor: for VOICE_P2P_CONSENT_REQUIRED, the original first opens the P2P consent prompt when consent has not been given. Here it always shows the error modal. Acceptable while the consent flow is not built; this deviation should be listed in the parity notes.
  • minor: RetryVoice on a failed join skips the user-limit pre-check. The original goes through checkChannelLimit on every connect. This only matters if the channel fills up between the failure and the retry.

Verdict: APPROVE. There are no blocking findings and the local gate is green.

## Review: Daily use 21 (core voice refusals), b286eba Scope: `git diff 95b0926..origin/dailyuse-21-core-voice-refusals`. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` on b286eba passed every step: fmt, clippy, deny, core-isolation, parity, test, vendored-tests, screenshot-tests and livekit-interop. **Plan tests:** all six named tests exist, and each checks what the plan says it should, using the spec's exact strings: - `gateway_failure_full_shows_modal` - `permission_denied_is_silent` - `codes_to_refusal_table` - `local_precheck_at_limit_sends_no_op4` - `limit_zero_is_unlimited` - `moderation_failure_modal_strings` **Interfaces:** these match the plan as written: - `voice_refusal(&App) -> Option<RefusalModal{kind,title,body}>` - `RefusalKind::{Full,TimedOut,ConnectionLimit,Unavailable,Other}` - `voice::user_limit(&App, Snowflake) -> Option<u32>` (0 or absent means no limit) - `MemberModerationFailure::{MissingPermissions,UserNotInVoice,UnknownMember,Other}` - `DismissModerationFailure` The change reuses `VoiceFailure::Gateway` and `DismissVoiceError`; the only new state is a slot holding a `GatewayErrorCode`, not a new refusal enum. **Invariants:** no new dependencies, no I/O and no fixtures. Server data cannot cause a panic: `user_limit` is converted with `u32::from(u16)` and the count uses `try_from` with a saturating fallback. The pending-moderation queue is capped at 32 entries. **Parity spot-checks against the fork:** 1. `VoiceChannelConnector.tsx` `countOtherVoiceConnections` and `checkChannelLimit`: own connection excluded, guild channels only, at or over the limit gives the Full modal. Matches. 2. `MediaEngineFacade.ts:2625-2698` with `showVoiceErrorModal`: the title is "Something went wrong"; the timed-out and connection-limit bodies come from `media_engine_facade/shared.ts`; the P2P bodies come from `VoiceMessageDescriptors.ts:438,442`. Matches. 3. `VoiceMemberModerationFailedModal.tsx`: the three code-specific strings, the fallback body "Something went wrong. Please try again in a moment." and the fallback titles "Community mute", "Community deafen", "Disconnect" and "Move to…" (`VoiceParticipantMenuData.tsx:1199,1221,1244`, `MoveToChannelSubmenu.tsx:94`). Matches. **Findings** - minor: the not-found codes map to the `Unavailable` modal. The original shows a toast for these (`showUnavailableToast` in `selectMediaEngineGatewayErrorDecision`), not an error modal. The spec and plan ask for a modal kind, so the UI task can still draw this kind as a toast. - minor: for `VOICE_P2P_CONSENT_REQUIRED`, the original first opens the P2P consent prompt when consent has not been given. Here it always shows the error modal. Acceptable while the consent flow is not built; this deviation should be listed in the parity notes. - minor: `RetryVoice` on a failed join skips the user-limit pre-check. The original goes through `checkChannelLimit` on every connect. This only matters if the channel fills up between the failure and the retry. Verdict: APPROVE. There are no blocking findings and the local gate is green.
Author
Owner

Merged into dailyuse at f7972c3 (combined merge of 23 Daily use tasks plus textchat).

Merged into `dailyuse` at f7972c3 (combined merge of 23 Daily use tasks plus `textchat`).
charles closed this pull request 2026-11-15 06:09:00 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.