Problems
- Lack of client-side validation: xLab currently doesn't validate users' input to the Start or End date fields, which means that artifacts with invalid durations can be saved (e.g. set to start in the past; or where the end date is set before the start date, etc.).
- It's allowed to activate experiments immediately: xLab users can currently enable experiments right after configuring them. This means that their activation could technically happen before Varnish nodes have a copy of the experiment configuration. This would impede experiment enrollment and prevent the successful collection of data.
Suggested solution
Improve the validation of the Duration field
1. Implement client-side validation: The following errors should be displayed under the last modified fields on blur. The errors should persist on submit (see 2) and be listed after one another in the edge case they are concurrent:
| Start date must be before end date | Start date must be 24h in the future (Experiment form) * | Start date must be in the future (Instrument form) * |
(*) Please note that the 24h ahead rule only applies to experiments
| End date must be after start date | End date must be in the future |
1.1. Cross-field validation: Please note that for the cross-field validation errors "Start date must be before end date" and "End date must be after start date", the client-side error message will also be displayed on blur only under the last field that was edited (where the relational date validation error was made). Only if the error isn't corrected before submitting will both fields display messages at the same time:
| On blur on last edited field | On submit |
1.2. Concurrent errors: Also note that, in the edge case in which client-side errors overlap, they'll be displayed as a list under the affected field(s)
| On blur on last edited field | On submit |
2. Implement server side validation: If client-side errors were present at the time users save their configurations (see 1.1), said errors will persist on submit. We'll also display the required field error messages inline, following the new validation improvements (see parent task, T372952):
Implement a 24h buffer interval before saving and activating experiments
To ensure that Varnish nodes have a copy of experiment configurations with enough time between their activation and start dates, we should ensure that users save and activate their experiments at least 24 hours prior to the defined start date.
| 1. Client-side validation will be triggered on blur if users input a start date less than 24h in the future (Please see Open question #1) | 2. On the Experiments and Instruments table, activation will be disabled for experiments set to start in less than 24 hours. Users will find an informative description under a disabled “Turn on” menu option: | 3. Copy updates: (1) The Duration field's description is updated to indicate the system's fixed time; (2) In the experiment form, a new helper text is included under the start date for error prevention: |
Open questions
Validating that the start date is 24h ahead in the future on the client side implies considering the current user's time at the moment of input. The feasibility of this is unknown. If not possible, we might just validate that start date is in the future on the client side, and validate whether there's a 24h buffer at the time of creation only on submit.
Acceptance criteria
- Users’ input to the Start and End date field in the Duration module are validated in the client and server side to ensure that dates are correct
- Users can only save and activate experiments at least 24 hours prior to their set start date















