Commit the labour plan of a process path for a shift at a site
PUT/labour-plans/:site_id/:shift_id/:path_id
Stores the heads a process path needs for one shift at one site, at a planned rate for a number of hours (docs/adr/0023 decision 2; it was wes-work-planning's path plan). planned_heads must not exceed installed_stations, hours and the rate must be positive and rate x heads x hours finite. When planned_heads is omitted it is DERIVED: ceil(forecast units with a cpt in [shift_start, shift_start + hours) / (rate x hours)), which needs shift_start and a stored workload forecast for (site_id, path_id) with at least one bucket in the shift; otherwise 422 missing-planned-heads (zero buckets in the shift is no data, never zero heads). heads_source says which happened. When the facility tally knows at least one but fewer stations of the activity named like the path (the path id upper-cased) than installed_stations, the plan is still stored with the number as sent and the answer carries a warning. 201 with version 1 for a first commit; 200 with version + 1 for a revision; 200 with the stored plan and version unchanged when the plan equals the stored one (no event). A change raises LabourPlanCommitted (integration and analytics topics, asyncapi.yaml) in the same transaction. The PUT is naturally idempotent and takes no Idempotency-Key.
Request
Responses
- 200
- 201
- 400
- 409
- 422
- 500
The plan was revised (version + 1), or equals the stored one (nothing changed).
A first commit; the plan is stored at version 1.
Malformed JSON (a fractional head or station count included) or a shift_start that is not RFC 3339 (malformed-json, malformed-shift-start).
The stored version moved twice while the plan was committed (version-conflict); retry it.
planned_heads above installed_stations (heads-exceed-stations), omitted heads that cannot be derived (missing-planned-heads), a head or station count below 0 or above 2147483647 (invalid-count), installed_stations omitted (missing-installed-stations), a rate or hours not above zero (non-positive-rate, non-positive-hours), or rate x heads x hours not finite (throughput-not-finite).
An unexpected failure (a store or outbox error). Answered as problem+json (internal-error). A 5xx answer is never stored under an Idempotency-Key and rolls back the aggregate change and its outbox rows, so the retry re-executes.