0045. Pack-aware work units
Status
Accepted (2026-10-24). Extends ADR 0035 (local copy of product-master facts) and respects ADR 0044 (real Postgres and Kafka only). Part of the mastercase / GTIN programme (contract P11-2).
Context
Sellers now ship master cases and the warehouse stores them as sealed
containers. A pick of one case and a pick of eaches differ in handles, cube and
weight, and a case that must be opened first is its own unit of work.
fulfillment-execution already consumes BREAK_CASE tasks and a nested
case_break object on released work; this context must emit exactly that shape
and must not invent a competing one. Quantities stay in eaches everywhere.
Decision
- A work unit may carry a pack-aware kind:
CASE_PICK,EACH_PICKorBREAK_CASE. Released work carries thepickobject (quantity, unit, source bin) or thecase_breakobject (LPN, loose bin, pick task id) that fulfillment-execution consumes. A unit without a pack-aware kind renders and releases byte-for-byte as before. - Pack facts are never looked up live. A local copy of product-master's
ProductPackLevelDeclared/ProductPackLevelRetiredevents is kept in Postgres by a dedicated consumer on its own STABLE group,PACK_VIEW_CONSUMER_GROUP(chart keyconfig.packViewConsumerGroup, defaultwes-work-planning-pack-view). It must differ fromPRODUCT_CLASSIFICATION_CONSUMER_GROUP: both read the same topic, and a group that already committed past the pack events could never replay them. The variable is mandatory and a collision is a boot error. - Poison messages (a pack level missing a dimension, an invalid GTIN) are dead-lettered, never coerced. The consumer is idempotent by CloudEvents id.
- Charge and travel estimates may be requested per SKU and pick unit. The
request
quantitystays in eaches; the response addshandles(cases for pick unitCASE),cubeMm3andweightG, the last two omitted when the pack level has no size on record. A plain bucket is unchanged.
Consequences
- One new mandatory env var, rendered by the chart with a default so the Application does not break when infra values lag; warehouse-infra may still pin the group explicitly.
- The pack copy is shared state in Postgres, so every replica reads the same facts; replay after a retirement is handled by the event version.
- Estimates for SKUs with no active CASE level fall back to the each-based behaviour; nothing is rounded here (rounding to case multiples belongs to inter-site planning).