55. Idempotent pick scans; BREAK_CASE is claimable
Status
Proposed (2026-10-24). Amends ADR-0054. Reuses the middleware of ADR-0028.
Context
A scan adds eaches to the task's pick count. The warehouse-floor-client keeps its commands in an offline
outbox and resends them with the same Idempotency-Key when a response is lost. Without a de-duplication
the resend counts the scan twice, and the pick reaches its planned quantity (or pick-over-quantity) early.
ADR-0054 also left BREAK_CASE out of AnyTaskType, so a station could not claim the task it must complete.
Decision
POST /tasks/{id}/scansruns behindRequireIdempotencyKey, inside the scan's own transaction. Same key and same body on the same path replays the stored status and body and does not apply the scan again (a stored 4xx is replayed too). A missing key is400 idempotency-key-required. The same key with a different body is409 idempotency-key-reused(was422, see ADR-0060), as forPOST /tasks.- Each physical scan uses its own key, so two scans with different keys both count.
- The key is one table key across routes and the scan body carries no task id, so the middleware now also
compares the stored path: the same key and body on another task is
409 idempotency-key-reused, not a replay. The 400 detail no longer says the endpoint "creates a resource". BREAK_CASEjoins the claimable task types:claim-nexttaskType, theAnyTaskTypeenum and the MCP process-path argument accept it. Station capabilities are matched as for every type, against the capabilities stamped on the task at release.BREAK_CASEis still not creatable throughPOST /tasks, andPOST /tasks/{id}/case-breaksstays the only way to complete it (POST /tasks/{id}/completionsis refused).
Consequences
- Breaking for callers of
POST /tasks/{id}/scansthat send no key: they get 400 until they send one. - Quantities stay in eaches;
TaskCompletedand the break call to inventory-storage are unchanged.