Daily use 19: core quick switcher (#505) #568

Closed
charles wants to merge 0 commits from dailyuse-19-core-quick-switcher into dailyuse
Owner

Daily use 19: the quick switcher in fluxer-core (spec §3.7, §6.2 "Quick switcher").

Stacked on: origin/dailyuse-13-core-honour-mutes

What it does

  • switcher::switcher(&App) -> SwitcherModel { placeholder, mode_header, sections: Vec<SwitcherSection { header, rows: Vec<SwitcherRow { kind, title, subtitle, icon: SwitcherIcon, meta, unread, mentions }> }>, selected, empty }, as in the Interfaces block. SwitcherAction::{Open, Close, Toggle, Edit, Up, Down, Select(Option<usize>)} drive app.switcher.
  • Empty query: "Previous channels" (recent visits, current channel excluded, max 3 when another section shows, else max 7), "Mentions" (newest first), "Unread channels" (current guild, visible text/announcement, unread, not muted, guild at ALL_MESSAGES). The first 3 previous channels are not repeated in the other sections (generateDefaultResults).
  • Query: users (not self, not blocked; friend +0.2 and open-DM +0.1 weights), group DMs, guild text and voice channels (voice -1), guilds (not the current one). Max 5 per category, 100 when only one category matches. Dedup by kind and id. Scores follow SearchTextMatching.ts:41-47 and ForwardDestinationSearch.ts (exact 10, prefix 7, substring 5, every word 3, fuzzy 1; channel context and whole-query terms; users' confusable/diacritic fuzzy fallback). Ties between users are broken alphabetically.
  • Prefixes @ (in a guild: its friends and members, header "Searching friends and members of {name}"), @@, #, !, * with the original's headers. With no text after the prefix: recent authors, or channel listings scored 7 / 6 (voice in a text listing) +3 for a recently used channel, capped at 10 (7) (QuickSwitcherResultGenerators.ts:84-90,410-416), or all guilds.
  • A /channels/... link on this instance's web app host comes first as "Go to message".
  • Up/Down wrap over the rows. selected indexes rows, and headers are not rows, so they are skipped. Select opens the row: SelectGuild+SelectChannel, MessageUser for a user without a DM, or JumpToMessage for a message link. It then closes the switcher.
  • Recent visits (recentlyVisitedChannels): loaded from [navigation] at startup. Every change of the selected channel records a visit (newest first, deduped, max 20) and writes it with PersistOp::Navigation.

Tests

crates/fluxer-core/tests/switcher.rs: all 12 tests from the plan (empty_query_sections_and_caps, previous_excludes_current_and_dedups, previous_survives_restart, prefix_modes_and_headers, category_limits_5_then_100, scoring_exact_prefix_substring_words_fuzzy, listing_scores_and_recent_bonus, diacritics_fold, unread_excludes_muted, selection_wraps_skipping_headers, link_row_first, enter_selects_and_records_visit), plus unit tests for the fold tables, the whole-query term and prefix parsing. I watched the tests fail against stubs, then pass. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci is green locally. No desktop tests apply (core only).

Deviations

  • Visits are recorded in app.rs, after ui.reduce, from the change of ui.selected_channel, not in chat/navigation.rs. That is the only place that sees every selection, including the channel a guild switch restores, as the original's route reaction does. The app.rs changes are wiring only: the rows read before the event, loading the visits, routing the follow-ups, and recording the visit. While the switcher's own SelectGuild+SelectChannel is on its way, the guild's restored channel is not recorded.
  • I updated two existing tests for the new behaviour: chat_persist::navigation_round_trip_and_20_visits_kept (opening #general is now a visit) and dailyuse_ports (the switcher actions are no longer no-ops).
  • Frecency: the native client has no ChannelFrecency, so "recently used" means "in the recent visits", and no frecency weights are applied.
  • Confusables: a short hand-written table (Cyrillic, Greek, full-width, 0/1) plus folding of Latin diacritics. The plan adds no dependency for Unicode normalisation or the full confusables list.
  • Not built (spec §17 Q12): virtual guilds, settings pages, the server member fetch, other accounts. Threads are left out of results and listings because they open in the side panel, not as the selected channel. Personal notes are left out of the group DM search. fluxer:// deep links ("Open link") are not parsed, since the native client has no protocol handler.
  • A user row without a DM sends MessageUser { confirmed: true }, because the original's ensureDMChannel does not confirm.

Closes #505

🤖 Generated with Claude Code

Daily use 19: the quick switcher in `fluxer-core` (spec §3.7, §6.2 "Quick switcher"). Stacked on: origin/dailyuse-13-core-honour-mutes ## What it does - `switcher::switcher(&App) -> SwitcherModel { placeholder, mode_header, sections: Vec<SwitcherSection { header, rows: Vec<SwitcherRow { kind, title, subtitle, icon: SwitcherIcon, meta, unread, mentions }> }>, selected, empty }`, as in the Interfaces block. `SwitcherAction::{Open, Close, Toggle, Edit, Up, Down, Select(Option<usize>)}` drive `app.switcher`. - Empty query: "Previous channels" (recent visits, current channel excluded, max 3 when another section shows, else max 7), "Mentions" (newest first), "Unread channels" (current guild, visible text/announcement, unread, not muted, guild at ALL_MESSAGES). The first 3 previous channels are not repeated in the other sections (`generateDefaultResults`). - Query: users (not self, not blocked; friend +0.2 and open-DM +0.1 weights), group DMs, guild text and voice channels (voice -1), guilds (not the current one). Max 5 per category, 100 when only one category matches. Dedup by kind and id. Scores follow `SearchTextMatching.ts:41-47` and `ForwardDestinationSearch.ts` (exact 10, prefix 7, substring 5, every word 3, fuzzy 1; channel context and whole-query terms; users' confusable/diacritic fuzzy fallback). Ties between users are broken alphabetically. - Prefixes `@` (in a guild: its friends and members, header "Searching friends and members of {name}"), `@@`, `#`, `!`, `*` with the original's headers. With no text after the prefix: recent authors, or channel listings scored 7 / 6 (voice in a text listing) +3 for a recently used channel, capped at 10 (7) (`QuickSwitcherResultGenerators.ts:84-90,410-416`), or all guilds. - A `/channels/...` link on this instance's web app host comes first as "Go to message". - Up/Down wrap over the rows. `selected` indexes rows, and headers are not rows, so they are skipped. Select opens the row: `SelectGuild`+`SelectChannel`, `MessageUser` for a user without a DM, or `JumpToMessage` for a message link. It then closes the switcher. - Recent visits (`recentlyVisitedChannels`): loaded from `[navigation]` at startup. Every change of the selected channel records a visit (newest first, deduped, max 20) and writes it with `PersistOp::Navigation`. ## Tests `crates/fluxer-core/tests/switcher.rs`: all 12 tests from the plan (`empty_query_sections_and_caps`, `previous_excludes_current_and_dedups`, `previous_survives_restart`, `prefix_modes_and_headers`, `category_limits_5_then_100`, `scoring_exact_prefix_substring_words_fuzzy`, `listing_scores_and_recent_bonus`, `diacritics_fold`, `unread_excludes_muted`, `selection_wraps_skipping_headers`, `link_row_first`, `enter_selects_and_records_visit`), plus unit tests for the fold tables, the whole-query term and prefix parsing. I watched the tests fail against stubs, then pass. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` is green locally. No desktop tests apply (core only). ## Deviations - Visits are recorded in `app.rs`, after `ui.reduce`, from the change of `ui.selected_channel`, not in `chat/navigation.rs`. That is the only place that sees every selection, including the channel a guild switch restores, as the original's route reaction does. The `app.rs` changes are wiring only: the rows read before the event, loading the visits, routing the follow-ups, and recording the visit. While the switcher's own `SelectGuild`+`SelectChannel` is on its way, the guild's restored channel is not recorded. - I updated two existing tests for the new behaviour: `chat_persist::navigation_round_trip_and_20_visits_kept` (opening #general is now a visit) and `dailyuse_ports` (the switcher actions are no longer no-ops). - Frecency: the native client has no `ChannelFrecency`, so "recently used" means "in the recent visits", and no frecency weights are applied. - Confusables: a short hand-written table (Cyrillic, Greek, full-width, 0/1) plus folding of Latin diacritics. The plan adds no dependency for Unicode normalisation or the full confusables list. - Not built (spec §17 Q12): virtual guilds, settings pages, the server member fetch, other accounts. Threads are left out of results and listings because they open in the side panel, not as the selected channel. Personal notes are left out of the group DM search. `fluxer://` deep links ("Open link") are not parsed, since the native client has no protocol handler. - A user row without a DM sends `MessageUser { confirmed: true }`, because the original's `ensureDMChannel` does not confirm. Closes #505 🤖 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>
Refs #497

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings from READY, USER_GUILD_SETTINGS_UPDATE and the patch answers;
immediate menu mutes (guild scalars, whole channel_overrides map for
channels, categories and DMs in @me), mute_config in ms, local expiry
timers, 3 s debounced modal changes, revert on failure, selectors
is_muted / muted_until / level / guild_settings_modal, and the shared
mute menu row (MuteTargetMenuItem.tsx, MuteOptions.ts,
UserGuildSettings.ts, UserGuildSettingsCommands.ts).

Refs #497

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
format_date_time shifted the end with to_offset, which panics when the
local date leaves year 9999 (a 9999-12-31T23:30Z end read east of UTC).
It now uses checked_to_offset and falls back to UTC. The
event_replaces_guild_settings test now checks the staff override is
really gone instead of an always-true assertion.

Refs #497

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Table tests for the notification decision (Notification.ts:187-256) and
tests for mute consumers: unread, guild pill, hide muted channels, DM
mentions. Stubs for SidebarSection.{category_muted,muted} and
notif_settings::hides_muted_channels so the tests compile.

Refs #498

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- notif_settings::mentions_me as MessageUtils.isMentioned and
  Notification.isMessageMentionLike: blocked author no, user mention,
  @everyone unless suppressed or in an unjoined thread, own role unless
  suppressed, unmuted DM.
- notification_for follows Notification.ts:187-256: own, blocked, DND,
  SUPPRESS_NOTIFICATIONS, then thread levels (member level, parent level,
  forum new-post level, else only mentions) or mute at any level and the
  effective level.
- read_state::unread is false for a muted channel (mention counts kept);
  has_unread_messages keeps the raw answer for the new-messages bar and
  the thread menu's Mark as read.
- channel_tree: category_muted and muted rows; hide muted channels per
  guild (default_hide_muted_channels without an entry), unless selected,
  connected or with a mention; all-hidden categories hidden.
- DmRowModel.muted from the @me override; a thread is muted by its
  membership or its parent at any level.

Refs #498

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The switcher of spec §3.7: default sections from the recent visits, mentions and
unread channels; prefixes @ @@ # ! *; the original's scoring
(SearchTextMatching.ts:41-47, ForwardDestinationSearch.ts) and listing scores
(QuickSwitcherResultGenerators.ts:84-90,410-416); wraparound; links first.
Every change of the selected channel is recorded as a visit and persisted in
[navigation] (SelectedChannel.ts recentlyVisitedChannels).

Refs #505

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

Independent review: Daily use 19 (core quick switcher)

I reviewed 61e2eba..3a8541d (switcher.rs, the app.rs wiring, tests/switcher.rs and the two updated tests).

Findings

1. BLOCKING: the heading_to guard can get stuck, and then later visits are not recorded (crates/fluxer-core/src/switcher.rs, follow_selection / go_to)
go_to sets heading_to = Some(channel) for every channel, DM or link row. follow_selection checks before == Some(channel_id) and returns early before it clears the guard. If the selected row is the channel that is already open, nothing changes: SelectGuild(same) does nothing and SelectChannel(X) keeps X. heading_to then stays Some(X). From then on, every selection of another channel hits target != channel_id and is dropped. Visits are lost (in memory and in the [navigation] write) until the user opens X again.
This is easy to reach. A query search lists the current channel (only "Previous channels" leaves it out), so typing the open channel's name and pressing Enter is enough. I reproduced it with a throwaway test (not committed):

select(&mut app, Some(GUILD), Some(GENERAL));
open_with(&mut app, "general");
act(&mut app, SwitcherAction::Select(None));
app.apply(CoreEvent::User(UserAction::SelectChannel(NEWS)));
assert_eq!(app.switcher.recent_visits[0].channel_id, NEWS); // fails: GENERAL is still first

The original records every route change (SelectedChannel.ts updateRecentVisit), so this loses user data and breaks parity. Fix: clear heading_to when the target is already selected. Either set it in go_to only when the target differs from ui.selected_channel, or have follow_selection clear it whenever the channel now selected equals the target, before the before == Some(channel_id) early return. Add a regression test.

2. Minor: the "Unread channels" level treats INHERIT/NULL (and a guild with no settings) as all messages (unread_in_current_guild)
The original's getGuildMessageNotifications resolves INHERIT/NULL to the guild's effectiveMessageNotifications, i.e. the guild's default (UserGuildSettings.ts:368-374). A guild whose default is "only mentions" therefore has no unread section in the original, but has one here. fluxer-proto does not carry default_message_notifications yet, so this gap is not this task's to close. Please open a follow-up issue for it.

3. Minor: the user tie-break comparator differs slightly (compare_ranked)
The original's compareSearchResults checks only left.type === 'user', which makes it non-transitive. Comparing by name only when both results are users is the sound reading, and the results are the same for user-only lists. I agree with the implementer's choice; no change needed.

4. Minor: the plan put visit recording in chat/navigation.rs; it is in app.rs (follow_selection after ui.reduce)
This deviates from the plan, but it is only wiring and it works. Task 20, which depends on this task, also owns that area, so no other task's file ownership is affected.

Checks

  • (1) Tests: all 12 planned tests exist and assert the spec's values: caps 3/7, HISTORY_HIDDEN_FROM_SECTIONS 3, limits 5/100, the 10/7/5/3/1 scores, listing scores 7/6 with +3 capped at 10/7, the headers and the strings.
  • (2) Interfaces: SwitcherAction, switcher(&App) -> SwitcherModel { placeholder, mode_header, sections, selected, empty }, SwitcherSection { header, rows }, SwitcherRow { kind, title, subtitle, icon, meta, unread, mentions }, SwitcherIcon and score_search_term all exist as written.
  • (3) Invariants: fluxer-core gains no new dependencies (url was already used) and no I/O. Indexing is safe (one-byte prefixes, get lookups, guarded slices). There are no secrets. Visits are deduped by channel and guild, newest first, ≤ 20, and written with PersistOp::Navigation alongside the stored selected_channels.
  • (4) Parity: I checked these against the fork and they match: scoreSearchTerm/consumeBestSearchTerm/buildChannelSearchTerms (SearchTextMatching.ts), searchChannels (context weight 0.5, cap 6, voice penalty 1 with floor 0.5, frecency cap 10/7), listChannels (voice only in a text listing outside a guild), generateDefaultResults (history 8−1, the first 3 hidden from the other sections, mentions newest first), parsePrefix (@@ first, trim), and SelectedChannel.updateRecentVisit (dedup by channel and guild, 20).
  • (5) Review Focus: no item belongs to Task 19.
  • (6) Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: green (exit 0) at 3a8541d, fmt, clippy, deny, isolation, parity and all tests including screenshots.

Verdict: changes requested. Finding 1 is blocking: the stuck heading_to guard loses recent visits.

🤖 Generated with Claude Code

## Independent review: Daily use 19 (core quick switcher) I reviewed `61e2eba..3a8541d` (`switcher.rs`, the `app.rs` wiring, `tests/switcher.rs` and the two updated tests). ### Findings **1. BLOCKING: the `heading_to` guard can get stuck, and then later visits are not recorded** (`crates/fluxer-core/src/switcher.rs`, `follow_selection` / `go_to`) `go_to` sets `heading_to = Some(channel)` for every channel, DM or link row. `follow_selection` checks `before == Some(channel_id)` and returns early before it clears the guard. If the selected row is the channel that is already open, nothing changes: `SelectGuild(same)` does nothing and `SelectChannel(X)` keeps X. `heading_to` then stays `Some(X)`. From then on, every selection of another channel hits `target != channel_id` and is dropped. Visits are lost (in memory and in the `[navigation]` write) until the user opens X again. This is easy to reach. A query search lists the current channel (only "Previous channels" leaves it out), so typing the open channel's name and pressing Enter is enough. I reproduced it with a throwaway test (not committed): ```rust select(&mut app, Some(GUILD), Some(GENERAL)); open_with(&mut app, "general"); act(&mut app, SwitcherAction::Select(None)); app.apply(CoreEvent::User(UserAction::SelectChannel(NEWS))); assert_eq!(app.switcher.recent_visits[0].channel_id, NEWS); // fails: GENERAL is still first ``` The original records every route change (`SelectedChannel.ts` `updateRecentVisit`), so this loses user data and breaks parity. Fix: clear `heading_to` when the target is already selected. Either set it in `go_to` only when the target differs from `ui.selected_channel`, or have `follow_selection` clear it whenever the channel now selected equals the target, before the `before == Some(channel_id)` early return. Add a regression test. **2. Minor: the "Unread channels" level treats `INHERIT`/`NULL` (and a guild with no settings) as all messages** (`unread_in_current_guild`) The original's `getGuildMessageNotifications` resolves `INHERIT`/`NULL` to the guild's `effectiveMessageNotifications`, i.e. the guild's default (`UserGuildSettings.ts:368-374`). A guild whose default is "only mentions" therefore has no unread section in the original, but has one here. `fluxer-proto` does not carry `default_message_notifications` yet, so this gap is not this task's to close. Please open a `follow-up` issue for it. **3. Minor: the user tie-break comparator differs slightly** (`compare_ranked`) The original's `compareSearchResults` checks only `left.type === 'user'`, which makes it non-transitive. Comparing by name only when both results are users is the sound reading, and the results are the same for user-only lists. I agree with the implementer's choice; no change needed. **4. Minor: the plan put visit recording in `chat/navigation.rs`; it is in `app.rs`** (`follow_selection` after `ui.reduce`) This deviates from the plan, but it is only wiring and it works. Task 20, which depends on this task, also owns that area, so no other task's file ownership is affected. ### Checks - (1) Tests: all 12 planned tests exist and assert the spec's values: caps 3/7, `HISTORY_HIDDEN_FROM_SECTIONS` 3, limits 5/100, the 10/7/5/3/1 scores, listing scores 7/6 with +3 capped at 10/7, the headers and the strings. - (2) Interfaces: `SwitcherAction`, `switcher(&App) -> SwitcherModel { placeholder, mode_header, sections, selected, empty }`, `SwitcherSection { header, rows }`, `SwitcherRow { kind, title, subtitle, icon, meta, unread, mentions }`, `SwitcherIcon` and `score_search_term` all exist as written. - (3) Invariants: `fluxer-core` gains no new dependencies (`url` was already used) and no I/O. Indexing is safe (one-byte prefixes, `get` lookups, guarded slices). There are no secrets. Visits are deduped by channel and guild, newest first, ≤ 20, and written with `PersistOp::Navigation` alongside the stored `selected_channels`. - (4) Parity: I checked these against the fork and they match: `scoreSearchTerm`/`consumeBestSearchTerm`/`buildChannelSearchTerms` (`SearchTextMatching.ts`), `searchChannels` (context weight 0.5, cap 6, voice penalty 1 with floor 0.5, frecency cap 10/7), `listChannels` (voice only in a text listing outside a guild), `generateDefaultResults` (history 8−1, the first 3 hidden from the other sections, mentions newest first), `parsePrefix` (`@@` first, trim), and `SelectedChannel.updateRecentVisit` (dedup by channel and guild, 20). - (5) Review Focus: no item belongs to Task 19. - (6) Local gate: `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci`: green (exit 0) at 3a8541d, fmt, clippy, deny, isolation, parity and all tests including screenshots. **Verdict: changes requested.** Finding 1 is blocking: the stuck `heading_to` guard loses recent visits. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Selecting the channel already open (listed in a search) left heading_to set,
because follow_selection returned on an unchanged selection before clearing
it; every later visit was then dropped, in memory and in [navigation].
heading_to is now cleared whenever the target is the selected channel.

Refs #505

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

Review round 1, fixed in f1c41cb (local FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green):

  • blocking, heading_to stuck (switcher.rs): fixed. follow_selection now clears heading_to whenever the selected channel is the target, before the unchanged-selection early return, so choosing the already-open channel from a search no longer swallows later visits. Regression test selecting_the_open_channel_keeps_recording_visits (tests/switcher.rs: open general, search "general", Enter, then SelectChannel(news): news is recent_visits[0] and the [navigation] write carries it); it failed before the fix.
  • minor, INHERIT/NULL treated as ALL_MESSAGES (switcher.rs): deferred to follow-up #570; needs default_message_notifications in fluxer-proto first.
  • minor, compare_ranked user tie-break: no change, as the finding says.
  • minor, visit recording in app.rs rather than chat/navigation.rs: no change; it is wiring only and file ownership is unaffected.
Review round 1, fixed in f1c41cb (local `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green): - **blocking, heading_to stuck** (switcher.rs): fixed. `follow_selection` now clears `heading_to` whenever the selected channel is the target, before the unchanged-selection early return, so choosing the already-open channel from a search no longer swallows later visits. Regression test `selecting_the_open_channel_keeps_recording_visits` (tests/switcher.rs: open general, search "general", Enter, then SelectChannel(news): news is recent_visits[0] and the `[navigation]` write carries it); it failed before the fix. - **minor, INHERIT/NULL treated as ALL_MESSAGES** (switcher.rs): deferred to follow-up #570; needs `default_message_notifications` in fluxer-proto first. - **minor, compare_ranked user tie-break**: no change, as the finding says. - **minor, visit recording in app.rs rather than chat/navigation.rs**: no change; it is wiring only and file ownership is unaffected.
Author
Owner

Independent review, round 2: Daily use 19 (core quick switcher)

I reviewed 61e2eba..f1c41cb: switcher.rs, the app.rs wiring, tests/switcher.rs, and the edits to chat_persist.rs and dailyuse_ports.rs. I read it without relying on the implementer's notes.

Checks

  1. Plan tests: all 12 named tests exist and assert the spec's values. They cover the previous-channel caps of 7 alone and 3 with other sections, the current channel left out, dedup, the 5/100 limits, the scores 10/7/5/3/1/0, listing scores of 7 and 6 with +3 capped at 10 or 7, the five mode headers, the diacritics and confusables fold, the muted and mentions-only exclusions, wraparound, the link row, and that Enter records and persists the visit. The new regression test selecting_the_open_channel_keeps_recording_visits reproduces round 1's blocking scenario.
  2. Interfaces: SwitcherAction (from 11a) is unchanged. switcher(&App) -> SwitcherModel { placeholder, mode_header, sections: Vec<SwitcherSection { header, rows: Vec<SwitcherRow { kind, title, subtitle, icon: SwitcherIcon, meta, unread, mentions }> }>, selected, empty: Option<(String, String)> } matches the plan exactly. Visits load from [navigation] in Persisted, are written with PersistOp::Navigation, and carry the stored selected_channels unchanged, so Task 20's half of the table is not clobbered.
  3. Invariants: no new dependencies, and nothing from iced, wgpu, winit, reqwest or tungstenite in core. Core does no I/O; the time comes from the existing notif_settings clock. The tests build on the existing READY and USER_GUILD_SETTINGS_UPDATE fixtures, and no new fixture is added. Byte slicing is safe because the prefix characters are ASCII. Link parsing and the fuzzy matcher cannot panic on server data. There are no secrets, tokens or paths.
  4. Parity spot-checks against the fork:
    • The constants and listChannels match (QuickSwitcherResultGenerators.ts:80-91, :405-433).
    • scoreSearchTerm, consumeBestSearchTerm and fuzzySearch match (SearchTextMatching.ts:30-66).
    • isUnreadInCurrentCommunity and generateDefaultResults match (:144-189).
    • Recording visits (dedup by channel and guild, newest first, ≤ 20) matches SelectedChannel.ts:150-190.
    • switchTo matches for users (ensureDMChannel, no confirm), voice channels and guilds (QuickSwitcherCommands.tsx:63-91).
  5. Review Focus: no item belongs to Task 19.
  6. CI: local FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh review worktree: all steps passed.

Round 1 fix

heading_to is now cleared before the early return for an unchanged selection. I traced the switcher's follow-ups (SelectGuild then SelectChannel) through App::apply. ui.rs sets selected_channel unconditionally on SelectChannel, so every path that sets heading_to now clears it. When the guild's last channel is already the target, SelectGuild clears it and the visit is recorded only once. Fixed.

Findings

  • minor: QuickSwitcher.tsx:573-581 adds an "Open link" row for app-protocol deep links (isAppDeepLink). The native switcher only builds "Go to message" for /channels/… URLs. The native client has no app-protocol handler yet, so this is acceptable as is. It could get a later parity row.
  • minor (already deferred to #570): an INHERIT/NULL guild level counts as all messages until fluxer-proto has default_message_notifications.

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

## Independent review, round 2: Daily use 19 (core quick switcher) I reviewed `61e2eba..f1c41cb`: `switcher.rs`, the `app.rs` wiring, `tests/switcher.rs`, and the edits to `chat_persist.rs` and `dailyuse_ports.rs`. I read it without relying on the implementer's notes. ### Checks 1. **Plan tests**: all 12 named tests exist and assert the spec's values. They cover the previous-channel caps of 7 alone and 3 with other sections, the current channel left out, dedup, the 5/100 limits, the scores 10/7/5/3/1/0, listing scores of 7 and 6 with +3 capped at 10 or 7, the five mode headers, the diacritics and confusables fold, the muted and mentions-only exclusions, wraparound, the link row, and that Enter records and persists the visit. The new regression test `selecting_the_open_channel_keeps_recording_visits` reproduces round 1's blocking scenario. 2. **Interfaces**: `SwitcherAction` (from 11a) is unchanged. `switcher(&App) -> SwitcherModel { placeholder, mode_header, sections: Vec<SwitcherSection { header, rows: Vec<SwitcherRow { kind, title, subtitle, icon: SwitcherIcon, meta, unread, mentions }> }>, selected, empty: Option<(String, String)> }` matches the plan exactly. Visits load from `[navigation]` in `Persisted`, are written with `PersistOp::Navigation`, and carry the stored `selected_channels` unchanged, so Task 20's half of the table is not clobbered. 3. **Invariants**: no new dependencies, and nothing from iced, wgpu, winit, reqwest or tungstenite in core. Core does no I/O; the time comes from the existing `notif_settings` clock. The tests build on the existing READY and USER_GUILD_SETTINGS_UPDATE fixtures, and no new fixture is added. Byte slicing is safe because the prefix characters are ASCII. Link parsing and the fuzzy matcher cannot panic on server data. There are no secrets, tokens or paths. 4. **Parity spot-checks** against the fork: - The constants and `listChannels` match (`QuickSwitcherResultGenerators.ts:80-91`, `:405-433`). - `scoreSearchTerm`, `consumeBestSearchTerm` and `fuzzySearch` match (`SearchTextMatching.ts:30-66`). - `isUnreadInCurrentCommunity` and `generateDefaultResults` match (`:144-189`). - Recording visits (dedup by channel and guild, newest first, ≤ 20) matches `SelectedChannel.ts:150-190`. - `switchTo` matches for users (`ensureDMChannel`, no confirm), voice channels and guilds (`QuickSwitcherCommands.tsx:63-91`). 5. **Review Focus**: no item belongs to Task 19. 6. **CI**: local `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh review worktree: **all steps passed**. ### Round 1 fix `heading_to` is now cleared before the early return for an unchanged selection. I traced the switcher's follow-ups (`SelectGuild` then `SelectChannel`) through `App::apply`. `ui.rs` sets `selected_channel` unconditionally on `SelectChannel`, so every path that sets `heading_to` now clears it. When the guild's last channel is already the target, `SelectGuild` clears it and the visit is recorded only once. **Fixed.** ### Findings - **minor**: `QuickSwitcher.tsx:573-581` adds an "Open link" row for app-protocol deep links (`isAppDeepLink`). The native switcher only builds "Go to message" for `/channels/…` URLs. The native client has no app-protocol handler yet, so this is acceptable as is. It could get a `later` parity row. - **minor** (already deferred to #570): an INHERIT/NULL guild level counts as all messages until fluxer-proto has `default_message_notifications`. **Verdict: approved.** There are no blocking findings, and local CI is green.
Author
Owner

Review round 3 (independent, cold read) — Daily use 19 quick switcher

Scope: git diff 61e2eba..origin/dailyuse-19-core-quick-switcher (f1c41cb).

Checked

  1. Plan tests: all 12 named tests exist in crates/fluxer-core/tests/switcher.rs and assert the spec values (caps 3/7, ≤5 then 100, scores 10/7/5/3/1/0, listing 7/6 with +3 capped at 10/7, strings "Previous channels", "Mentions", "Unread channels", the mode headers, the placeholder, "No matches found" and its hint). There is also the regression test selecting_the_open_channel_keeps_recording_visits.
  2. Interfaces: SwitcherAction::{Open, Close, Toggle, Edit, Up, Down, Select(Option<usize>)}, switcher(&App) -> SwitcherModel { placeholder, mode_header, sections, selected, empty }, SwitcherSection { header, rows } and SwitcherRow { kind, title, subtitle, icon, meta, unread, mentions } all match the plan as written. Visits load from [navigation] at startup and are written back with PersistOp::Navigation. The stored selected_channels are preserved, newest first, deduped, ≤ 20.
  3. Invariants: no new dependencies and no I/O in fluxer-core. I found no panics on server data: the slicing is guarded and query[1..] follows an ASCII prefix. A link row needs the host of the instance or the web app. No secrets.
  4. Parity, checked against fluxer-soundboard:
    • SearchTextMatching.ts:41-47 scoring and buildChannelSearchTerms (only the first space becomes ( |-)) match.
    • The constants of QuickSwitcherResultGenerators.ts:84-95 and listChannels (:410-416) match, including the min(base+3, base>=7?10:7) cap.
    • generateDefaultResults matches: history cap 8-1, the first 3 hidden from the other sections, caps 3/7.
    • isUnreadInCurrentCommunity matches, with badge customisation off: guild ALL only, muted at any level excluded.
    • SelectedChannel.updateRecentVisit (dedup by channel+guild, MAX 20) and parsePrefix (@@, then one-character prefixes, trimmed) match.
  5. Review Focus: none of the items belongs to Task 19. Synced settings are not touched beyond [navigation].
  6. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in a fresh worktree on f1c41cb: all steps passed.

The heading_to fix holds. UiState always applies SelectChannel, and a selected row always has a channel. So the guard clears when the follow-up SelectChannel arrives, and also when the target is the channel already open.

Findings

  • minor: score_term lowercases the value before fuzzy_search. The original fuzzySearch(term.loweredText, value) compares against the value as written, so it is case-sensitive. Native therefore gives 1 to some mixed-case fuzzy matches where the original gives 0, for example "gnrl" vs "GeNeRaL". This only affects the fuzzy tier.
  • minor: "Mentions" is ordered by each channel's last_message_id (newest first). The original uses the reverse of ReadStates.mentionChannelIds insertion order. They are nearly always the same; this approximation is acceptable.
  • minor: a "Go to message" link to a channel the client does not know still records a visit. The Previous section drops the visit, because collect skips unknown channels, so nothing user-visible breaks.

Deviations stated in the PR (wiring in app.rs, the chat_persist and dailyuse_ports updates, no frecency, the hand-written confusables table, Q12 omissions, #570) are consistent with the spec and the plan.

Verdict: APPROVE (0 blocking, 3 minor; CI green locally).

## Review round 3 (independent, cold read) — Daily use 19 quick switcher Scope: `git diff 61e2eba..origin/dailyuse-19-core-quick-switcher` (f1c41cb). **Checked** 1. Plan tests: all 12 named tests exist in `crates/fluxer-core/tests/switcher.rs` and assert the spec values (caps 3/7, ≤5 then 100, scores 10/7/5/3/1/0, listing 7/6 with +3 capped at 10/7, strings "Previous channels", "Mentions", "Unread channels", the mode headers, the placeholder, "No matches found" and its hint). There is also the regression test `selecting_the_open_channel_keeps_recording_visits`. 2. Interfaces: `SwitcherAction::{Open, Close, Toggle, Edit, Up, Down, Select(Option<usize>)}`, `switcher(&App) -> SwitcherModel { placeholder, mode_header, sections, selected, empty }`, `SwitcherSection { header, rows }` and `SwitcherRow { kind, title, subtitle, icon, meta, unread, mentions }` all match the plan as written. Visits load from `[navigation]` at startup and are written back with `PersistOp::Navigation`. The stored `selected_channels` are preserved, newest first, deduped, ≤ 20. 3. Invariants: no new dependencies and no I/O in fluxer-core. I found no panics on server data: the slicing is guarded and `query[1..]` follows an ASCII prefix. A link row needs the host of the instance or the web app. No secrets. 4. Parity, checked against fluxer-soundboard: - `SearchTextMatching.ts:41-47` scoring and `buildChannelSearchTerms` (only the first space becomes `( |-)`) match. - The constants of `QuickSwitcherResultGenerators.ts:84-95` and `listChannels` (`:410-416`) match, including the min(base+3, base>=7?10:7) cap. - `generateDefaultResults` matches: history cap 8-1, the first 3 hidden from the other sections, caps 3/7. - `isUnreadInCurrentCommunity` matches, with badge customisation off: guild ALL only, muted at any level excluded. - `SelectedChannel.updateRecentVisit` (dedup by channel+guild, MAX 20) and `parsePrefix` (`@@`, then one-character prefixes, trimmed) match. 5. Review Focus: none of the items belongs to Task 19. Synced settings are not touched beyond `[navigation]`. 6. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in a fresh worktree on f1c41cb: **all steps passed**. The `heading_to` fix holds. `UiState` always applies `SelectChannel`, and a selected row always has a channel. So the guard clears when the follow-up `SelectChannel` arrives, and also when the target is the channel already open. **Findings** - minor: `score_term` lowercases the value before `fuzzy_search`. The original `fuzzySearch(term.loweredText, value)` compares against the value as written, so it is case-sensitive. Native therefore gives 1 to some mixed-case fuzzy matches where the original gives 0, for example "gnrl" vs "GeNeRaL". This only affects the fuzzy tier. - minor: "Mentions" is ordered by each channel's `last_message_id` (newest first). The original uses the reverse of `ReadStates.mentionChannelIds` insertion order. They are nearly always the same; this approximation is acceptable. - minor: a "Go to message" link to a channel the client does not know still records a visit. The Previous section drops the visit, because `collect` skips unknown channels, so nothing user-visible breaks. Deviations stated in the PR (wiring in app.rs, the chat_persist and dailyuse_ports updates, no frecency, the hand-written confusables table, Q12 omissions, #570) are consistent with the spec and the plan. **Verdict: APPROVE** (0 blocking, 3 minor; CI green locally).
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:45 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.