Skip to content

[access] refactor(dashboard): split DashboardService group delete, publication visibility and group-shared pick into named steps - #1075

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

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

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

Eight DashboardService methods read as named steps:

  • deleteGroupShared (public, unchanged signature): assertAdmin → findGroupDashboard → assertNotLastInGroup → deleteWithPlacements → dispatchGroupSharedDeleted, in the original order.
  • Publication state: effectivePublicationStatus → materialisedStatus (legacy empty rows, due scheduled rows) → take-down check; materialiseDueSchedule and materialisedStatus share one isDue check instead of two copies. filterByPublicationState keeps a published dashboard, or a draft / scheduled one for its owner (isOwnedBy) or an admin.
  • Group-shared pick: resolveGroupSharedDashboard walks groupSharedRungs (the same four rungs, two for a viewer in the default group); findFirstGroupSharedWhere (signature unchanged) reads entriesFromSource, isGroupSharedIn and meetsDefaultRequirement.
  • Updates: applyDashboardUpdates → applyFieldUpdates (applyIconUpdate), tree and footer updates as before, the update stamp, then applyPlacementUpdates; resolveFooterMode → validFooterMode.

Allowed and refused outcomes are unchanged (who may delete, which dashboards a viewer sees), every check still runs before the operation it guards, and the messages, events and mutations are the same.

Characterisation tests

tests/Unit/Service/DashboardServiceStepsGoldenTest.php was committed first, against the old code, and passes before and after: a non-admin delete refused before anything is read, a group mismatch, the last-in-group refusal, the default-group exemption with the cascade and event order, no event without a dispatcher or UUID; every publication state (legacy, draft, scheduled due / future / missing / malformed, published, taken down, malformed take-down, due-then-taken-down) with the stored status after; the visibility filter for an owner, an admin and an anonymous viewer; the scheduled materialisation; the group-shared pick order for each rung, wrong sources, wrong types, other groups and a default-group viewer; every footer-mode outcome and message; and the plain field updates. Private steps are reached through reflection; times are relative to now. Mutation check: making every viewer an owner on the old code turned the visibility golden red; restored before committing.

What ran

  • vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit: 2783 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 11 units, 325 lines 3 units, 120 lines (createDashboard, resolveTemplateRung, tryCreateFromTemplate, untouched)
units over 15 lines of code 42 units, 1,059 lines 35 units, 869 lines
units over 2 parameters 22 units, 540 lines 22 units, 489 lines

App-wide: unit complexity 4.02 → 4.12, unit size 3.40 → 3.43, 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

…ility and group-shared pick before the split

Assisted-by: ClaudeCode:claude-opus-5-5
… visibility, group-shared pick and updates 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