Pickup collection - deposit, collect and the uncollected hold
Status
Accepted (2026-11-13). The shipping-and-tracking half of RN-0011; the point itself is node-topology's ADR 0017 and the quoted destination is delivery-promise's ADR 0027.
Context
A checkout may name a pickup point instead of a ship-to address. The label must key the point (one stop of last-mile capacity serves every package of the point), the wave's successful attempt must become a collection-ready package rather than a doorstep delivery, the shopper (or the point's operator) reports the collection, and a package nobody collects must re-enter the network as reverse freight instead of occupying the point forever.
Decision
IssueLabelbranches on customer-ordering's destination: aPICKUP_POINTorder answers{destinationKind, pickupPointId}with no address fields. No address is read, checked or sealed; the stop key is the HMAC ofpickup-point|<pointId>, so every package of one point shares one stop; the label's prefix is the point's own prefix. An unknown, retired or non-ACTIVE point is refused (pickup-point-unavailable); the local PickupPointView is node-topology's node stream folded locally (the same consumer group as the area modes, one group, two views).- The journey gains
READY_FOR_COLLECTION(the wave's DELIVERED attempt at a point is aPOINT_DEPOSITEDscan, never a doorstep DELIVERED) andCOLLECTED(terminal, entered by aCOLLECTEDscan carrying an optional proof code).READY_FOR_COLLECTIONis NOT terminal - the return path needs it. A FAILED attempt at a point keepsDELIVERY_FAILED: the package rides back to the station with the route. PackageReadyForCollection(withholdUntil) andPackageCollectedare published; delivery-promise judges a pickup promise on the first, as a ship-to promise is judged onPackageDelivered.- The uncollected sweep walks the expired holds and returns each package
(
ReturnUncollected):PackageReturnedgains the reasonUNCOLLECTED. The hold isPICKUP_HOLD_DAYS(default 7, a chart value, no secret). - The consumed
NodeRegisteredcopy carries the node's ownpostalCode: a pickup point's location is infrastructure data the producer already publishes on its contract - it is not a customer ship-to, and the ship-to fitness rule exempts exactly this consumed copy.
Consequences
- No compartment inventory: a locker is a pickup point, holds are per package, and per-compartment rules are a named follow-up.
- The point's operator reports collection through the existing scans route (a
COLLECTEDscan); a dedicated partner-facing surface is a follow-up. - The collection proof (
proofCode) is optional and carried in the open: it names nobody.
Addendum 2026-11-18: a status fact changes only the state of a pickup point
The Decision above is unchanged. This addendum records how the PickupPointView is written, which the Decision did not spell out, after two defects were found in the first implementation.
What was wrong
NodeActivated,NodeSuspendedandNodeRetiredcarry anodeIdand an instant or a reason, nothing else. The fold wrote them as a whole row{id, state}through a full-row upsert, so the first status fact of a pickup point erased its serving station and its prefix, and a status fact of a node of ANY other type created a pickup-point row.- Every pickup point is registered
PROPOSEDand becomesACTIVEby exactly such a fact, so no pickup label could be issued from event-fed state: aPROPOSEDpoint was refused, and anACTIVEone had an empty prefix, whichlabel.Issuerefuses as 422validation-failed("destinationPostalPrefix must be 1 to 16 characters from A-Z 0-9"). NodeRegisteredapplied a second time (a rebuild) wrote the whole row as well and put the point back toPROPOSED.shipto.ErrPickupPointUnavailablehad no entry in the HTTP problem catalogue: the refusal this ADR namespickup-point-unavailableanswered 500internal-error.
The rule
- The PickupPointView has two writes and neither touches the other's columns.
A registration (
Register) writes the descriptive data of a pickup point, its serving station and its prefix; a point the view does not hold is insertedPROPOSED, a point it holds keeps its state, whatever it is. A status fact (SetState) writes the state of a point the view holds and nothing else. - A status fact of an id the view does not hold is claimed in the inbox and acknowledged without an effect; no row is made. Node facts are keyed by the node id, so a node's registration precedes its status facts on the partition: no row means "not a pickup point", never "not yet". It is the rule of an unknown tracking number (ADR 0002 A17, ADR 0003), with one difference: it is neither logged nor counted, because it is the normal case of every node that is not a pickup point. It is never dead-lettered: the fact is well-formed.
NodeRegisteredapplied again restores station and prefix and never the state: anACTIVE,SUSPENDEDorRETIREDpoint stays what it is.- A retired point keeps its row, in state
RETIRED(it was deleted before).RETIREDis terminal in node-topology, and it is terminal here: no later status fact changes it. A deleted row forgets that the point was retired, so a replayed registration would bring it back asPROPOSEDand its replayedNodeActivatedwould make it labelable again until the replayedNodeRetiredarrived. For a label nothing changes: an unknown point and aRETIREDone are both refusedpickup-point-unavailable. pickup-point-unavailableis 422, as this ADR and the error's own comment always said, andPOST /labelsdeclares it. A test now keeps the problem catalogue, the typed errors of the model andapis/openapi.yamlin step (internal/adapters/inbound/http/problem_parity_test.go,problem_typed_errors_test.go).
The repair
Rows written before this fix stay damaged until the registrations are applied again: the procedure, the inbox identity it has to clear and its dependency on the topic's retention are in the runbook, "Repairing the pickup point view". No migration is needed: the table and its columns are unchanged.
The refusal is not stored under the Idempotency-Key
pickup-point-unavailable follows the point's state, which node facts change:
a point this context does not hold yet, a PROPOSED one and a SUSPENDED one
can all be ACTIVE later, and the refusal commits nothing. It is a refusal the
same request can pass later, so, by the rule of ADR 0018, it is not stored
under the caller's Idempotency-Key: it is the third entry of the one list
notStoredUnderKey (internal/adapters/inbound/http/response.go), beside
concurrent-update and destination-prefix-unavailable. The key row rolls
back with the refusal; the same request under the same key is executed again
and is served once the point is ACTIVE, and that 201 is what the key
replays from then on. Callers use keys that are deterministic per package
(vendor-connectivity sends vc-label-<po>-<pkg>): a stored refusal would have
kept every label asked before the point's activation refused for the 24 hours
the key lives. While the refusal still answered 500 it was not stored either;
mapping it to 422 without this entry would have introduced exactly that.
The fourth cause, a RETIRED point, never passes later. It is covered by the
same entry because the refusal is one error: a retry is executed, refuses again
and commits nothing.
TestPickupRefusalIsNotStoredSoItsKeyRetriesTheWork holds the middleware to
it over a real Postgres;
TestWriteErrorMarksOnlyTheRetryableRefusalsAsNotStored and
TestOnlyTheRefusalsARequestCanPassLaterAreMarkedNotToBeStored hold the
handler to marking these refusals and nothing else.
The prefix of a pickup point
The prefix of a pickup point is its registered postalCode as published, and
the label's prefix rule admits only A-Z 0-9. That is not a gap for a pickup
point: node-topology refuses to register a PICKUP_POINT whose postal code is
not wholly A-Z 0-9 (ErrPointPrefixNotLabellable, labellable in its
internal/domain/node/node.go), so a code with a separator such as
07750-000 can only belong to a node of another type, which this view does not
keep.
Addendum 2026-11-19: the list notStoredUnderKey is the replay class
The third entry of the list notStoredUnderKey that "The refusal is not stored under the Idempotency-Key"
above describes is now the class RETRYABLE on the catalogue entry of pickup-point-unavailable
(ADR 0020); the list, capture.DoNotCache and
passesLater are gone and the behaviour of this refusal is identical. The handler test is now
TestOnlyTheRefusalsARequestCanPassLaterAreMarkedRetryable.