Daily use 20: core-keyboard-navigation (#506) #579

Closed
charles wants to merge 0 commits from dailyuse-20-core-keyboard-navigation into dailyuse
Owner

What

fluxer-core keyboard navigation (spec §3.7, §6.2): UserAction::Navigate(NavAction) now acts.

  • crates/fluxer-core/src/keynav.rs: guild cycle and slots over [DMs, …guild order] (last channel, else first non-category/link/thread by position; DMs: last DM else home), Ctrl+Alt+→ DMs/last-guild toggle, channel walk (uncategorised first, then each category: text then voice; categories and links skipped, muted kept; wrap; not found → first/last), DM walk [home, …DMs], unread/mention walks in the current guild only, Escape only when unread, Shift+Escape → MarkGuildRead, CopyChannelLink, group DM picker, add-guild modal, CurrentCall, MarkTopInboxRead, JumpOldestUnread (through the existing JumpToMessage).
  • crates/fluxer-core/src/chat/navigation.rs: ChannelHistory for Alt+←/→ (channels gone since are passed over; not persisted).
  • crates/fluxer-core/src/ui.rs: last_channel_per_guild loaded from [navigation] selected_channels, dropped when gone after READY (kept for unavailable guilds), written with PersistOp::Navigation on change.

Tests

crates/fluxer-core/tests/keynav.rs: every test named by the plan plus toggle_guild_dms_and_the_rest. FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci green locally. No display tests (core only).

Deviations

  • Outside the Files list: crates/fluxer-core/src/app.rs (wiring the plan/reduce and the persist write, one op shared with the switcher's visits), chat/mod.rs (re-export), README.md; tests/dailyuse_ports.rs (NavAction no longer a stub) and tests/chat_persist.rs (selection now drives selected_channels).
  • Guild cycle passes over slots with nothing to open (unavailable guild); the Ctrl+Shift+E list is the original's getUnreadChannels (threads left out), documented in the module.
  • Failing tests and implementation were committed together in one commit (feat(core): keyboard navigation).

Stacked on: dailyuse-17-core-channel-guild-menus, dailyuse-19-core-quick-switcher

Closes #506

🤖 Generated with Claude Code

## What `fluxer-core` keyboard navigation (spec §3.7, §6.2): `UserAction::Navigate(NavAction)` now acts. - `crates/fluxer-core/src/keynav.rs`: guild cycle and slots over `[DMs, …guild order]` (last channel, else first non-category/link/thread by position; DMs: last DM else home), Ctrl+Alt+→ DMs/last-guild toggle, channel walk (uncategorised first, then each category: text then voice; categories and links skipped, muted kept; wrap; not found → first/last), DM walk `[home, …DMs]`, unread/mention walks in the current guild only, Escape only when unread, Shift+Escape → `MarkGuildRead`, `CopyChannelLink`, group DM picker, add-guild modal, `CurrentCall`, `MarkTopInboxRead`, `JumpOldestUnread` (through the existing `JumpToMessage`). - `crates/fluxer-core/src/chat/navigation.rs`: `ChannelHistory` for Alt+←/→ (channels gone since are passed over; not persisted). - `crates/fluxer-core/src/ui.rs`: `last_channel_per_guild` loaded from `[navigation] selected_channels`, dropped when gone after READY (kept for unavailable guilds), written with `PersistOp::Navigation` on change. ## Tests `crates/fluxer-core/tests/keynav.rs`: every test named by the plan plus `toggle_guild_dms_and_the_rest`. `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` green locally. No display tests (core only). ## Deviations - Outside the Files list: `crates/fluxer-core/src/app.rs` (wiring the plan/reduce and the persist write, one op shared with the switcher's visits), `chat/mod.rs` (re-export), `README.md`; `tests/dailyuse_ports.rs` (NavAction no longer a stub) and `tests/chat_persist.rs` (selection now drives `selected_channels`). - Guild cycle passes over slots with nothing to open (unavailable guild); the Ctrl+Shift+E list is the original's `getUnreadChannels` (threads left out), documented in the module. - Failing tests and implementation were committed together in one commit (`feat(core): keyboard navigation`). Stacked on: dailyuse-17-core-channel-guild-menus, dailyuse-19-core-quick-switcher Closes #506 🤖 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>
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>
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>
Uses the existing server-shaped fixtures: rest/invite_metadata.json
(POST /channels/{id}/invites, S/invite/InviteSchemas.ts:42-91 plus the
metadata fields), rest/guild.json (POST /guilds, GuildResponse) and
gateway/guild_create.json.

Refs #502

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The invite modal (default invite at open, settings clamped to the
server's limits, link, expiry text, friends and group DMs with
Invite -> Sent through SendMessage), can_invite / invite_channel for the
menus, "Create or join a community" (name, static icon, create then
select the system channel once its GUILD_CREATE is in, join through the
accept flow), and "Leave community" (Confirm::LeaveGuild, no Shift
bypass, no delete_messages; hidden for the owner; on success the guild
goes as its GUILD_DELETE would, so a selected one leaves for the DMs).

Refs #502

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dailyuse_ports listed them among the stubs that do nothing.

Refs #502

Co-Authored-By: Claude Opus 5.5 <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>
menus::{channel, category, guild} build the original's desktop menus
(AM/ChannelContextMenu.tsx, ChannelMenuData.tsx:429-632,
CategoryMenuData.tsx:263-339, GuildMenuData.tsx:314-497) with the "B"
rows of spec 3.2 (a)-(d). MarkCategoryRead and MarkGuildRead ack in
bulk through POST /read-states/ack; CopyId, CopyChannelLink and the
link channel's "Copy link" write the clipboard. Collapsed categories
are synced as the category override's `collapsed`
(UserGuildSettingsCommands.ts:198-246), written debounced 3 s with the
whole override map; "Hide muted channels" likewise. The sidebar reads
notif_settings::is_collapsed and emits UserAction::ToggleCategory
instead of keeping a local set.

New UserAction variants: CopyLinkChannelUrl, OpenNotificationSettings,
OpenFollowChannel (the last two open UI-owned modals).

Refs #503

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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>
# Conflicts:
#	crates/fluxer-core/src/app.rs
#	crates/fluxer-core/tests/dailyuse_ports.rs
The navigation keybinds of spec §3.7 as core actions (NavAction): guild
slots and cycle, channel/DM/unread/mention walks, back/forward history,
Escape and Shift+Escape, copy channel link, group DM, add guild, current
call, top inbox channel and oldest unread message. The last channel per
guild is loaded from and written to [navigation] selected_channels.

Refs #506

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

Independent review: Daily use 20 (core keyboard navigation)

I reviewed git diff df0f45f..origin/dailyuse-20-core-keyboard-navigation (d55e3b5).

Plan tests: all 15 tests named in the plan exist in crates/fluxer-core/tests/keynav.rs. Each one asserts what spec §3.7 asks for: slots [DMs, …guild order] with wrap, the last channel or else the first non-category non-link channel, the walk going text then voice in each category group, muted channels kept, not found → first/last, [home, …DMs], unread and mention walks limited to the current guild, Escape only when unread, Shift+Escape the same as the menu's MarkGuildRead, slots 1–9, history, current call, top inbox entry, oldest unread through JumpToMessage. There is also an extra test, toggle_guild_dms_and_the_rest.

Interfaces: all NavAction variants are acted on, with the exact names Task 11a gave them. last_channel_per_guild is loaded from [navigation] selected_channels and written with PersistOp::Navigation. New public names: chat::{ChannelHistory, HistoryEntry}, keynav::walk_order.

Invariants: keynav/ui/navigation are pure, with no new dependency and no I/O. GuildSlot is bounds-checked (0 and 10 are no-ops), and indexing is guarded by the count == 0 early return, so I found no way for server data to panic the client. The test fixtures are built from the READY fixture (link type 998 with url, matching the server). The code contains no secrets.

Implementer's questions:

  • Persist merge (.or(selection_op)): this is correct. selection_op runs first and updates settings.navigation.selected_channels in place. Switcher::follow_selection then builds its NavigationStored from settings.navigation.selected_channels.clone(), so the switcher's op carries both changes, and dropping selection_op loses nothing. When the switcher writes nothing (same channel, or heading_to), selection_op is the one emitted.
  • drop_gone_channels on READY: this runs only on the live READY, because the cached store is loaded another way. It keeps channels whose guild is unavailable, so an outage does not lose them. last_channel_survives_restart tests the drop and the write that follows it.
  • go_home forgetting the last DM: this matches the original. deselectGuild → navigateToDM() → SelectedChannel.selectChannel(ME, null) → removeGuildSelection(ME).

Parity spot-checks against the fork:

  • cycleGuildLikeSlot / navigateToGuildLikeSlot (KeybindManager.ts): match, apart from the documented divergence below.
  • getNextChannel (idx −1 → first going down, last going up): matches.
  • organizeChannels (root bucket first, then categories by compareChannelOrdering, text before voice): matches.
  • cycleDirectMessageContext ([home, …getSortedDmChannels]): matches.
  • recordViewedChannel / VIEWED_CHANNEL_HISTORY_LIMIT = 50 (SelectedChannel.ts): match.
  • chat_mark_guild_read: delegated to Task 17's MarkGuildRead.

Findings

  1. minor: keynav.rs NavAction::History filters history entries with navigable(), which excludes threads. The original's isStoredChannelNavigable (SelectedChannel.ts:99-103) only excludes categories and links. So Alt+←/→ skips a thread the user viewed, where the original goes back to it. This divergence is not documented. Suggested fix: use a check without the thread exclusion for history (channel exists, not category or link, can_view).
  2. minor: MarkTopInboxRead acks the newest channel in a getUnreadChannels-style list. The original handler (chat_mark_inbox_read, defaultHandlers.ts) acks ReadStates.getChannelIds().find(isUnreadOrMentioned), and only does so on the inbox's unreadChannels tab (the bookmarks and mentions tabs ack other things). The module docs cover the list choice, and it matches the spec's wording, but the tab dependence is not mentioned. Please add it to docs/parity/dailyuse.md.
  3. minor: the guild cycle passes over slots that have nothing to open (unavailable guilds), where the original stops. This is documented in the module docs. Please also record it in the parity divergences.

No blocking findings.

Local gate: FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci in the review worktree: green ("all steps passed", exit 0; livekit-interop skipped as usual).

Verdict: approve (0 blocking, 3 minor).

## Independent review: Daily use 20 (core keyboard navigation) I reviewed `git diff df0f45f..origin/dailyuse-20-core-keyboard-navigation` (d55e3b5). **Plan tests:** all 15 tests named in the plan exist in `crates/fluxer-core/tests/keynav.rs`. Each one asserts what spec §3.7 asks for: slots `[DMs, …guild order]` with wrap, the last channel or else the first non-category non-link channel, the walk going text then voice in each category group, muted channels kept, not found → first/last, `[home, …DMs]`, unread and mention walks limited to the current guild, Escape only when unread, Shift+Escape the same as the menu's `MarkGuildRead`, slots 1–9, history, current call, top inbox entry, oldest unread through `JumpToMessage`. There is also an extra test, `toggle_guild_dms_and_the_rest`. **Interfaces:** all `NavAction` variants are acted on, with the exact names Task 11a gave them. `last_channel_per_guild` is loaded from `[navigation] selected_channels` and written with `PersistOp::Navigation`. New public names: `chat::{ChannelHistory, HistoryEntry}`, `keynav::walk_order`. **Invariants:** `keynav`/`ui`/`navigation` are pure, with no new dependency and no I/O. `GuildSlot` is bounds-checked (0 and 10 are no-ops), and indexing is guarded by the `count == 0` early return, so I found no way for server data to panic the client. The test fixtures are built from the READY fixture (link type 998 with `url`, matching the server). The code contains no secrets. **Implementer's questions:** - *Persist merge (`.or(selection_op)`):* this is correct. `selection_op` runs first and updates `settings.navigation.selected_channels` in place. `Switcher::follow_selection` then builds its `NavigationStored` from `settings.navigation.selected_channels.clone()`, so the switcher's op carries both changes, and dropping `selection_op` loses nothing. When the switcher writes nothing (same channel, or `heading_to`), `selection_op` is the one emitted. - *`drop_gone_channels` on READY:* this runs only on the live READY, because the cached store is loaded another way. It keeps channels whose guild is `unavailable`, so an outage does not lose them. `last_channel_survives_restart` tests the drop and the write that follows it. - *`go_home` forgetting the last DM:* this matches the original. `deselectGuild` → `navigateToDM()` → `SelectedChannel.selectChannel(ME, null)` → `removeGuildSelection(ME)`. **Parity spot-checks against the fork:** - `cycleGuildLikeSlot` / `navigateToGuildLikeSlot` (KeybindManager.ts): match, apart from the documented divergence below. - `getNextChannel` (idx −1 → first going down, last going up): matches. - `organizeChannels` (root bucket first, then categories by `compareChannelOrdering`, text before voice): matches. - `cycleDirectMessageContext` (`[home, …getSortedDmChannels]`): matches. - `recordViewedChannel` / `VIEWED_CHANNEL_HISTORY_LIMIT = 50` (SelectedChannel.ts): match. - `chat_mark_guild_read`: delegated to Task 17's `MarkGuildRead`. ### Findings 1. **minor**: `keynav.rs` `NavAction::History` filters history entries with `navigable()`, which excludes threads. The original's `isStoredChannelNavigable` (SelectedChannel.ts:99-103) only excludes categories and links. So Alt+←/→ skips a thread the user viewed, where the original goes back to it. This divergence is not documented. Suggested fix: use a check without the thread exclusion for history (channel exists, not category or link, `can_view`). 2. **minor**: `MarkTopInboxRead` acks the newest channel in a `getUnreadChannels`-style list. The original handler (`chat_mark_inbox_read`, defaultHandlers.ts) acks `ReadStates.getChannelIds().find(isUnreadOrMentioned)`, and only does so on the inbox's unreadChannels tab (the bookmarks and mentions tabs ack other things). The module docs cover the list choice, and it matches the spec's wording, but the tab dependence is not mentioned. Please add it to `docs/parity/dailyuse.md`. 3. **minor**: the guild cycle passes over slots that have nothing to open (unavailable guilds), where the original stops. This is documented in the module docs. Please also record it in the parity divergences. No blocking findings. **Local gate:** `FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci` in the review worktree: green ("all steps passed", exit 0; livekit-interop skipped as usual). **Verdict: approve (0 blocking, 3 minor).**
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:39 +00:00

Pull request closed

Sign in to join this conversation.
No description provided.