Repository navigation
fix(backend): cancel the task reminder when a conversation task is deleted - #15175
Conversation
|
Bounty proposal for this fix: #15176 ($25 proposed). |
aryanorastar
left a comment
There was a problem hiding this comment.
Verified on 60c670c61603.
DELETE /v1/conversations/{id}/action-items still mirrors the standalone row and never sends the deletion data message, so a swipe-deleted dated task keeps its client-scheduled reminder. Same gating as the cascade path (#15041): open + due_at. Tests cover the cancel and the no-reminder cases.
Units, hygiene, and preflight are green on this SHA. I am not merging.
|
Verified end to end — the analysis in the description matches the code, and this completes the reminder-reconciliation coverage on the last delete path.
One non-blocking process note: the PR body declares Failure-Class: none, but by its own account this is the latest in a series of fixes for the same 'mutation path forgets to reconcile the client-scheduled reminder' class (#14983/#14984, #15041, #15043, #15028/#15029). Per the AGENTS.md repair-the-boundary rule that pattern is due a registered failure class / reusable guard so the next missed call site fails a check instead of a user's phone — good follow-up material, not a blocker for this fix. 🤖 Automated review on behalf of the maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…ation Main now cancels the reminder on this path (BasedHardware#15175) but the action item vector stays behind, so task search keeps ranking a deleted task and returns fewer results than asked for. The standalone delete route already drops it; the handler in action_items.py that did it for this path is the shadowed duplicate in KNOWN_DUPLICATES. Verified: the new test plus the reminder and vector test files pass with test.sh; the vector assertions fail on main. Failure-Class: none
…ation (#15317) Main now cancels the reminder on this path (#15175) but the action item vector stays behind, so task search keeps ranking a deleted task and returns fewer results than asked for. The standalone delete route already drops it; the handler in action_items.py that did it for this path is the shadowed duplicate in KNOWN_DUPLICATES. Verified: the new test plus the reminder and vector test files pass with test.sh; the vector assertions fail on main. Failure-Class: none
…ation (BasedHardware#15317) Main now cancels the reminder on this path (BasedHardware#15175) but the action item vector stays behind, so task search keeps ranking a deleted task and returns fewer results than asked for. The standalone delete route already drops it; the handler in action_items.py that did it for this path is the shadowed duplicate in KNOWN_DUPLICATES. Verified: the new test plus the reminder and vector test files pass with test.sh; the vector assertions fail on main. Failure-Class: none
Summary
DELETE /v1/conversations/{conversation_id}/action-items(delete_action_iteminbackend/routers/conversations.py) removes one task from the conversation's structured list and mirrors the deletion into the standaloneaction_itemscollection, but never tells the client, so the task's scheduled reminder stays armed on the phone.Impact
The mobile client schedules a local notification for a task with a due date and cancels it only when the backend sends the
action_item_deletedata message (app/lib/services/notifications/action_item_notification_handler.dart→handleDeletionMessage). Both swipe-delete call sites (app/lib/providers/conversation_provider.dart:1579,app/lib/pages/conversation_detail/conversation_detail_provider.dart:311) just calldeleteConversationActionItemand drop the result, so nothing cancels locally either. Deleting a dated task from the conversation view therefore leaves its reminder to fire later for a task that no longer exists.This is the same class already fixed on the sibling paths: #15041 (conversation cascade delete), #15043 (developer API delete), #14983/#14984 (checking a task off inside a conversation, the PATCH handler directly above this one), #15028/#15029 (MCP task writes).
Fix
Mirror the cancel into the same loop that mirrors the deletion: for each stored row whose description matches, after deleting it, call
sync_action_item_reminder(..., completed=True, due_at=None)when the row was an open task with a due date (the exact gating #15041 uses on the cascade path). 12 lines, local import like the two other reminder call sites in this router.Tests
Added to
backend/tests/unit/test_conversation_events_bounds.py, reusing the module's fresh-import router fixture that #14984's reminder tests already use:delete_action_item+sync_action_item_reminder(user_id, action_item_id, description='', completed=True, due_at=None))Verification
Against
origin/mainconversations.pythe new test fails (sync_action_item_remindercalled 0 times), confirming the reminder was never cancelled.Note: the other handler registered for this method+path (
action_items.py) is the known shadowed duplicate documented in.github/scripts/check_duplicate_routes.pyKNOWN_DUPLICATES; the mounted handler is the one changed here.Failure-Class: none
Line-Count-Exception: backend/routers/conversations.py | 2281 -> 2293 | mirror the reminder cancel for the deleted row in the swipe-delete handler; the loop that mirrors the deletion is the only correct place for it