Skip to content

Cover the command palette's filter and confirm sub-page - #987

Merged
selfcontained merged 1 commit into
mainfrom
agt_92e24dd05da7/job-test-enforcer-d9c681a0
Aug 21, 2026
Merged

Cover the command palette's filter and confirm sub-page#987
selfcontained merged 1 commit into
mainfrom
agt_92e24dd05da7/job-test-enforcer-d9c681a0

Conversation

@selfcontained

Copy link
Copy Markdown
Owner

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

Lane Result
pnpm run check pass
pnpm run format pass on a warm tree (#942's .prettierignore fix still holding, 10th run)
pnpm run lint:web 0 errors, 4 pre-existing react-refresh warnings
pnpm run test server 163 files / 2797 tests, web 70 → 71 files / 1044 → 1064, ext 60
pnpm run test:e2e 181 passed, 12 skipped
pnpm run test:e2e:live 11 passed in 20.8s, zero leaked e2e-* tmux sessions (24th consecutive), zero leaked containers
CI scan (gh run list --limit 50) 44/50 success; all six failures are ones prior runs already triaged, none a test flake

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:

  • The hand-rolled filter. cmdk's default is a fuzzy score; this one splits the title on whitespace and prefix-matches whole words, then appends the action's keywords. So short finds "Keyboard shortcuts" but board finds nothing, and spa finds "New agent" only through its spawn keyword.
  • The confirm sub-page state machine. Selecting an action with a confirm field 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 → () => 1 on the confirm page, and the item-level forceMounts — both already covered by the group-level forceMount (dropping that one does fail the suite).
  • setSelectedValue("confirm-launch") — duplicates cmdk's own select-first-item.
  • The two setPendingAction(null) calls — each duplicates the page-stack reset sitting beside it; the paired mutants die.
  • handleConfirm's !pendingAction early return — unreachable, since ConfirmPage only mounts when it is set.

Notes

  • No product bugs surfaced, so no Linear ticket.
  • Nothing in the repo currently passes an action with a confirm field — 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.
  • One review agent inspected the diff and found seven items: three assertions that could not fail, two tests that certified cmdk rather than this component, an asymmetric ResizeObserver teardown, 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

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
@selfcontained
selfcontained merged commit 301b1f6 into main Aug 21, 2026
1 check passed
@selfcontained
selfcontained deleted the agt_92e24dd05da7/job-test-enforcer-d9c681a0 branch August 21, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant