Release an order held at intake
POST/orders/:id/releases
The ReleaseHeldOrder use case (ADR 0020). Commits an order received with releaseOnAllocation: false to the floor: its already-allocated lines are released through the same BR3-gated flow every other release uses, the promise is recomputed by the same policy, and the same OrderAllocated/OrderReleased events fire with the same per-line payload.
IDEMPOTENT for a HELD order: releasing one whose lines are already released returns 200 with no state change and no event. A caller working against an external fill-or-kill deadline cannot distinguish "my release was lost" from "my release failed", so retrying must be safe.
An order that was never held has nothing to release on demand — its lines release themselves at allocation — so calling this on one is rejected with 409 rather than silently succeeding, since it means the caller has the wrong order id or the wrong expectation. This holds even when that order has no allocated lines of its own (a backordered order, say): "never held" and "already released" are different answers and must not collapse into one.
Idempotent through the Idempotency-Key header (REST guideline, ADR 0023/0048): a retry with the same key, method, path and body replays the stored answer with Idempotency-Replayed: true and runs nothing again, so the key row, the order change and the outbox rows commit together. A refusal that depends on the order's state or on a concurrent writer (order-not-held, concurrent-modification) is not stored: the key is released and a retry under the same key executes again; a refusal that is a function of the request (empty-order-id) and a 2xx are stored.
Request
Responses
- 200
- 400
- 404
- 409
- 500
- 503
The order after release (or unchanged, if already released).
Response Headers
Present, with the value true, ONLY when this response is a replay of the stored answer for the request's Idempotency-Key (the handler did not run again). The first execution of a key never carries it.
The Idempotency-Key header is missing (idempotency-key-required) or is not 1-128 printable ASCII characters (idempotency-key-invalid), or the order id in the path is invalid.
No order has this id.
This order was not held at intake, so it has nothing to release on demand (order-not-held); it has no allocated lines to release (no-allocated-lines) or no promise date (promise-date-not-set); or the write lost an optimistic-concurrency race (concurrent-modification). The same Idempotency-Key reused with a different method, path or body is also a 409 (idempotency-key-reused).
An unexpected internal error occurred.
inventory-storage could not be reached (transport error, timeout, open circuit breaker), answered with an unexpected status, or is wired in permissive (no-op) mode, or reported insufficient usable stock. Problem type is downstream-unavailable for an infrastructure failure, downstream-not-configured for permissive mode and insufficient-stock for the latter. Never papered over with a 2xx: allocating real stock must not appear to succeed when it did not.