Repository navigation
[access] refactor(dashboard-api): split DashboardApiController create, update guard, group, fork and schedule actions into named steps - #1076
Open
rubenvdlinde wants to merge 2 commits into
Conversation
…e the split Assisted-by: ClaudeCode:claude-opus-5-5
…guard, group, fork and schedule actions into named steps Assisted-by: ClaudeCode:claude-opus-5-5
rubenvdlinde
requested review from
WilcoLouwerse,
bbrands02 and
rjzondervan
as code owners
November 11, 2026 18:36
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.
What changed
Eight
DashboardApiControllerunits read as named steps. Every route action keeps its signature and route parameters, and every guarded endpoint still shows its guard call in its own body (the guard golden reads that).create:denyCreateRequest(thedenyCreatechain, then the create permissions, in the original order) →resolveCreateParams→createFromParams(createDashboardFrom,createdResponse) with the same quota / invalid-argument / generic mappings.resolveCreateParams→resolveCreateBody(stringOrNull,intOrZero).denyUpdate→mayUpdate.updateGroup/setGroupDefaultshare onerunGroupMutation(404 for an unknown dashboard, the generic error otherwise) instead of two copies of the same catch blocks; the group and UUID travel as aGroupDashboardTarget.setGroupDefaultstill checks the login before the missing UUID (missingUuid).forkchecks the login, thenforkFor→forkCreated/forkFailure(the same four outcomes in the same precedence, the last one logged byinternalForkError).schedulekeeps the action check, thenscheduleDated(no-time refusal) →scheduled(scheduleFor) with the same mappings; the dashboard and its times travel as aDashboardScheduleRequest.visibleBreadcrumbs→visibleUuids,crumbFor.Allowed and refused outcomes are unchanged; every refusal answers with the same status and body, and every check still runs before the call it guards.
Characterisation tests
tests/Unit/Controller/DashboardApiControllerActionsGoldenTest.phpwas committed first, against the old code, and passes before and after: every create outcome (no session, personal dashboards off, creation not allowed, second dashboard not allowed, success with the exact service arguments and envelope, quota / invalid / generic errors), the create-parameter resolution for flat and body input, the update guard for metadata-only and layout updates (allowed and refused) and without login, every group update and group default outcome, every fork outcome (with the logged failure), every schedule outcome, and the breadcrumb hiding. Mutation check: disabling the layout-permission check on the old code turned the update golden red; restored before committing. The existingDashboardApiControllerGuardGoldenTestpasses unchanged.What ran
vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit: 2765 tests OK (13 skipped, as on development).vendor/bin/phpcsandvendor/bin/phpstan analyseon the touched lib files: clean.Figures (touched files
lib/Controller/DashboardApiController.php,GroupDashboardTarget.php,DashboardScheduleRequest.php)create(11)The two units left over complexity 5 are
create(7) andupdate(9): each nullable route parameter counts as a branch, so their floor is set by the route signature (6 and 8), which stays as it is. The extra unit over 2 parameters is theDashboardScheduleRequestconstructor. App-wide: unit complexity 4.02 → 4.14, unit size 3.40 → 3.44, unit interfacing 3.14 → 3.16, duplication 4.54 → 4.55.Maintainability floor: compare against development holds.
AI-assisted: prepared with Claude Code (claude-opus-5-5); reviewed by a maintainer before merge.
Generated by Claude Code