Skip to content

fix(web): only restore failed deletes on partial bulk-delete failure (#22803) - #22968

Merged
kodjima33 merged 1 commit into
mainfrom
watchdog/issue-22803-bulk-delete-partial-failure
Oct 21, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
watchdog/issue-22803-bulk-delete-partial-failure

Conversation

@kodjima33

@kodjima33 kodjima33 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Bug

Web Tasks: a partly failed bulk delete restores every selected task, not just the ones whose DELETE failed (#22803).

bulkDelete in web/app/src/hooks/useActionItems.ts optimistically removes the selected tasks, then await Promise.all(ids.map((id) => deleteActionItem(id))). Promise.all rejects as soon as the first DELETE rejects, and the catch block unconditionally restores the entire deletedItems selection — including tasks whose DELETE already succeeded server-side. Those tasks reappear in the UI as ghosts: gone on the server, listed in the client, and opening one fails until the next reload drops it again.

Fix

Switch to Promise.allSettled and only restore the ids whose delete actually rejected. Tasks the server already deleted stay gone; the error still surfaces.

What I tested

  • Added a regression test (useActionItems.test.tsx) that deliberately keeps the background reload a successful delete's cache invalidation triggers pending (never resolves), so the assertion isolates bulkDelete's own revert logic from a later refetch that would otherwise mask the bug. Verified it fails on the pre-fix code (['a','b','c'] restored) and passes post-fix (['b'] only).
  • Full web/app suite: bun run test (vitest 869/869 + moonshine smoke) — pass.
  • bun run typecheck — clean.
  • bunx oxlint src scripts moonshine.config.ts — no new warnings (pre-existing warnings elsewhere unrelated to this change).

🤖 automated by hourly watchdog — tested and merged

Failure-Class: none

View guided diff Turn on auto-fix

…22803)

bulkDelete in useActionItems.ts awaited Promise.all over the selected ids
and, on any single rejection, restored the *entire* selection in the catch
block -- including tasks whose DELETE had already succeeded server-side.
Those tasks reappeared as ghosts (gone on the server, listed in the UI;
opening them failed) until the next reload dropped them again.

Switch to Promise.allSettled and only restore the ids that actually
failed. Added a regression test that isolates bulkDelete's own revert
logic from the background reload a successful delete's cache
invalidation triggers (so the test can't pass merely because a later
refetch happens to correct the state).
@kodjima33
kodjima33 merged commit e6877ad into main Oct 21, 2026
49 checks passed
@kodjima33
kodjima33 deleted the watchdog/issue-22803-bulk-delete-partial-failure branch October 21, 2026 04:12
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