Schedule State Machine

Staffjoy uses a state machine to control the automation of shift creation, assignment, and publication. Changing the state of a schedule coordinates actions for all shifts that start during the schedule. Formally, this is defined by schedule.start <= shift.start < schedule.stop.

For reference, "chomp" refers to our internal engineering service that computes shifts from demand, and "mobius" refers to our internal engineering service that assigns workers to shifts.


Allowed schedule state transitions. "boss" and "flex" refer to the package of the organization.


Schedules start in the initial state. When a user begins planning schedules in the front-end, we transition the state to unpublished. When the state transitions from initial to unpublished, recurring shifts are created for the given week. We wait until the last moment possible to do this so that modifications to recurring shifts are accounted for.

When a schedule in the initial state reaches its schedule.start - organization.shifts_assigned_days_before_start time, Staffjoy automatically promotes it to mobius-queue.

Schedules will remain in this state until they are moved.


Shifts are constructed while the schedule is in the unpublished state. They can be created via the shifts api or by using Staffjoy's demand-based automated shift calculation.

There are 3 possible next states:

  • chomp-queue - Sends the schedule to Staffjoy's demand-based, automatic shift calculation service, Chomp. The schedule must have demand, min_shift_length_hour, and max_shift_length_hour set. When the system claims a job, the schedule state is set to chomp-processing. It will be returned to unpublished once shifts are calculated.
  • mobius-queue (Boss only) - Sends the schedule to Staffjoy's shift assignment system, Mobius. When the system claims a job, the schedule state is set to mobius-processing. The schedule will automatically be set to published after the calculation is complete.
  • published - Workers are not assigned to shifts, so this step typically happens only for Flex organizations when they click "Publish Now" in the UI.

Boss: If a schedule is not been manually promoted to mobius-queue, it will be automatically transitioned once it reaches the time of schedule.start - organization.shifts_assigned_days_before_start time. The schedule is always set to published after calculation.

Flex: Schedules will remain in this state until they are moved.


When a schedule is transitioned to the published state, shifts in the role are automatically promoted to published=true if schedule.start <= shift.start < schedule.stop. All workers and admins receive an email notifying them that schedules are published. Workers may view and claim shifts in the My Schedules App.