fix(reservations): prevent false success for no-op updates#1486
Conversation
When start time constraints filter all selected reservation instances out of an update or delete operation, validation still passed and the UI reported success even though nothing was changed. Add a validation rule for update and delete operations that fails when the selected scope contains no affected reservation instances. This preserves the current restriction for active or past reservations while showing the existing start-time constraint error instead of a misleading success message. Note: this does not grant resource administrators the ability to act on active reservations — that requires extending the Instances() bypass (currently limited to application admins) to cover resource admins as well. Closes: #1430 Assisted-by: Codex:GPT-5
There was a problem hiding this comment.
Pull request overview
This PR prevents “successful” reservation update/delete operations that are effectively no-ops because the configured start-time constraint filters all targeted instances out of the selected update scope (common for resource administrators due to AdminExcludedRule bypass behavior).
Changes:
- Add
ReservationInstancesRuleto fail validation whenInstances()is empty, returning the existingStartIsInPasterror message. - Apply the new rule to update and delete validation services.
- Add PHPUnit coverage for the new rule behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/Application/Reservation/ReservationInstancesRuleTest.php | Adds coverage ensuring validation fails when the selected update scope contains no instances. |
| lib/Application/Reservation/Validation/ReservationInstancesRule.php | Introduces a new validation rule that rejects update/delete operations with zero affected instances. |
| lib/Application/Reservation/Validation/PreReservationFactory.php | Registers the new rule in update and delete validation pipelines. |
| lib/Application/Reservation/Validation/namespace.php | Ensures the new rule class is included via the validation namespace loader. |
|
Intentionally did not make a change to grant resource administrators the ability to modify past reservations. Fixed the false-success behavior in this path, but intentionally did not expand resource administrator permissions to allow modifying or deleting past/already started reservations. The current behavior is tied to The fix keeps the existing policy intact and makes the result honest: when the I do not think we should change resource administrator behavior as part of this
For those reasons, this change only fixes the misleading success response. If |
When start time constraints filter all selected reservation instances out of an update or delete operation, validation still passed and the UI reported success even though nothing was changed.
Add a validation rule for update and delete operations that fails when the selected scope contains no affected reservation instances. This preserves the current restriction for active or past reservations while showing the existing start-time constraint error instead of a misleading success message.
Note: this does not grant resource administrators the ability to act on active reservations — that requires extending the Instances() bypass (currently limited to application admins) to cover resource admins as well.
Closes: #1430
Assisted-by: Codex:GPT-5