Skip to content

[access] refactor(dashboard): split DashboardService creation, template rung and provisioning into named steps - #1081

Open
rubenvdlinde wants to merge 2 commits into
developmentfrom
quality/i40-dashcreate-steps
Open

rubenvdlinde wants to merge 2 commits into
developmentfrom
quality/i40-dashcreate-steps

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

The dashboard creation path of DashboardService reads as named steps. This PR touches different methods than the open group-delete / publication split of the same file and merges cleanly with it.

  • createDashboard (public, signature unchanged): assertMayCreate (public-share bearer, quota, parent — in that order, before anything is built) → factory (factoryOptions) → applyNewIcon → assertNewSlugUnique → deactivate → insert → completeNewDashboard (seedPrimaryTranslation, then the default widgets when asked).
  • resolveTemplateRung → templateStepsAside (owns a dashboard, or a group-less template yielding to the primary group's default) → view-only answer or copyTemplateFor.
  • tryCreateFromTemplate hands a template to the resolver as before, else provisionPersonalDashboard → seedFromRoleDefaults → provisionedPlacements (role-seeded placements, or the default bundle only when nothing was seeded).

Every check runs in the original order before the writes it guards; the writes, logs and results are the same.

Characterisation tests

tests/Unit/Service/DashboardServiceCreationGoldenTest.php was committed first, against the old code, and passes before and after: the exact sequence of checks and writes of a full create, a create with defaults and without optional collaborators, an empty slug skipping the uniqueness check, the quota and public-share refusals stopping before any check or write, a failed translation seed logged while creation goes on, and every provisioning branch (template, no template with personal dashboards off, role defaults, nothing seeded, no role service). Mutation check: dropping the quota check on the old code turned two goldens red; restored before committing. The existing template-rung, create-defaults, quota-wiring and create goldens pass unchanged.

What ran

  • vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit: 2755 tests OK (13 skipped, as on development).
  • vendor/bin/phpcs and vendor/bin/phpstan analyse on lib/Service/DashboardService.php: clean.

Figures (touched file lib/Service/DashboardService.php)

before after
units over complexity 5 (createDashboard, resolveTemplateRung, tryCreateFromTemplate) 3 units, 120 lines 0
units over complexity 5, whole file 11 units, 325 lines 8 units, 205 lines (the rest is split in the other open PR)
units over 15 lines of code 42 units, 1,059 lines 39 units, 939 lines
units over 2 parameters 22 units, 540 lines 22 units, 507 lines

App-wide: unit complexity 4.02 → 4.08, unit size 3.40 → 3.42, unit interfacing 3.14 → 3.15.

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

…nd provisioning before the split

Assisted-by: ClaudeCode:claude-opus-5-5
…nd provisioning into named steps

Assisted-by: ClaudeCode:claude-opus-5-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants