Add unit coverage for useAgentHotkeys - #874
Merged
Merged
Conversation
The agent-view hotkey hub (Cmd+K palette, agent cycling, terminal focus, sidebar toggles) had no direct coverage. New use-agent-hotkeys.test.tsx (24 tests) pins: - cycleAgent: nested review agents filtered before indexing (a review agent preceding the selection must not shift the cycle order), empty list no-navigate, no-selection first/last by direction, modulo wraparound, and top-level review-role agents staying cycleable - focus-terminal-input: enabled option (!isMobile && canFocusTerminal) plus the handler's own canFocusTerminal guard - toggle-media-sidebar desktop/mobile guard halves and state inversion - toggle-agent-sidebar inversion, palette open/close toggle - palette actions (new-agent, keyboard-shortcuts navigation) and callable-template gating of paletteGroups, launch template resolution Hotkey registration is mocked with a per-render registry that refuses to fire disabled hotkeys (matching production reachability); navigation is asserted through a real MemoryRouter location probe. 13-mutant battery run, all killed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Recurring test-enforcer run. Local suite was green on first pass (16th consecutive run):
checkok; unit server 2394 / web 590 / extension 60 / scripts 4; inert E2E 175 passed / 12 skipped (1.1m); live tmux lane 11 passed (20.6s) with zero leaked sessions. CI scan clean. With the suite stable, this run closes thenext_focuscoverage gap: the agent-view hotkey hub had no direct tests.What's covered
New
apps/web/src/hooks/use-agent-hotkeys.test.tsx(24 tests):MemoryRouterlocation probe.enabled: !isMobile && canFocusTerminalregistration option (both halves) plus the handler's independentcanFocusTerminalguard.new-agent→ create dialog,keyboard-shortcuts→/settings/help/shortcuts.run()closes the palette and resolveslaunchTemplate,?? nullfallback for cleared/unknown ids.The
useHotkeymock captures handler + options per render and refuses to fire disabled hotkeys, so tests can't certify behavior production would never reach.Verification
use-agent-hotkeys.ts— all 13 killed (one initially survived:findIndexagainst the unfiltered list; killed by the review-agent-precedes-selection test).pressHotkey), 2 nits applied (mock-lifetime comment, media toggle call counts). Theas Agent/as Templatefixture-cast nit was intentionally left — the factories set every field the hook reads.pnpm run check, full unit suite,pnpm run finalize:weball green after the review fixes.🤖 Generated with Claude Code