Skip to content

Fix unfiltered select-all delete in admin error logs#291

Merged
bd73-com merged 3 commits intomainfrom
claude/fix-bug-v5Luw
Mar 27, 2026
Merged

Fix unfiltered select-all delete in admin error logs#291
bd73-com merged 3 commits intomainfrom
claude/fix-bug-v5Luw

Conversation

@bd73-com
Copy link
Copy Markdown
Owner

Summary

Fixes a bug where clicking "Select all" then "Delete" on the admin error logs page with no level/source filter active showed a blocking "Filter required" toast instead of performing the deletion. The fix falls back to sending the visible log entry IDs directly when no filter is active, while still using the more efficient filter-based bulk delete path when filters are set.

Changes

Bug fix (client/src/pages/AdminErrors.tsx):

  • Removed the "Filter required" toast that blocked unfiltered select-all deletion
  • When no filter is active, sends visible log IDs via the ids-based delete path instead of requiring the filters-based path
  • Imported and delegated to the new buildBatchDeletePayload utility

Refactor (client/src/pages/adminErrorsUtils.ts):

  • Extracted batch-delete payload construction into a pure, testable function buildBatchDeletePayload
  • Handles 4 code paths: no selection, individual selection, selectAll+filters, selectAll+no-filters

UX improvement (client/src/pages/AdminErrors.tsx):

  • Changed "All matching entries selected" → "All N visible entries selected" in the select-all checkbox label
  • Changed "All matching entries" → "N visible entries" in the floating action bar count
  • Prevents admins from thinking they're deleting all entries in the database when only the visible page (up to 100) is affected

Tests (client/src/pages/adminErrorsUtils.test.ts):

  • 11 unit tests covering all branches of buildBatchDeletePayload
  • Includes the specific bug scenario (selectAll + no filters)

How to test

  1. Log in as a Power-tier admin
  2. Navigate to Admin Error Logs (/admin/errors)
  3. Ensure no level or source filter is selected (both show "All")
  4. Click the "Select all" checkbox
  5. Verify the label says "All N visible entries selected" (not "All matching entries selected")
  6. Click "Delete selected" in the floating action bar
  7. Verify entries are deleted successfully (no "Filter required" toast)
  8. Also test with a filter active — should use the filter-based delete path as before

Server-side safety

No server changes. The server endpoint enforces:

  • Authentication + power-tier check
  • Per-entry authorization (monitor ownership or app owner)
  • Zod validation with max 500 IDs
  • The client query fetches at most 100 entries (limit=100)

https://claude.ai/code/session_012v1E6pJFJK1xhWH43SrACu

claude added 3 commits March 26, 2026 19:19
When "Select all" was active with no level/source filter, the batch
delete was blocked with a confusing toast. Now falls back to sending
the visible entry IDs directly instead of requiring a filter.

https://claude.ai/code/session_012v1E6pJFJK1xhWH43SrACu
Move the branching logic from handleBatchDelete into a pure function
buildBatchDeletePayload with 11 unit tests covering all code paths.
No behavior change — pure refactor of the prior commit's fix.

https://claude.ai/code/session_012v1E6pJFJK1xhWH43SrACu
Show "N visible entries" instead of "All matching entries" to avoid
implying all database entries are selected when only the visible page
(up to 100) is being deleted.

https://claude.ai/code/session_012v1E6pJFJK1xhWH43SrACu
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Warning

Rate limit exceeded

@bd73-com has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 38 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 82840114-753b-4f77-a26d-b2094063a10e

📥 Commits

Reviewing files that changed from the base of the PR and between 5d22c28 and e2aa8b0.

📒 Files selected for processing (3)
  • client/src/pages/AdminErrors.tsx
  • client/src/pages/adminErrorsUtils.test.ts
  • client/src/pages/adminErrorsUtils.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-bug-v5Luw

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bd73-com bd73-com added the fix label Mar 26, 2026 — with Claude
@bd73-com bd73-com merged commit 71dcbef into main Mar 27, 2026
1 check passed
@bd73-com bd73-com deleted the claude/fix-bug-v5Luw branch March 27, 2026 06:59
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.

2 participants