Skip to content

fix(backend): cancel the reminder when the developer API deletes a task - #15043

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
singhharsh1708:fix/backend-dev-api-delete-cancels-reminder
Sep 20, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
singhharsh1708:fix/backend-dev-api-delete-cancels-reminder

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15042

The developer API's task delete removed the task but never sent the reminder cancel, while its create and PATCH already keep reminders in sync and the Tasks API delete sends the cancel. A task deleted through an integration kept reminding the user.

The delete now calls sync_action_item_reminder(..., completed=True) after the row is removed, the same helper the PATCH path already imports here. That sends the cancel. The notification dispatch boundary check still holds.

One test added to tests/unit/test_dev_api_lock_bypass.py. On main it fails because sync_action_item_reminder is never called. With the fix it passes, along with the other tests in the file.

cd backend
python -m pytest tests/unit/test_dev_api_lock_bypass.py -q                        # 10 passed
BACKEND_UNIT_TEST_FILE_LIST=<that file, test_action_item_reminder_cancel_on_complete.py> bash test.sh   # passed

Line-Count-Exception: backend/routers/developer.py | 2548 -> 2549 | cancel the reminder of a task deleted through the developer API

Failure-Class: none

Review in cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified — this closes a real gap, and the fix is correct.

What I checked at c53c370:

  • backend/routers/developer.py — delete_action_item now calls sync_action_item_reminder(..., completed=True, due_at=None) after action_items_db.delete_action_item(...). In utils/notifications.py, that helper's cancel branch (completed or not due_at) dispatches send_action_item_deletion_message — the same action_item_delete FCM data message the app-side delete in routers/action_items.py sends — so the client cancels the scheduled local reminder, exactly the behavior described in [Bounty proposal] fix(backend): deleting a task through the developer API leaves its reminder armed ($25 proposed) #15042. The import was already in place for the PATCH path, so no new surface is introduced.
  • Failure semantics are safe: _send_to_user catches FCM errors and returns 0, so a push failure can't turn a successful delete into a 500 — identical to the app-side delete path.
  • backend/tests/unit/test_dev_api_lock_bypass.py — the new test_delete_action_item_cancels_scheduled_reminder patches the module-level helper and asserts the cancel call with completed=True, consistent with this file's stub harness; the other 9 tests are untouched. Backend CI on this head is green (unit suite, hermetic merge gate, hermetic E2E).

Two non-blocking notes:

  1. The cancel could call send_action_item_deletion_message directly (as the Tasks API delete does), but going through sync_action_item_reminder matches the PATCH path in the same file and is behaviorally identical — fine as-is.
  2. While auditing sibling paths I noticed DELETE /v1/conversations/{id}/action-items (routers/action_items.py) deletes items without sending any reminder cancel — a pre-existing gap on main, out of scope here, but likely worth a follow-up issue.

Thanks for the clean, well-scoped fix and the clear reproduction in the issue.

🤖 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 need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution candidate-clean-pr Small, safe, well-scoped, well-tested contribution; model clean PR backend Backend Task (python) labels Sep 19, 2026
@aryanorastar

Copy link
Copy Markdown
Collaborator

Verified on current main (1ef3b91). Developer API delete_action_item removes the row and returns success without sync_action_item_reminder. Create and PATCH in the same file already sync, and the Tasks API delete sends the cancel. A task deleted through an integration keeps reminding.

The one-line cancel after the delete reuses the existing import. The new test in test_dev_api_lock_bypass.py fails on main because the helper is never called.

I am not merging.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

fix(backend): confidence 5/5 - root cause, fixes #15042, tiny scoped diff (15 lines), CI green, new regression test.

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

Labels

backend Backend Task (python) candidate-clean-pr Small, safe, well-scoped, well-tested contribution; model clean PR positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty proposal] fix(backend): deleting a task through the developer API leaves its reminder armed ($25 proposed)

4 participants