Mobile task completion silently ignores rejected saves and logs completion after failure
Product impact
Primary loop layer: Retrieval-Action. Task completion can fail without actionable feedback while success analytics are emitted even though the server rejected the change. This breaks trust in saved commitments.
Verification scope
Source-confirmed on upstream main at d1fdcb4cc4fbd021eac799630e476f144e6bc18a (2026-09-23). Relevant source blobs were checked against the audited checkout. The fault-injection/device steps below are the proposed reproduction and regression checks; they were not executed during this audit. Store-release exposure and affected-user counts are UNKNOWN.
Current behavior and evidence
The provider already returns a Boolean indicating the write result (app/lib/providers/action_items_provider.dart:447). The task-row swipe and checkbox await it but discard the result, then invoke the completion analytics callback based on the original item state (app/lib/pages/action_items/action_items_page.dart:1303, app/lib/pages/action_items/action_items_page.dart:1403). The chat task card also discards the result, although it already has a local duplicate-tap guard (app/lib/pages/chat/widgets/content_blocks/task_card_block.dart:47).
A rejected save can therefore roll the row back with no actionable explanation; the task-page controls can still emit the completion-success analytics event. The callback currently records analytics only; there is no visible celebration established in this code.
The callback implementation is app/lib/pages/action_items/action_items_page.dart:156.
Reproduction
- Load an incomplete task through the real Tasks page with a controlled API/provider fixture.
- Make the completion PATCH return a failure, keeping the existing task visible.
- Tap the checkbox, then repeat through swipe-to-complete and the chat task card.
- Observe that the save result is ignored; the Tasks page can invoke completion-success analytics despite rollback.
- Repeat with success to establish the expected success path.
Proposed fix
Consume the provider result at each completion entry point. Show localized failure feedback with a working Retry action and preserve the last confirmed state. Emit completion-success analytics only after a successful write. Serialize or disable competing writes per task across these surfaces so an older failure cannot revert a newer completion. Reuse the existing typed HTTP outcome contract where endpoint migration is needed; do not add a separate retry scheduler.
Acceptance criteria
- [ ] Failed checkbox, swipe and chat-card mutations show actionable failure feedback; no completion-success event is emitted.
- [ ] Successful mutations update all views and emit completion-success analytics at most once per action.
- [ ] Rapid taps and delayed/out-of-order responses cannot leave an older result as the final visible state.
- [ ] Refresh agrees with the server after both success and failure.
- [ ] Widget/provider tests exercise the actual controls and production provider, extending the existing action-item result tests.
Duplicate/fix check and scope
#15293 / merged #15294 fixed the edit sheet reporting success before writes completed. Merged #14960 fixed stale description/due-date fields in completion PATCHes. This issue covers the still-unhandled completion-control result after those fixes. The desktop retry issue #13102 is a different client/path.
Do not include the earlier suspected notification-cancellation rollback: cancellation catches its own errors (app/lib/services/notifications/action_item_notification_handler.dart:58). No notification-induced rollback is established here.