User can create on-call rotation with negative length
Go to Monitor=>Oncall Schedules=>Add oncall-scheduel=>try adding rotation with negative length
Creation is successful - no errors neither on backend or frontend side
Implementation Guide
- Prevent bad rotations from being saved
- Update the validation on rotation
length
inIncidentmentManagement::OncallRotation
model. The validation should assert that the rotation length be greater than 0 (should not equal 0 or be negative).
- Update the validation on rotation
- Accommodate existing bad rotations. Multiple potential solutions (whichever is simplest to implement is ok):
- Create a migration to update or delete existing invalid records
- Add override method for rotation length to always use 1 for values <=0.
- Prevent UI from allowing user to input bad lengths. Multiple potential solutions:
- Update the input handler for the length field in
AddEditRotationForm
to always emit a value of1
when the user inputs a value <=0. - Update the
validateForm
method inAddEditRotationModal
to only accept positive values forrotationLength.length
- Update the input handler for the length field in
Edited by Sarah Yasonik