Skip to content

feat(frontend): filter the session-start playbook picker by category - #87

Merged
sourcehawk merged 2 commits into
mainfrom
worktree-playbook-picker-polish
Aug 26, 2026
Merged

feat(frontend): filter the session-start playbook picker by category#87
sourcehawk merged 2 commits into
mainfrom
worktree-playbook-picker-polish

Conversation

@sourcehawk

Copy link
Copy Markdown
Owner

Description

The single playbook select at session start listed every playbook as one long unwrapped id — symptom line with no grouping. It is now two selects side by side: a Category select over the playbook types (investigation first, then alphabetical) that filters the Playbook select next to it. Native <option> elements can't render two lines, so the category description and the chosen playbook's symptom render as wrapping helper text under each select rather than inside the list.

Changes

  • Category select ("All categories" + each type) filters the Playbook select; picking a playbook snaps the category to its type, and switching to a category that no longer contains the chosen playbook clears it back to the guided default.
  • Type descriptions from GET /api/playbook-types render under the Category select; the chosen playbook's symptom (or description) renders under the Playbook select. Both wrap inside a max-w-2xl grid.
  • groupPlaybooks in lib/playbook-select.ts owns the grouping and description lookup, so the form only renders.

Testing

Unit tests cover the grouping helper (order, description lookup, unknown types) and the form (category filtering, description rendering, category snap on pick, reset on category switch). Full frontend vitest suite passes (241 tests) and npm run typecheck is clean. Worth poking at in the browser: the picker with a type that has no description, and a catalog where every playbook shares one type.

🤖 Generated with Claude Code

https://claude.ai/code/session_017UzTvd2zctxr2LYid6SucC

… and playbook selects

The single flat select listed every playbook as "id — symptom" in one long unwrapped line. It is now two selects side by side, capped at max-w-2xl: a Category select over the playbook types (investigation first, then alphabetical) that filters the Playbook select next to it. The active category's description from GET /api/playbook-types renders under the first select, and the chosen playbook's symptom (or description) wraps under the second. Picking a playbook snaps the category to its type; switching to a category that no longer contains the chosen playbook clears it back to the guided default.

groupPlaybooks in lib/playbook-select.ts owns the grouping so the form only renders.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UzTvd2zctxr2LYid6SucC
Copilot AI lite review requested due to automatic review settings August 26, 2026 01:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The grouping/filtering logic is self-contained, aligns with the stated behavior in the PR description, and is covered by targeted unit/UI tests.

Pull request overview

This PR improves the session-start playbook picker UX in the embedded Next.js frontend by introducing a category (“type”) selector that filters the playbook selector, while still keeping the underlying catalog rules (locked/disabled/broken filtering and investigation-first ordering) centralized in frontend/lib.

Changes:

  • Added groupPlaybooks() helper to bucket selectable playbooks by type and attach type descriptions from GET /api/playbook-types.
  • Updated InvestigationForm to render side-by-side Category and Playbook selects, with wrapping helper text for the selected category and playbook.
  • Added unit tests covering grouping/description behavior and the form’s category filtering + snap/reset interactions.
File summaries
File Description
frontend/lib/playbook-select.ts Introduces PlaybookGroup + groupPlaybooks() to group selectable playbooks and decorate them with type descriptions.
frontend/lib/playbook-select.test.ts Adds tests for grouping order, description lookup, and unknown type handling.
frontend/components/investigations/InvestigationForm.tsx Replaces the single playbook select with a Category + Playbook picker driven by groupPlaybooks().
frontend/components/investigations/InvestigationForm.test.tsx Adds UI tests for category filtering, description rendering, category snap-on-playbook-pick, and reset on category switch.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

… fields

The Category and Playbook selects now use the same uppercase label, full-width input, and small zinc helper text as the sibling inputs, and the grid spans the form instead of stopping at max-w-2xl. Extra spacing separates the section heading from the selects.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UzTvd2zctxr2LYid6SucC
Copilot AI review requested due to automatic review settings August 26, 2026 01:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are cohesive, match the stated behavior in the PR description, and include targeted tests for both the helper and the updated form interactions.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sourcehawk
sourcehawk merged commit 33389d5 into main Aug 26, 2026
6 checks passed
@sourcehawk
sourcehawk deleted the worktree-playbook-picker-polish branch August 26, 2026 19:58
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.

2 participants