Make screenshot uploads idempotent across mobile retries #471

Closed
opened 2026-08-10 09:49:47 +00:00 by timmy · 0 comments
Owner

Problem

Screenshot uploads are staged with stable operation keys in the durable mobile outbox, but POST /api/v1/repos/{owner}/{repo}/issues/{number}/attachments ignores Idempotency-Key. If Gitea accepts an upload and the mobile response is lost, retrying can create duplicate/orphaned assets. Foreground comment retries have the same ambiguity.

Slice

  • Accept and validate Idempotency-Key on attachment uploads.
  • Fingerprint repository, issue, filename, media type, and content digest through the existing durable authored-action ledger.
  • Replay confirmed results and reject key reuse with different content.
  • Give foreground selected files a stable key that rotates only when the file changes.
  • Preserve backward-compatible unkeyed uploads.

Acceptance

  • Same key and payload uploads once and replays the original 201 result.
  • Concurrent identical requests coalesce to one upstream upload.
  • Same key with changed content or target returns 409 without another upload.
  • Foreground retries reuse one key; replacing the file rotates it.
  • Existing outbox attachment stage keys are honored server-side.
  • Focused and full test suites pass.
## Problem Screenshot uploads are staged with stable operation keys in the durable mobile outbox, but `POST /api/v1/repos/{owner}/{repo}/issues/{number}/attachments` ignores `Idempotency-Key`. If Gitea accepts an upload and the mobile response is lost, retrying can create duplicate/orphaned assets. Foreground comment retries have the same ambiguity. ## Slice - Accept and validate `Idempotency-Key` on attachment uploads. - Fingerprint repository, issue, filename, media type, and content digest through the existing durable authored-action ledger. - Replay confirmed results and reject key reuse with different content. - Give foreground selected files a stable key that rotates only when the file changes. - Preserve backward-compatible unkeyed uploads. ## Acceptance - Same key and payload uploads once and replays the original 201 result. - Concurrent identical requests coalesce to one upstream upload. - Same key with changed content or target returns 409 without another upload. - Foreground retries reuse one key; replacing the file rotates it. - Existing outbox attachment stage keys are honored server-side. - Focused and full test suites pass.
timmy self-assigned this 2026-08-10 09:49:47 +00:00
timmy closed this issue 2026-08-10 09:56:37 +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#471
No description provided.