fix some job tracker test races
fmt
implement basic state transitions

Does not currently use the state for validating actions (i.e. stopping already
stopped container).