0032. Confirm picks from a pick-completion event, not from a REST call
Status
Superseded by ADR 0035 (2026-10-07). Was Proposed on 2026-10-06; the direction decided here is kept and implemented by 0035.
Does not change ADR 0003: lazy reservation expiry is kept ("Decided 2026-10-06: kept").
Context
POST /reservations/{id}/pick-confirmations (ConfirmPick) is what turns a
reservation into a physical decrement: it consumes the reservation, removes the
quantity from its stock unit(s), releases bin capacity and raises StockPicked.
The 2026-10-05 audit found that no sibling context calls it — only the
e2e-tests warehouse-day simulator does — so in a real deployment reserved
stock is never confirmed as picked: reservations simply expire (lazily, ADR
0003) and the physical decrement never reaches this ledger.
The architect decided on 2026-10-06 (decision 9c) how the gap closes:
- Event-driven. inventory-storage consumes a pick-completion integration
event published by fulfillment-execution and confirms the matching reservation
itself, by calling the existing
ConfirmPickuse case. - No synchronous REST or MCP call from fulfillment-execution or
wes-work-planning into this context (matches the fleet's event-driven
direction and keeps those contexts unaware of
Reservation). - Implement only if an existing event already carries what is needed; otherwise record the missing fields and do not guess a payload.
Finding: no existing event carries what is needed
fulfillment-execution's integration topic warehouse.fulfillment.events
(apis/asyncapi.yaml on origin/develop) publishes TaskCompleted,
TaskCPTMissed and PackageManifested. The only pick-shaped one is
com.warehouse.wes.fulfillment-execution.task.TaskCompleted, whose data is:
task_id, station_id, work_unit_id, associate_id, duration_seconds,
task_type (PICK|PACK|SLAM|REBIN).
ItemPicked exists, but only on the internal analytics topic
(warehouse.fulfillment.analytics) and carries only task_id and task_type.
Against what ConfirmPick needs, none of the following is present:
- A reservation correlation.
ConfirmPicktakes areservationId. This service's reservations are created by order-management withdemandRef = OrderId, one reservation per order line (SKU + quantity, idempotency keyres-<order>-line-<n>-att-<k>).TaskCompletedcarries neither a reservation id nor thedemandRef/OrderId —work_unit_idis wes-work-planning's own identifier, and nothing in the published contracts states that it equals the order id or maps to its lines. - A SKU and a picked quantity per line. A pick task can span several order
lines (several reservations). Without
sku+quantityper line the consumer cannot choose which reservation(s) the completion settles, nor detect a short pick. - A short-pick rule.
ConfirmPickis all-or-nothing on a reservation (it consumes the full reserved quantity). What a partial pick should do (confirm what was picked and revoke/re-reserve the rest) is a business rule no ADR specifies; inventing it here is out of bounds.
Mapping work_unit_id → reservation would therefore be a guess, and a wrong
guess silently removes stock from the wrong order's reservation. Not
implemented.
Decision
-
Direction (final): pick confirmation reaches this context as a CloudEvents integration event consumed by an idempotent Kafka consumer that calls
ConfirmPick. No sync REST/MCP from siblings. -
Consumer shape when implemented (so the follow-up is mechanical): a fixed-group, state-mutating consumer per the fleet at-least-once atomicity checklist —
FetchMessageand commit only after the handler returns nil; capped-backoff retry of the same message on transient errors; deterministic poison (not CloudEvents, unknowntype, malformed payload, unknown or already-resolved reservation) logged and committed past; theprocessed_eventsclaim,ConfirmPick's writes and the outbox rows in oneUnitOfWork; a unique, env-overridable consumer group; DLQ for poison; testcontainers Kafka + Postgres integration test. -
Missing fields, by repository (a new additive event or an additive version of an existing one; nothing here is a breaking change):
repo must add fulfillment-execution publish a pick-completion event on warehouse.fulfillment.events(e.g. an integration-topicPickCompleted/ItemPicked, or additive fields onTaskCompletedfortask_type=PICK) carrying, per picked line:reservation_idor (demand_ref= the OrderId used when reserving andsku), plusquantitypicked.wes-work-planning WorkReleasedmust hand fulfillment-execution the correlation it will echo back (demand_ref/ order id, and the per-linesku+quantity, or thereservation_ids) — fulfillment-execution only knowswork_unit_idtoday.order-management only if wes-work-planning cannot obtain reservation_ids elsewhere: expose them to wes-work-planning (e.g. onOrderAllocatedlines).demandRef+skuis already enough to find a reservation here viaFindByDemandRef, so this is optional.Product decisions still to take before the consumer is written (not made here): short-pick behaviour, and whether a duplicate/late completion for an already
EXPIRED/REVOKEDreservation is dropped or alarms. -
Lazy expiry stays (ADR 0003). Decided 2026-10-06: kept — no background sweeper. The accepted trade-off (an unread, unrevoked reservation holds stock until something reads it) is unchanged; once picks are event-driven the reservation is resolved by the confirmation itself, which narrows the gap further.
Consequences
- Until the upstream fields exist, reserved stock is still not confirmed as picked in a real deployment; the REST route remains for the simulator and operators. The docs mark the gap as "Decided 2026-10-06: event-driven (ADR 0032, Proposed, blocked on fulfillment-execution / wes-work-planning fields)" rather than as an open question.
- No change to the
ConfirmPickuse case, the REST contract or any published event in this record. - When the consumer lands it adds one consumer group and one DLQ topic to operate, and supersedes the "no sibling confirms picks" notes in the context map.