Assignments
The LaborAssignment aggregate: putting an associate on a path for an interval, enforcing the certification gate and the one-active- assignment-per-associate invariant.
Assign an associate to a path
Puts an associate on pathId for a new interval, raising LaborAssigned (first assignment) or LaborReassigned (an assignment was already active). The 'exactly one ACTIVE assignment per associate' invariant is enforced by construction, not by rejecting a second call: if the associate already has an active assignment, it is closed first (its hours are logged against the associate's shift) and the new one starts — this matches how rebalancing actually happens on the floor, a supervisor moves someone without first 'unassigning' them. The assignment requires the associate hold the path's required certification (by convention, the Certification with the same name as the PathId — e.g. path 'pack' requires certification 'pack'), and is rejected if the associate is currently on a logged break or their shift has ended. Because each call closes the prior interval and raises an event, a blind retry would double-apply it, so this route is protected by the Idempotency-Key header (ADR-0027, ADR-0044): a retried request with the same key and body replays the first response — unless the first answer was RETRYABLE (e.g. certification-required, associate-on-break, concurrent-modification), which is not stored: the key is released and the retry executes again once the state allows it.