Skip to content

enhancement(search): bulk actions on RepositoryCase search results#400

Merged
therealbrad merged 1 commit into
mainfrom
enhancement/search-results-bulk-actions
Jun 4, 2026
Merged

enhancement(search): bulk actions on RepositoryCase search results#400
therealbrad merged 1 commit into
mainfrom
enhancement/search-results-bulk-actions

Conversation

@therealbrad
Copy link
Copy Markdown
Contributor

Description

Adds per-row selection on RepositoryCase hits in the global search (UnifiedSearch) plus a viewport-pinned bulk-action toolbar that surfaces two existing affordances against the current selection:

  • Bulk Edit — opens the existing BulkEditModal from the repository view with the selected case ids + project id; on save the selection clears.
  • Create Test Run — seeds sessionStorage["createTestRun_selectedCases"] and navigates to /projects/runs/<projectId>?openAddRun=true, the same handoff the repository view uses for its in-tab "Create Test Run from selection" flow.

Same-project gate

Selection is gated to a single project. When a selection spans projects, both action buttons are disabled with a tooltip explaining why, so cross-project selections never resolve to an ambiguous target. The selection auto-clears when the query, filters, or current-project-only scope change.

UX

The toolbar is pinned to the bottom of the viewport and matches the GlobalSearchSheet column on sm+ screens (fixed bottom-0 right-0 w-full sm:max-w-3xl); spans full-width on xs to match the Sheet behavior at that breakpoint. The search results area gets bottom padding while the toolbar is visible so the last row isn't covered.

The checkbox is only rendered on REPOSITORY_CASE hits — other entity types render unchanged. This leaves room for TestRun/Session bulk actions later without rewiring the underlying selection state.

Related Issue

N/A — internal backlog item (Brad's own pain point, surfaced 2026-06-04).

Type of Change

  • Enhancement (new affordance on an existing feature)

Testing

  • 6 new co-located tests in components/UnifiedSearch.test.tsx covering:
    • Checkbox visibility per entity type (cases only)
    • Toolbar appearance + count rendering
    • Cross-project selection disables both action buttons
    • BulkEditModal mounted with the correct (selectedCaseIds, projectId) shape
    • Create-Test-Run handoff seeds sessionStorage + routes to the correct project
    • Clear-selection control hides the toolbar
  • Existing 26 tests still pass. The next-intl mock now substitutes the count value so plural-key assertions work, and the i18n-aware ~/lib/navigation wrapper is mocked.
  • pnpm type-check clean.
  • pnpm precommit (lint + format:check) clean.

i18n

  • 5 existing strings reused: repository.cases.bulkEdit, repository.cases.createTestRun, common.actions.clear, repository.duplicates.selectRow, repository.duplicates.selected.
  • 2 new keys under search.bulk.* for the cross-project guard wording.
  • pnpm crowdin:sync propagated translations into all 13 non-English locales.

Checklist

  • Code follows the project style
  • No new warnings
  • Tests added
  • Self-reviewed
  • i18n synced across locales

Adds per-row selection on RepositoryCase hits in UnifiedSearch and a viewport-
pinned bulk-action toolbar that surfaces two existing actions against the
selection: Bulk Edit (reuses the BulkEditModal from the repository view) and
Create Test Run (seeds sessionStorage["createTestRun_selectedCases"] and
navigates to /projects/runs/<projectId>?openAddRun=true, the same handoff the
repository view uses).

Selection is gated to the same project: when the selection spans projects
both action buttons are disabled with a tooltip explaining why, so a
cross-project selection never resolves to an ambiguous target. Selection
clears automatically when the query, filters, or current-project-only scope
change.

Toolbar is fixed bottom-right with sm:max-w-3xl to match the GlobalSearchSheet
column on sm+ screens; spans full width on xs, same as the Sheet does at that
breakpoint. Search results get bottom padding while the toolbar is visible so
the last row isn't covered.

Checkbox is only rendered on REPOSITORY_CASE hits; other entity types
(TestRuns, Sessions, etc.) render unchanged, so multi-entity bulk actions can
be added later without rewiring this code.

i18n: 5 existing strings reused (repository.cases.bulkEdit, .createTestRun,
common.actions.clear, repository.duplicates.selectRow, .selected). Two new
keys added under search.bulk for the cross-project guard and synced to the
13 non-English locales via crowdin.

Tests: 6 new co-located cases in UnifiedSearch.test.tsx covering checkbox
visibility per entity type, toolbar appearance + count rendering, cross-
project disable + tooltip, BulkEditModal mount with the right (ids, projectId)
shape, the Create-Test-Run sessionStorage + navigation handoff, and the
clear-selection control. Existing 26 tests still pass; mocked next-intl now
substitutes the `count` value so plural-key assertions work, and the
i18n-aware navigation wrapper is mocked.
@therealbrad therealbrad merged commit df08b55 into main Jun 4, 2026
5 checks passed
@therealbrad therealbrad deleted the enhancement/search-results-bulk-actions branch June 4, 2026 04:04
@therealbrad
Copy link
Copy Markdown
Contributor Author

🎉 This PR is included in version 0.34.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant