0043. Propose heads from warehouse-planning's published labour plan
Status
Accepted (2026-11-18). Extends ADR 0012
(where a proposal's rate comes from) and ADR 0029
(the staffing gap). Keeps ADR 0002. Producer:
warehouse-planning ADR 0023 (LabourPlanCommitted). Additive: no existing field, route or
published type changes.
Context
ProposePathPlan computes ceil(charge / resolvedRate) from a charge the caller sends,
with the rate from the caller or from labor-performance's measured actuals (ADR 0012) and an
idle-share trim (ADR 0020). The charge it divides is the same forecast the caller also sends to
wes-work-planning, and the shift's heads are then committed here and, separately, in
wes-work-planning. Three contexts hold parts of one planning chain.
warehouse-planning now owns the forecast and the shift labour plan (its ADR 0023) and
publishes LabourPlanCommitted per site, shift and path: the heads the demand requires. This
context owns the other half: who is available, certified and assigned (labour supply).
Decision
- Local copy. A consumer of
warehouse.warehouse-planning.eventsacts only oncom.warehouse.wes.warehouse-planning.labourplan.LabourPlanCommittedand keepslabour_requirements, one row per(site_code, shift_id, path_id):planned_heads,rate_units_per_hour,hours,heads_source,version. A message is applied only when itsversionis greater than the stored one. Claim on the CloudEventsidand apply in one unit of work; group id from the new required env varLABOUR_PLAN_CONSUMER_GROUP(the consumer is always on: Kafka is part of the runtime, ADR 0038). The wiresite_idis a facility-layout site code and is stored assite_code(ADR 0035). - Proposal from the requirement. When a proposal request omits
chargeand names ashiftId(new optional field, with the existingsiteCode),proposedHeadsis the copy'splanned_headsfor(siteCode, shiftId, pathId)andrateSourceislabour-plan. The idle-share trim of ADR 0020 does not apply to it: warehouse-planning's heads are the requirement, and trimming them here would make two contexts compute it. No row is404 labour-plan-not-found, never zero heads. - The charge-based proposal stays, deprecated. A request with
chargebehaves exactly as today (ADR 0012, ADR 0020). Its removal is a later decision, taken once no caller sends a charge. - The requirement next to the commitment. The staffing-gap lines and the committed shift
plan lines gain an optional
requiredHeadsfrom the copy (omitted when no row exists).CommitShiftPlandoes not refuse a line that differs from the requirement: committing fewer heads than required is a legitimate supply decision, and warehouse-planning surfaces the difference (LabourPlanDriftDetected). - Unchanged: the installed-capacity ceiling of ADR 0014 (a REST sync edge to
fulfillment-execution) and
ShiftPlanCommitted's payload. Note for a later decision: the ceiling reads fulfillment-execution's station count while warehouse-planning reads facility-layout's tally, so the two contexts can disagree on installed stations.
Consequences
- A supervisor gets the required heads without re-sending a forecast, and sees requirement and commitment on the same line.
- One more consumer group and a required env var: chart and warehouse-infra values land together, infra first.
- The measured-rate and idle-share signals still shape charge-based proposals only. Whether they belong in warehouse-planning's requirement is open and not decided here.
Alternatives rejected
- Keep computing heads from a caller's charge only. The requirement would be computed in two contexts from two copies of the forecast.
- Call warehouse-planning's
GET /labour-plansat proposal time. Live cross-context reads are not how this fleet integrates; the event-fed copy is. - Refuse a commitment below the requirement. Supply is this context's decision; the gap is information, not an error.