Make mobile authored actions idempotent across retries #185

Closed
opened 2026-08-07 09:48:43 +00:00 by rockachopa · 0 comments
Member

Problem

Mobile issue comments, pull-request comments, notification replies, and pull-request reviews preserve drafts after retryable timeouts, but their API requests have no stable operation identity. If Gitea accepts a mutation before the dashboard deadline, a retry can duplicate the authored content or review. Issue creation already solves this for its own flow (#177); these four routes remain unconditional POSTs.

Scope

  • Persist a per-draft operation ID for issue comments, PR comments, notification replies, and review submissions.
  • Send it as Idempotency-Key.
  • Reuse one bounded backend operation registry across authored mutation routes.
  • Replay concurrent/timed-out successful operations and reject a reused key with a changed route, target, or payload.
  • Clear the operation ID only after confirmed success; preserve it across reload/retry.

Acceptance tests

  1. Same key + same payload performs one upstream mutation and replays its confirmed response.
  2. Same key + changed target or payload returns 409 without another mutation.
  3. A caller timeout does not cancel the upstream operation; retry recovers the result.
  4. Frontend reload restores each draft's key, and success clears draft + key.
  5. Focused tests and the full suite pass.

Non-duplication

Historical issue #177 and commits 6f54d57/1947f87 cover only issue creation. No open or closed issue, open PR, or recent commit covers idempotent comments, replies, or reviews.

## Problem Mobile issue comments, pull-request comments, notification replies, and pull-request reviews preserve drafts after retryable timeouts, but their API requests have no stable operation identity. If Gitea accepts a mutation before the dashboard deadline, a retry can duplicate the authored content or review. Issue creation already solves this for its own flow (#177); these four routes remain unconditional POSTs. ## Scope - Persist a per-draft operation ID for issue comments, PR comments, notification replies, and review submissions. - Send it as `Idempotency-Key`. - Reuse one bounded backend operation registry across authored mutation routes. - Replay concurrent/timed-out successful operations and reject a reused key with a changed route, target, or payload. - Clear the operation ID only after confirmed success; preserve it across reload/retry. ## Acceptance tests 1. Same key + same payload performs one upstream mutation and replays its confirmed response. 2. Same key + changed target or payload returns 409 without another mutation. 3. A caller timeout does not cancel the upstream operation; retry recovers the result. 4. Frontend reload restores each draft's key, and success clears draft + key. 5. Focused tests and the full suite pass. ## Non-duplication Historical issue #177 and commits 6f54d57/1947f87 cover only issue creation. No open or closed issue, open PR, or recent commit covers idempotent comments, replies, or reviews.
timmy was assigned by rockachopa 2026-08-07 09:48:43 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: stackchain/stackchain-dashboard#185
No description provided.