ADR 0062: Proximity pick routes opt in through order strategies
Status: Accepted
Context
The owner chose one Facility setting for proximity, off by default, with each function opting in independently. Putaway already follows that rule (ADR 0061). The approved pick route is nearest neighbour from the depot for the picks of one pick order. It does not change pick source selection.
Order strategies already hold the picking configuration, including grouping by picking type and short-pick recovery. Storage strategies configure putaway, not the order's pick work.
Decision
Opt-in. The order strategy has proximityRoute, default false. At pick-order creation,
fulfillment uses the route only when that option and the Facility's karyo.proximity.enabled are
both on. Otherwise it preserves the existing creation order exactly. No new Facility or Area
switch is added, and the Facility setting remains off by default.
One route owner. LocationDistanceLookup.route(facilityId, start, locationIds) reads only
the start and the requested locations. Its route(start, locationIds) chooses each next location by walk metres,
then lift metres. Equal legs retain input order. A null start is the first Area's entry, as in the
simulator. Locations without a measurable walk follow placed locations by location orderIndex,
then location id. If there is no depot, every location uses that fallback. Zone corrections apply
through the same distance service, not a second routing graph. The flow simulator's policy O calls
this same snapshot method, after taking any line without a location first, as the old loop did at the depot.
Its fixed-seed figures remain unchanged.
Saved sequence. Each new pick receives a one-based sequence within its pick order. The
repository returns picks by sequence (unsequenced last), then id, and both front ends consume that order. Layout,
strategy or Facility setting changes do not reroute existing work. Recovery and top-up picks
append after the saved sequence, without changing the work already handed to a picker. On an order
created before the upgrade, whose picks have no sequence, they stay unsequenced and append in id order.
Extinguish work has no order strategy and keeps its existing order.
Wave batches. Each per-order pick order uses its own order strategy. A zone's cross-order batch, including a bulk batch, uses proximity only if every contributing order's strategy requests it. A mixed batch keeps its old order, so an order that did not opt in is never silently rerouted. Bulk presentation keeps the sequence of the first pick for each source stock unit.
Upgrade. Orders V1612 adds the strategy option and opts every existing strategy out. Fulfillment V1613
adds picks.sequence as a nullable column with no default, backfill or index, so the upgrade rewrites and
scans nothing on a large pick history. The existing idx_picks_pick_order serves the reads. A pick without a sequence lists after sequenced picks, in id order. There is no cross-module
foreign key, new runtime setting or new HTTP endpoint.
Consequences
The strategy form exposes the option beside the other picking configuration and explains the
Facility gate. The pick API adds sequence; order-strategy create, update and response contracts
add proximityRoute. Clients should follow the returned list, not sort it by pick id.
Routing is nearest neighbour, not a globally shortest tour. It starts at the depot, not a picker's live position. It routes reserved work only. Source selection now has its own independent opt-in, Same-day nearest, with the same Facility gate and FIFO as its default. Routing does not select or change a source. Pack is unchanged. Interleaving is ADR 0063.
Evidence
LocationDistanceSnapshot.route,FloorPlanService.snapshot, andFlowRun.nearestFirstPickRouteService,PickOrderService.persistPickOrder, andWavePickService.persistBatchPickOrdersPickSequenceMigrationTest,ProximityPickRouteTest,LocationRouteTest, andFlowSimulationTest