Cover the command palette's filter and confirm sub-page - #987
Merged
Conversation
command-palette.tsx had no unit test. Its two non-obvious pieces are a
hand-rolled cmdk `filter` that prefix-matches whole words of the title plus
the action's keywords (replacing cmdk's fuzzy score), and a confirm
sub-page whose whole job is saving and restoring the search term and the
highlighted row while intercepting Escape and Backspace.
20 tests, nothing mocked — cmdk and Radix run for real. 39 mutants, 33
killed. The six survivors are redundant or unreachable guards in the
component rather than test gaps: the confirm page's `filter -> () => 1`
bypass and the item-level `forceMount`s are both already covered by the
group-level `forceMount` (dropping that one does fail); the explicit
`setSelectedValue("confirm-launch")` duplicates cmdk's own select-first;
the two `setPendingAction(null)` calls each duplicate the page-stack reset
beside them (the paired mutants die); and `handleConfirm`'s `!pendingAction`
guard is unreachable because ConfirmPage only mounts when it is set.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtewwMHML727j5WsfouLpF
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.
Recurring Test Enforcer run. The local suite was green on the first pass (33rd consecutive), so this run spent its effort on the top-ranked uncovered surface from the Brain backlog:
apps/web/src/components/app/command-palette.tsx(306 lines, no test sibling).Suite status
pnpm run checkpnpm run format.prettierignorefix still holding, 10th run)pnpm run lint:webreact-refreshwarningspnpm run testpnpm run test:e2epnpm run test:e2e:livee2e-*tmux sessions (24th consecutive), zero leaked containersgh run list --limit 50)What this adds
command-palette.test.tsx— 20 tests, nothing mocked (cmdk and Radix run for real). It pins the two non-obvious pieces of the component:filter. cmdk's default is a fuzzy score; this one splits the title on whitespace and prefix-matches whole words, then appends the action'skeywords. Soshortfinds "Keyboard shortcuts" butboardfinds nothing, andspafinds "New agent" only through itsspawnkeyword.confirmfield defers the run, saves the search term and the highlighted row, and swaps the list for a Launch/Cancel page that intercepts Escape and Backspace. Cancel and Escape restore both saved values; Backspace only pops while the search is empty, and does nothing once the stack is empty (otherwise it would resurrect a term the user had cleared).Plus the plainer contracts: close-before-run ordering on both paths, disabled rows staying inert, groups with no actions not rendering, and the icon slot.
Mutation battery
39 mutants, 33 killed. The six survivors are all redundant or unreachable guards in the component, diagnosed rather than worked around:
filter → () => 1on the confirm page, and the item-levelforceMounts — both already covered by the group-levelforceMount(dropping that one does fail the suite).setSelectedValue("confirm-launch")— duplicates cmdk's own select-first-item.setPendingAction(null)calls — each duplicates the page-stack reset sitting beside it; the paired mutants die.handleConfirm's!pendingActionearly return — unreachable, sinceConfirmPageonly mounts when it is set.Notes
confirmfield — that producer was replaced by the template launch dialog in Add agent templates — split quick-launch from job automation #515 — so the confirm sub-page is reachable today only through the component's exported prop API. Recorded in the Brain backlog as a product-cleanup candidate rather than acted on here.ResizeObserverteardown, and two over-claiming test names. All were applied, and the reshaped tests were re-verified against the mutants they are supposed to catch.🤖 Generated with Claude Code
https://claude.ai/code/session_01CtewwMHML727j5WsfouLpF