Repository navigation
fix(blackouts): reject unsupported series scopes - #2051
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new page test has an active moderate issue because it lacks an explicit require for ManageBlackoutsPresenter and can fail when run in isolation.
1 open issue
What changed in this PR
This pull request hardens blackout update and deletion handling by rejecting unsupported series scopes before service operations while preserving existing defaults for omitted or blank scopes.
Changes:
- Restricts blackout series scopes to
thisandfull. - Rejects invalid updates and returns HTTP 400 for invalid deletes.
- Adds page-level and presenter-level tests for valid and malformed scopes.
| File | Description |
|---|---|
| tests/Presenters/Admin/ManageBlackoutsPresenterTest.php | Adds presenter tests covering rejection of unsupported scopes during blackout updates and deletions. |
| tests/Pages/Admin/ManageBlackoutsPageTest.php | Adds real-page tests covering scope parsing, supported behavior, malformed values, and rejected deletion responses. |
| Presenters/Admin/ManageBlackoutsPresenter.php | Rejects unsupported scopes before invoking blackout update or deletion services. |
| Pages/Admin/ManageBlackoutsPage.php | Validates blackout series scopes and exposes a rejected-delete response. |
Review effort: Lite
Deleting or updating a blackout accepted any value as the series scope. The service and BlackoutSeries compare it loosely with one scope and treat everything else as the other: - On update, anything other than "this" changed the whole series. - On delete, anything other than "full" deleted one instance. The exception was "0", which the page's empty() check took for an omitted field and turned into the full series. So an unknown value, the future-instances scope (which blackouts do not have) or a list was acted on, and meant different things for the two actions. ManageBlackoutsPage::GetSeriesUpdateScope() now returns the scope only when it is "this" or "full", and null for anything else, "0" included. An omitted or blank field still defaults to the full series. The getter has a native ?string return type. The presenter rejects a null scope, and nothing is deleted or updated: - A rejected update is reported to the page as a failure. - A rejected delete is answered with HTTP 400. A successful delete has an empty response, so the caller could not otherwise tell the two apart. This is hardening. The blackout pages only submit "this" or "full", so no request from the application's own pages is affected. The old behaviour needed a hand-built request from a user who can manage blackouts (an application, resource or schedule administrator), who can already delete or update the same blackout from the page. The presenter tests mock the page. Add tests that drive the presenter through the real page. Assisted-by: Claude:claude-fable-5-2
JohnVillalovos
force-pushed
the
jlvillal/psalm_4_1
branch
from
November 22, 2026 19:39
63cf352 to
92364bd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Deleting or updating a blackout accepted any value as the series scope. The service and BlackoutSeries compare it loosely with one scope and treat everything else as the other:
So an unknown value, the future-instances scope (which blackouts do not have) or a list was acted on, and meant different things for the two actions.
ManageBlackoutsPage::GetSeriesUpdateScope() now returns the scope only when it is "this" or "full", and null for anything else, "0" included. An omitted or blank field still defaults to the full series. The getter has a native ?string return type.
The presenter rejects a null scope, and nothing is deleted or updated:
This is hardening. The blackout pages only submit "this" or "full", so no request from the application's own pages is affected. The old behaviour needed a hand-built request from a user who can manage blackouts (an application, resource or schedule administrator), who can already delete or update the same blackout from the page.
The presenter tests mock the page. Add tests that drive the presenter through the real page.
Assisted-by: Claude:claude-fable-5-2