Daily use 22c: fluxer-core synced trusted domains and hide-muted default (#510) #561

Closed
charles wants to merge 0 commits from dailyuse-22c-core-trusted-domains-hide-muted into dailyuse
Owner

Stacked on: origin/dailyuse-11b-core-state-skeleton, origin/dailyuse-16a-core-invite-links

What

Daily use 22c (spec §3.1, §17 Q2, §17 Q8; #417):

  • Synced trusted domains (chat/links.rs): app.chat.links.trusted_domains is now the account's user_settings.trusted_domains (READY, USER_SETTINGS_UPDATE, the PATCH answer) with writes on their way on top; "Always trust" PATCHes the whole list with the host appended (TrustedDomain.addTrustedDomain), a failure reverts to the account's list. Built-in hosts and the instance endpoints (now including the invite endpoint, as the original's configuredTrustedDomainPatterns) are always trusted; * trusts all.
  • Local list merged once: LocalSettings::chat.trusted_domains loads into app.chat.links.local (empty / >253-char entries dropped), stays trusted until merged, is merged into the account's list with one PATCH on READY (account entries first, cap 1000), and the settings file is then written with an empty list. A failed merge restores the local list (written back) for the next READY; an account that already holds the hosts just clears it.
  • Trust all: new ChatSettingChange::TrustAllLinks(bool) writes ["*"] / [] exactly as the original's setTrustAllDomains; selector chat::links::trusts_all_links(&App) for Task 37c.
  • Hide muted channels by default is the synced default_hide_muted_channels: DisplaySettings::default_hide_muted_channels (shown at once, reverts on failure, read from the account). UserAction::SetDefaultHideMutedChannels { hide, apply_to_all } PATCHes only that field and, with apply_to_all, applies UserAction::SetHideMutedChannels { guild_id, hide } for every guild as follow-ups after the event (AdvancedChatControls.tsx:650-710). The local ChatSettings::hide_muted_channels_by_default is gone; a [chat.settings] entry of that name in an older file loads and is ignored.

Tests

  • New crates/fluxer-core/tests/trusted_domains.rs: trusted_domains_synced_merge_once, nothing_to_merge_writes_nothing, trust_all_star, builtin_hosts_always_trusted, default_hide_muted_synced_patch, default_hide_muted_apply_to_all_sets_every_guild, local_hide_muted_default_ignored; unit test chat::settings::tests::default_hide_muted_apply_to_all_follow_ups (checks the follow-up list itself).
  • FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally (one earlier run hit a SIGSEGV at teardown of fluxer --lib tests after all 82 passed, unrelated; the rerun was green). No FLUXER_DESKTOP_TESTS tests apply.

Deviations / notes for review

  • Outside the Files list, minimal: chat/state.rs (load/logout keep only the unmerged local list), persist.rs (the file's trusted_domains now mirrors links.local, saved on any event so the READY merge clears it), app.rs (one line taking the hide-muted follow-ups), fluxer-ui/.../advanced_chat.rs:240 (the existing row reads the synced value; Task 37c adds the confirm), and test updates in chat_channel_kinds.rs, chat_settings.rs, chat_persist.rs, dailyuse_ports.rs (SetDefaultHideMutedChannels no longer a no-op), fluxer-platform/tests/settings_chat.rs.
  • SetHideMutedChannels is still a stub in notif_settings (Task 13/17), so the integration test default_hide_muted_apply_to_all_sets_every_guild compares against a twin store given the actions by hand; it becomes meaningful once that action writes. The unit test checks the follow-ups directly.
  • ChatSettingChange::HideMutedChannelsByDefault is kept, now as the synced "new communities only" write, so the existing row keeps binding until 37c.
  • Trust-all off writes [] (the original clears the list), not "remove *" as the 37c line in the plan reads.

Closes #510
Refs #417

🤖 Generated with Claude Code

Stacked on: origin/dailyuse-11b-core-state-skeleton, origin/dailyuse-16a-core-invite-links ## What Daily use 22c (spec §3.1, §17 Q2, §17 Q8; #417): - **Synced trusted domains** (`chat/links.rs`): `app.chat.links.trusted_domains` is now the account's `user_settings.trusted_domains` (READY, USER_SETTINGS_UPDATE, the PATCH answer) with writes on their way on top; "Always trust" PATCHes the whole list with the host appended (`TrustedDomain.addTrustedDomain`), a failure reverts to the account's list. Built-in hosts and the instance endpoints (now including the `invite` endpoint, as the original's `configuredTrustedDomainPatterns`) are always trusted; `*` trusts all. - **Local list merged once**: `LocalSettings::chat.trusted_domains` loads into `app.chat.links.local` (empty / >253-char entries dropped), stays trusted until merged, is merged into the account's list with one PATCH on READY (account entries first, cap 1000), and the settings file is then written with an empty list. A failed merge restores the local list (written back) for the next READY; an account that already holds the hosts just clears it. - **Trust all**: new `ChatSettingChange::TrustAllLinks(bool)` writes `["*"]` / `[]` exactly as the original's `setTrustAllDomains`; selector `chat::links::trusts_all_links(&App)` for Task 37c. - **Hide muted channels by default** is the synced `default_hide_muted_channels`: `DisplaySettings::default_hide_muted_channels` (shown at once, reverts on failure, read from the account). `UserAction::SetDefaultHideMutedChannels { hide, apply_to_all }` PATCHes only that field and, with `apply_to_all`, applies `UserAction::SetHideMutedChannels { guild_id, hide }` for every guild as follow-ups after the event (`AdvancedChatControls.tsx:650-710`). The local `ChatSettings::hide_muted_channels_by_default` is gone; a `[chat.settings]` entry of that name in an older file loads and is ignored. ## Tests - New `crates/fluxer-core/tests/trusted_domains.rs`: `trusted_domains_synced_merge_once`, `nothing_to_merge_writes_nothing`, `trust_all_star`, `builtin_hosts_always_trusted`, `default_hide_muted_synced_patch`, `default_hide_muted_apply_to_all_sets_every_guild`, `local_hide_muted_default_ignored`; unit test `chat::settings::tests::default_hide_muted_apply_to_all_follow_ups` (checks the follow-up list itself). - `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally (one earlier run hit a SIGSEGV at teardown of `fluxer --lib` tests after all 82 passed, unrelated; the rerun was green). No FLUXER_DESKTOP_TESTS tests apply. ## Deviations / notes for review - Outside the Files list, minimal: `chat/state.rs` (load/logout keep only the unmerged local list), `persist.rs` (the file's `trusted_domains` now mirrors `links.local`, saved on any event so the READY merge clears it), `app.rs` (one line taking the hide-muted follow-ups), `fluxer-ui/.../advanced_chat.rs:240` (the existing row reads the synced value; Task 37c adds the confirm), and test updates in `chat_channel_kinds.rs`, `chat_settings.rs`, `chat_persist.rs`, `dailyuse_ports.rs` (SetDefaultHideMutedChannels no longer a no-op), `fluxer-platform/tests/settings_chat.rs`. - `SetHideMutedChannels` is still a stub in `notif_settings` (Task 13/17), so the integration test `default_hide_muted_apply_to_all_sets_every_guild` compares against a twin store given the actions by hand; it becomes meaningful once that action writes. The unit test checks the follow-ups directly. - `ChatSettingChange::HideMutedChannelsByDefault` is kept, now as the synced "new communities only" write, so the existing row keeps binding until 37c. - Trust-all off writes `[]` (the original clears the list), not "remove `*`" as the 37c line in the plan reads. Closes #510 Refs #417 🤖 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 #496

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
New domains notif_settings, social, invites, switcher, keynav and report with
their state, Default and stub reducers wired into App::apply; stub menu
builders (channel, category, guild, user, dm, mute::item); OwnPresence, profile
notes and modal state. Relationships move from chat::dms to app.social and are
read through social::relationship.

Refs #496

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Fixtures used: fixtures/rest/invite_guild.json, invite_group_dm.json (shaped as
fork:packages/schema/src/domains/invite/InviteSchemas.ts:42-91, Daily use 2).

Refs #501

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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Trusted domains are the account's user_settings.trusted_domains, written
whole with PATCH /users/@me/settings; the local list of an earlier version
is merged once on READY and dropped from the settings file. "Hide muted
channels by default" is the synced default_hide_muted_channels;
SetDefaultHideMutedChannels with apply_to_all sets every guild through
SetHideMutedChannels (AdvancedChatControls.tsx:650-710).

Refs #510

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

Independent review: Daily use 22c (diff 995e64a8..26de473)

Plan tests: all six named tests are in crates/fluxer-core/tests/trusted_domains.rs and check what the plan asks for: trusted_domains_synced_merge_once, trust_all_star, builtin_hosts_always_trusted, default_hide_muted_synced_patch, default_hide_muted_apply_to_all_sets_every_guild and local_hide_muted_default_ignored. There are two extras: nothing_to_merge_writes_nothing, plus a unit test of the follow-up list in chat/settings.rs. The apply-to-all integration test compares against a twin store. It is weak for now because SetHideMutedChannels is still a stub (Tasks 13/17), and the unit test makes up for that.

Interfaces: the produced interfaces match the plan. SetDefaultHideMutedChannels { hide, apply_to_all } PATCHes only default_hide_muted_channels. With apply_to_all it follows up with one SetHideMutedChannels { guild_id, hide } per guild. ChatSettings::hide_muted_channels_by_default is gone, and an old [chat.settings] entry with that name loads and is ignored. user_settings.trusted_domains is read and PATCHed whole, the local list is merged once, built-in and instance hosts are always trusted, and * trusts everything. Two additions are for Task 37c: ChatSettingChange::TrustAllLinks(bool) and chat::links::trusts_all_links(&App). No other open dailyuse branch uses the removed field in new code. Task 13 reads UserSettings::default_hide_muted_channels().

Invariants: fluxer-core has no new I/O or forbidden imports. The PATCHes carry only their own field. The trusted-domains list is always sent whole, because the server replaces it (Review Focus 1). A malformed trusted_domains value, such as a string instead of an array, gives an empty list and does not panic (tested). The logs contain no hosts, tokens or paths, and no fixtures were added.

Parity spot-checks (fluxer-soundboard):

  1. TrustedDomain.setTrustAllDomains writes ['*'] or [], and TrustAllLinks does the same. This is a correct reading over the plan's "remove *" wording.
  2. BUILT_IN_TRUST_PATTERNS (10 entries) matches. configuredTrustedDomainPatterns includes inviteEndpoint, which is now added.
  3. addTrustedDomain writes nothing when trust-all is on or the host is already listed, and so does the port.
  4. AdvancedChatControls.tsx:650-710: both confirm choices write defaultHideMutedChannels, and the primary choice then sets hide_muted_channels on every guild. This matches.
  5. UserRequestSchemas.ts:383-387: strings of 1–253 characters, at most 1000. The merge enforces both limits.

Findings:

  • minor, crates/fluxer-core/src/chat/links.rs merge_local + persist.rs: on READY the local list leaves the settings file as soon as the merge PATCH is sent, not when it is answered. Suppose the app quits or crashes while that PATCH is in flight and the request never reached the server. Then the list from the earlier version is lost. The window is small, and the spec says only "merged once and then dropped". A more robust option is to keep the local list in the file until UserSettingsPatched/USER_SETTINGS_UPDATE covers it.
  • minor, links.rs EffectFailed: if the server rejects the merge with a 4xx, for example over a pattern it refuses, the local list comes back and the same PATCH is sent again on every READY, with no end. The list stays trusted locally, so nothing breaks, but each READY spends a request. Consider dropping the list, or keeping only the valid entries, on a 4xx validation error.
  • minor, links.rs take_account: a USER_SETTINGS_UPDATE for some other field that arrives while a trusted-domains write is pending clears pending. Until the answer arrives, the list goes back to the account's previous one, and while a merge is in flight the local hosts are briefly untrusted. This is the same pattern as the existing SyncedDisplay, so it is not new behaviour.
  • minor, chat/settings.rs set_default_hide_muted: the per-guild follow-ups are applied at once. The original applies them only after await UserSettingsCommands.update(...) succeeds. When the default write fails, the native client has still changed every guild. This is harmless in practice, but it is not strict parity.
  • minor, docs/parity/settings.toml row chat-settings-hide-muted-channels: the note still says "Stored only…", but the setting is synced now. Task 37c/40 can update it, or this PR can.

CI: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree passed every step (exit 0; LiveKit interop skipped as usual). The SIGSEGV the implementer reported did not happen.

Verdict: APPROVED. There are no blocking findings, and CI is green.

## Independent review: Daily use 22c (diff 995e64a8..26de473) **Plan tests:** all six named tests are in `crates/fluxer-core/tests/trusted_domains.rs` and check what the plan asks for: `trusted_domains_synced_merge_once`, `trust_all_star`, `builtin_hosts_always_trusted`, `default_hide_muted_synced_patch`, `default_hide_muted_apply_to_all_sets_every_guild` and `local_hide_muted_default_ignored`. There are two extras: `nothing_to_merge_writes_nothing`, plus a unit test of the follow-up list in `chat/settings.rs`. The apply-to-all integration test compares against a twin store. It is weak for now because `SetHideMutedChannels` is still a stub (Tasks 13/17), and the unit test makes up for that. **Interfaces:** the produced interfaces match the plan. `SetDefaultHideMutedChannels { hide, apply_to_all }` PATCHes only `default_hide_muted_channels`. With `apply_to_all` it follows up with one `SetHideMutedChannels { guild_id, hide }` per guild. `ChatSettings::hide_muted_channels_by_default` is gone, and an old `[chat.settings]` entry with that name loads and is ignored. `user_settings.trusted_domains` is read and PATCHed whole, the local list is merged once, built-in and instance hosts are always trusted, and `*` trusts everything. Two additions are for Task 37c: `ChatSettingChange::TrustAllLinks(bool)` and `chat::links::trusts_all_links(&App)`. No other open dailyuse branch uses the removed field in new code. Task 13 reads `UserSettings::default_hide_muted_channels()`. **Invariants:** fluxer-core has no new I/O or forbidden imports. The PATCHes carry only their own field. The trusted-domains list is always sent whole, because the server replaces it (Review Focus 1). A malformed `trusted_domains` value, such as a string instead of an array, gives an empty list and does not panic (tested). The logs contain no hosts, tokens or paths, and no fixtures were added. **Parity spot-checks (fluxer-soundboard):** 1. `TrustedDomain.setTrustAllDomains` writes `['*']` or `[]`, and `TrustAllLinks` does the same. This is a correct reading over the plan's "remove `*`" wording. 2. `BUILT_IN_TRUST_PATTERNS` (10 entries) matches. `configuredTrustedDomainPatterns` includes `inviteEndpoint`, which is now added. 3. `addTrustedDomain` writes nothing when trust-all is on or the host is already listed, and so does the port. 4. `AdvancedChatControls.tsx:650-710`: both confirm choices write `defaultHideMutedChannels`, and the primary choice then sets `hide_muted_channels` on every guild. This matches. 5. `UserRequestSchemas.ts:383-387`: strings of 1–253 characters, at most 1000. The merge enforces both limits. **Findings:** - **minor**, `crates/fluxer-core/src/chat/links.rs` `merge_local` + `persist.rs`: on `READY` the local list leaves the settings file as soon as the merge PATCH is *sent*, not when it is answered. Suppose the app quits or crashes while that PATCH is in flight and the request never reached the server. Then the list from the earlier version is lost. The window is small, and the spec says only "merged once and then dropped". A more robust option is to keep the local list in the file until `UserSettingsPatched`/`USER_SETTINGS_UPDATE` covers it. - **minor**, `links.rs` `EffectFailed`: if the server rejects the merge with a 4xx, for example over a pattern it refuses, the local list comes back and the same PATCH is sent again on every `READY`, with no end. The list stays trusted locally, so nothing breaks, but each `READY` spends a request. Consider dropping the list, or keeping only the valid entries, on a 4xx validation error. - **minor**, `links.rs` `take_account`: a `USER_SETTINGS_UPDATE` for some other field that arrives while a trusted-domains write is pending clears `pending`. Until the answer arrives, the list goes back to the account's previous one, and while a merge is in flight the local hosts are briefly untrusted. This is the same pattern as the existing `SyncedDisplay`, so it is not new behaviour. - **minor**, `chat/settings.rs` `set_default_hide_muted`: the per-guild follow-ups are applied at once. The original applies them only after `await UserSettingsCommands.update(...)` succeeds. When the default write fails, the native client has still changed every guild. This is harmless in practice, but it is not strict parity. - **minor**, `docs/parity/settings.toml` row `chat-settings-hide-muted-channels`: the note still says "Stored only…", but the setting is synced now. Task 37c/40 can update it, or this PR can. **CI:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree passed every step (exit 0; LiveKit interop skipped as usual). The SIGSEGV the implementer reported did not happen. **Verdict: APPROVED.** There are no blocking findings, and CI is green.
Author
Owner

Independent review: Daily use 22c (diff 995e64a..26de473)

CI: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci run by the reviewer in a fresh worktree at 26de473: all steps passed (exit 0, no SIGSEGV this run).

Checked: all six plan tests exist under the plan's names and assert the spec's values (1000 entries, 253 chars, *, built-in hosts, default_hide_muted_channels). SetDefaultHideMutedChannels { hide, apply_to_all }, SetHideMutedChannels, UserSettings::{trusted_domains, default_hide_muted_channels} and DisplaySettings::default_hide_muted_channels are all present. fluxer-core has no new I/O and no forbidden imports. No secrets.
Parity was spot-checked against the fork. TrustedDomain.ts: the built-in patterns, with fluxer.gg and fluxer.gift getting no *. form; addTrustedDomain is a no-op under trust-all; setTrustAllDomains(false) writes []; coversHost handles *. patterns. UserRequestSchemas.ts:383-387: the limits. AdvancedChatControls.tsx:650-710: the default is written, then every guild gets hide_muted_channels.

Findings

  1. [blocking] "Always trust" before the live READY replaces the account's trusted domains (breaks Review Focus 1). Links::account is filled only by a live READY, USER_SETTINGS_UPDATE or a patch answer. The stale-cache path (app.rs:184-199) does not feed the cached READY to chat. Between Me and the live READY, chat already reduces (session.user() is Some) and cached messages are on screen. In that window ConfirmExternal { trust_host: true } sends PATCH {trusted_domains: [host]}, and the server replaces the whole list. TrustAllLinks(true/false) in the same window is harmless, because the original also writes ["*"] or []. Fix: until the account's list is known (say an account_known flag), add the host to local and let the READY merge carry it. Alternatively, seed Links from the cached READY's user_settings. Add a test for "Always trust" before READY.
  2. [minor] The local list leaves the file before the merge succeeds. On READY, merge_local takes local, and the persist reducer then writes the file with trusted_domains = [] in the same event, before the PATCH answer. If the app quits or crashes before that answer (or before EffectFailed), the list is in neither place. Spec §7 says "merged … once (PATCH) and then dropped from the file". Clearing the file on UserSettingsPatched / covers_all would close the gap. The failed-merge path itself is handled correctly and tested.
  3. [minor] Endpoint hosts are incomplete. The original trusts marketingEndpoint and giftEndpoint as well. instance_hosts covers instance, webapp, api_public, media, static_cdn and (new here) invite. Endpoints has no marketing or gift field, although well_known.json has both. On forked.io they share the instance host, so nothing changes there. Suggest a follow-up issue in fluxer-proto.
  4. [minor] Trust-all detection is looser than the original's. trusts_everything compares trimmed and lowercased text, so " * " counts. The original's trustAllDomains() is includes('*') (exact). Link opening is the same either way, because coversHost normalizes, but the switch state differs for such a list. The test trust_all_star asserts the looser behaviour.
  5. [minor] Logging out while the merge is in flight. into_local drops merging, and by then local is already empty. If the merge PATCH then fails, the local list is gone. This is narrow, and finding 2's fix covers it too.
  6. [note, not a finding] default_hide_muted_apply_to_all_sets_every_guild compares against a twin store because SetHideMutedChannels is still a stub (Tasks 13/17). Whoever implements that should check that this test then asserts real per-guild state. The settings-screen switch still sends ChatSettingChange::HideMutedChannelsByDefault with no apply-to-all prompt; that belongs to Task 37c.

Verdict: changes requested. One blocking finding (1); CI is green.

## Independent review: Daily use 22c (diff 995e64a..26de473) **CI:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` run by the reviewer in a fresh worktree at 26de473: **all steps passed** (exit 0, no SIGSEGV this run). **Checked:** all six plan tests exist under the plan's names and assert the spec's values (1000 entries, 253 chars, `*`, built-in hosts, `default_hide_muted_channels`). `SetDefaultHideMutedChannels { hide, apply_to_all }`, `SetHideMutedChannels`, `UserSettings::{trusted_domains, default_hide_muted_channels}` and `DisplaySettings::default_hide_muted_channels` are all present. fluxer-core has no new I/O and no forbidden imports. No secrets. Parity was spot-checked against the fork. `TrustedDomain.ts`: the built-in patterns, with `fluxer.gg` and `fluxer.gift` getting no `*.` form; `addTrustedDomain` is a no-op under trust-all; `setTrustAllDomains(false)` writes `[]`; `coversHost` handles `*.` patterns. `UserRequestSchemas.ts:383-387`: the limits. `AdvancedChatControls.tsx:650-710`: the default is written, then every guild gets `hide_muted_channels`. ### Findings 1. **[blocking] "Always trust" before the live READY replaces the account's trusted domains (breaks Review Focus 1).** `Links::account` is filled only by a live `READY`, `USER_SETTINGS_UPDATE` or a patch answer. The stale-cache path (`app.rs:184-199`) does not feed the cached READY to chat. Between `Me` and the live `READY`, chat already reduces (`session.user()` is Some) and cached messages are on screen. In that window `ConfirmExternal { trust_host: true }` sends `PATCH {trusted_domains: [host]}`, and the server replaces the whole list. `TrustAllLinks(true/false)` in the same window is harmless, because the original also writes `["*"]` or `[]`. **Fix:** until the account's list is known (say an `account_known` flag), add the host to `local` and let the READY merge carry it. Alternatively, seed `Links` from the cached READY's `user_settings`. Add a test for "Always trust" before READY. 2. **[minor] The local list leaves the file before the merge succeeds.** On `READY`, `merge_local` takes `local`, and the persist reducer then writes the file with `trusted_domains = []` in the same event, before the PATCH answer. If the app quits or crashes before that answer (or before `EffectFailed`), the list is in neither place. Spec §7 says "merged … once (PATCH) and then dropped from the file". Clearing the file on `UserSettingsPatched` / `covers_all` would close the gap. The failed-merge path itself is handled correctly and tested. 3. **[minor] Endpoint hosts are incomplete.** The original trusts `marketingEndpoint` and `giftEndpoint` as well. `instance_hosts` covers instance, webapp, api_public, media, static_cdn and (new here) invite. `Endpoints` has no `marketing` or `gift` field, although `well_known.json` has both. On forked.io they share the instance host, so nothing changes there. Suggest a follow-up issue in fluxer-proto. 4. **[minor] Trust-all detection is looser than the original's.** `trusts_everything` compares trimmed and lowercased text, so `" * "` counts. The original's `trustAllDomains()` is `includes('*')` (exact). Link opening is the same either way, because `coversHost` normalizes, but the switch state differs for such a list. The test `trust_all_star` asserts the looser behaviour. 5. **[minor] Logging out while the merge is in flight.** `into_local` drops `merging`, and by then `local` is already empty. If the merge PATCH then fails, the local list is gone. This is narrow, and finding 2's fix covers it too. 6. **[note, not a finding]** `default_hide_muted_apply_to_all_sets_every_guild` compares against a twin store because `SetHideMutedChannels` is still a stub (Tasks 13/17). Whoever implements that should check that this test then asserts real per-guild state. The settings-screen switch still sends `ChatSettingChange::HideMutedChannelsByDefault` with no apply-to-all prompt; that belongs to Task 37c. **Verdict: changes requested.** One blocking finding (1); CI is green.
- "Always trust" before the account's list is known (no READY yet) adds
  the host to the local list, which the READY merge carries, instead of
  PATCHing a list that would replace the account's.
- The local list stays in Links::local (and settings.toml) until the
  account's list holds it, so a quit, logout or failed write during the
  merge loses nothing; a new READY restarts a merge left unanswered.
- "Trust all external links" is on for an exact "*" (includes('*')).

Refs #510

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Author
Owner

Review round 1 fixes, commit 760967f (local FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green).

Blocking: "Always trust" before the live READY replaces the account list (chat/links.rs)
Fixed. Links now tracks whether the account's list is known (set by READY, USER_SETTINGS_UPDATE or a patch answer; reset on logout). Until then trust() adds the host to local instead of sending a PATCH, so it is trusted at once, kept in settings.toml, and the READY merge carries it. Test: always_trust_before_ready_keeps_the_account_list (fails on the old code: a PATCH with only the host was sent).

Minor: local list written out of settings.toml on READY, before the merge succeeds (persist.rs)
Fixed. merge_local no longer takes local; it stays in Links::local (what persist writes to the file) until take_account sees the account's list covering it (the patch answer, a later READY or USER_SETTINGS_UPDATE). merging is now just the effect id; a failure clears it, and a new READY restarts a merge left unanswered. If the account cannot take any of it (already at 1000), local is dropped. Tests: trusted_domains_synced_merge_once now checks the file keeps the list until the answer, chat_channel_kinds::old_settings_files_load_with_new_fields updated the same way.

Minor: instance_hosts leaves out marketing and gift
Deferred to follow-up #578 (needs fluxer-proto Endpoints fields first, a different crate). On fluxer.forked.io both are on the already-trusted instance host.

Minor: trusts_everything trims and lowercases
Fixed. trusts_everything and covers_all compare with * exactly (includes('*')). covers still trims, as coversHost does, so " * " opens links but the switch shows off. Test: trust_all_star.

Minor: into_local on logout drops the in-flight merge
Fixed by the persist change: local is never emptied while a merge is in flight, so logout keeps it. Test: logout_during_merge_keeps_the_local_list.

READMEs (fluxer-core, fluxer-platform) updated.

🤖 Generated with Claude Code

Review round 1 fixes, commit 760967f (local `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green). **Blocking: "Always trust" before the live READY replaces the account list** (`chat/links.rs`) Fixed. `Links` now tracks whether the account's list is known (set by READY, USER_SETTINGS_UPDATE or a patch answer; reset on logout). Until then `trust()` adds the host to `local` instead of sending a PATCH, so it is trusted at once, kept in settings.toml, and the READY merge carries it. Test: `always_trust_before_ready_keeps_the_account_list` (fails on the old code: a PATCH with only the host was sent). **Minor: local list written out of settings.toml on READY, before the merge succeeds** (`persist.rs`) Fixed. `merge_local` no longer takes `local`; it stays in `Links::local` (what persist writes to the file) until `take_account` sees the account's list covering it (the patch answer, a later READY or USER_SETTINGS_UPDATE). `merging` is now just the effect id; a failure clears it, and a new READY restarts a merge left unanswered. If the account cannot take any of it (already at 1000), `local` is dropped. Tests: `trusted_domains_synced_merge_once` now checks the file keeps the list until the answer, `chat_channel_kinds::old_settings_files_load_with_new_fields` updated the same way. **Minor: instance_hosts leaves out marketing and gift** Deferred to follow-up #578 (needs `fluxer-proto` `Endpoints` fields first, a different crate). On fluxer.forked.io both are on the already-trusted instance host. **Minor: trusts_everything trims and lowercases** Fixed. `trusts_everything` and `covers_all` compare with `*` exactly (`includes('*')`). `covers` still trims, as `coversHost` does, so `" * "` opens links but the switch shows off. Test: `trust_all_star`. **Minor: into_local on logout drops the in-flight merge** Fixed by the persist change: `local` is never emptied while a merge is in flight, so logout keeps it. Test: `logout_during_merge_keeps_the_local_list`. READMEs (fluxer-core, fluxer-platform) updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Independent review, Task 22c (round 2, at 760967f)

Scope: git diff 995e64a..origin/dailyuse-22c-core-trusted-domains-hide-muted, read without relying on the implementer's notes.

Tests the plan names. All six are in crates/fluxer-core/tests/trusted_domains.rs and check what the plan says: trusted_domains_synced_merge_once, trust_all_star, builtin_hosts_always_trusted, default_hide_muted_synced_patch, default_hide_muted_apply_to_all_sets_every_guild and local_hide_muted_default_ignored. There are also new tests for the round-1 fixes: always_trust_before_ready_keeps_the_account_list, logout_during_merge_keeps_the_local_list and nothing_to_merge_writes_nothing. A unit test checks that the follow-ups come in guild-id order.

Interfaces. SetDefaultHideMutedChannels { hide, apply_to_all } sends a PATCH of default_hide_muted_channels. With apply_to_all, it applies SetHideMutedChannels { guild_id, hide } as a follow-up for every guild. DisplaySettings::default_hide_muted_channels replaces the local hide_muted_channels_by_default: an older file that still has that entry loads, the value is ignored, and it is never written again. Trusted domains come from user_settings.trusted_domains and are written whole with PatchUserSettings. The local list is merged once and kept until the account holds it. Built-in hosts and instance hosts are always trusted. A "*" entry means "trust all".

Invariants. fluxer-core does no I/O and imports no forbidden crate. Malformed trusted_domains (for example a string instead of an array) gives an empty list and no panic, and this is tested. No secrets and no new fixtures. The core tests build on the existing READY fixture.

Parity spot-checks against fluxer-soundboard:

  • BUILT_IN_TRUST_PATTERNS matches the 10 entries.
  • trustAllDomains is includes('*'), an exact match, and the native code matches it.
  • addTrustedDomain writes nothing when trust-all is on or the host is already listed.
  • setTrustAllDomains writes ["*"] or [].
  • The schema limits (1–253 chars, at most 1000) are in packages/schema/.../UserRequestSchemas.ts:383-387.
  • HideMutedChannelsByDefaultControl (AdvancedChatControls.tsx:650-710) writes the default first, then sets hide_muted_channels on every guild.

Review Focus 1. The trusted domains are merged, not replaced. The account's list comes first and local entries are appended. The local list is never sent before the account's list is known: "Always trust" before READY goes to the local list. A failed merge is retried on the next READY.

CI. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a clean review worktree finished with all steps passed (livekit-interop skipped, as usual).

Findings

  1. minor: The Advanced → Chat switch (fluxer-ui/src/screens/settings/advanced_chat.rs) still sends SetChatSetting(HideMutedChannelsByDefault) straight away. The original first asks "Apply to all communities / New communities only". The core action is ready for that dialog, but nothing in the UI uses it yet. The UI task that builds the confirm should wire SetDefaultHideMutedChannels to it.
  2. minor: configuredTrustedDomainPatterns also trusts RuntimeConfig.appPublic.branding.trusted_domains (all except *). fluxer-proto does not model branding, so these hosts are not trusted here. Suggest adding this to follow-up #578, together with the marketing and gift endpoints.
  3. minor: The parity notes are out of date. docs/parity/textchat.md (Advanced chat row: "hide muted channels is stored only"; "Trust all external links" row) and the chat-settings-trust-domains note in docs/parity/settings.toml still describe the old local behaviour. Update them when the switch UI lands.
  4. minor: A merge that would go over 1000 entries drops the extra local entries after logging a warning, and the local list is then cleared on the next READY. That matches the server's limit, but those hosts are gone silently. This is acceptable.

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

## Independent review, Task 22c (round 2, at 760967f) Scope: `git diff 995e64a..origin/dailyuse-22c-core-trusted-domains-hide-muted`, read without relying on the implementer's notes. **Tests the plan names.** All six are in `crates/fluxer-core/tests/trusted_domains.rs` and check what the plan says: `trusted_domains_synced_merge_once`, `trust_all_star`, `builtin_hosts_always_trusted`, `default_hide_muted_synced_patch`, `default_hide_muted_apply_to_all_sets_every_guild` and `local_hide_muted_default_ignored`. There are also new tests for the round-1 fixes: `always_trust_before_ready_keeps_the_account_list`, `logout_during_merge_keeps_the_local_list` and `nothing_to_merge_writes_nothing`. A unit test checks that the follow-ups come in guild-id order. **Interfaces.** `SetDefaultHideMutedChannels { hide, apply_to_all }` sends a PATCH of `default_hide_muted_channels`. With `apply_to_all`, it applies `SetHideMutedChannels { guild_id, hide }` as a follow-up for every guild. `DisplaySettings::default_hide_muted_channels` replaces the local `hide_muted_channels_by_default`: an older file that still has that entry loads, the value is ignored, and it is never written again. Trusted domains come from `user_settings.trusted_domains` and are written whole with `PatchUserSettings`. The local list is merged once and kept until the account holds it. Built-in hosts and instance hosts are always trusted. A `"*"` entry means "trust all". **Invariants.** fluxer-core does no I/O and imports no forbidden crate. Malformed `trusted_domains` (for example a string instead of an array) gives an empty list and no panic, and this is tested. No secrets and no new fixtures. The core tests build on the existing READY fixture. **Parity spot-checks** against `fluxer-soundboard`: - `BUILT_IN_TRUST_PATTERNS` matches the 10 entries. - `trustAllDomains` is `includes('*')`, an exact match, and the native code matches it. - `addTrustedDomain` writes nothing when trust-all is on or the host is already listed. - `setTrustAllDomains` writes `["*"]` or `[]`. - The schema limits (1–253 chars, at most 1000) are in `packages/schema/.../UserRequestSchemas.ts:383-387`. - `HideMutedChannelsByDefaultControl` (`AdvancedChatControls.tsx:650-710`) writes the default first, then sets `hide_muted_channels` on every guild. **Review Focus 1.** The trusted domains are merged, not replaced. The account's list comes first and local entries are appended. The local list is never sent before the account's list is known: "Always trust" before READY goes to the local list. A failed merge is retried on the next READY. **CI.** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a clean review worktree finished with **all steps passed** (livekit-interop skipped, as usual). ### Findings 1. **minor**: The Advanced → Chat switch (`fluxer-ui/src/screens/settings/advanced_chat.rs`) still sends `SetChatSetting(HideMutedChannelsByDefault)` straight away. The original first asks "Apply to all communities / New communities only". The core action is ready for that dialog, but nothing in the UI uses it yet. The UI task that builds the confirm should wire `SetDefaultHideMutedChannels` to it. 2. **minor**: `configuredTrustedDomainPatterns` also trusts `RuntimeConfig.appPublic.branding.trusted_domains` (all except `*`). `fluxer-proto` does not model branding, so these hosts are not trusted here. Suggest adding this to follow-up #578, together with the marketing and gift endpoints. 3. **minor**: The parity notes are out of date. `docs/parity/textchat.md` (Advanced chat row: "hide muted channels is stored only"; "Trust all external links" row) and the `chat-settings-trust-domains` note in `docs/parity/settings.toml` still describe the old local behaviour. Update them when the switch UI lands. 4. **minor**: A merge that would go over 1000 entries drops the extra local entries after logging a warning, and the local list is then cleared on the next READY. That matches the server's limit, but those hosts are gone silently. This is acceptable. **Verdict: approve.** No blocking findings and CI 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:08:54 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.