Skip to content

[access] refactor(support): share the result-to-array reading of routing, role resolution and the recommendation store - #5862

Merged
rubenvdlinde merged 3 commits into
developmentfrom
quality/h16-object-array
Nov 13, 2026
Merged

rubenvdlinde merged 3 commits into
developmentfrom
quality/h16-object-array

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What changed

RoutingController, RoleResolverService and Vth\LhsRecommendationStore carried the same toArray(mixed $value): array, 23 lines each: keep an array; for an object take its jsonSerialize() array, else its toArray() array, else its public properties; anything else is empty.

That reading is now one static helper, Service\Support\ObjectArray::of() (split in two units so each stays small). Each toArray() keeps its name and visibility and delegates to it, so every caller stays untouched, including RoutingController::reroute (#5340) and LhsRecommendationStore::loadRecommendation / persistRecommendation (#5340, #5353).

It is a separate helper from SerialisedArray::of() (#5860, #5861) on purpose: that one ignores toArray() and does not cast, and the two behaviours are kept apart rather than merged.

The title carries the access prefix because RoleResolverService resolves case roles and the recommendation store feeds the LHS override guard. Their outcomes are unchanged.

Characterisation tests

  • tests/Unit/Service/Support/ObjectArrayCopiesTest.php, committed first and green on the old code: every copy (by reflection) against eight kinds of result, including the jsonSerialize() -> toArray() -> cast fallbacks. 24 cases.
  • Mutation check against the existing access tests: making the helper ignore a jsonSerialize() array turned RoleResolverCaseRolesTest::testEveryRecordShapeIsRead and four LhsOverrideAuthorizationTest cases red; making it drop an array input turned the role test and testAClaimedHarshRecommendationCannotUnlockAnEscalation red. Restored, all green.

What ran

  • phpunit -c phpunit-unit.xml on the new test, every unit test class that names one of the three classes or the recommendation service, and tests/Unit/Architecture: 237 tests, all green but one inherited failure.
  • phpcs and phpstan analyse on the touched files: no findings.

Inherited: ServiceCatchReturnsNullTest::testEveryAllowlistEntryNamesALiveSite is red on development too (a stale allowlist entry for lib/Service/Settings/OpenRegisterBridge.php), untouched here.

Duplication figures (duplicated 6-line windows, before -> after)

  • RoutingController <-> RoleResolverService: 16 -> 0
  • RoutingController <-> LhsRecommendationStore: 16 -> 0

Found after opening, from a full phpmd run: with this change RoutingController reaches a coupling between objects of 13, one over the rule's limit (CouplingBetweenObjects, under 13). ObjectArray is the extra dependency. On development the class is under the limit. This needs a reviewer's call: accept the finding, or take one other dependency out of the class in a follow-up.

AI-assisted: prepared with Claude Code (claude-opus-5-5); reviewed by a maintainer before merge.


Generated by Claude Code

… resolver and recommendation store

Assisted-by: ClaudeCode:claude-opus-5-5
… resolution and the recommendation store

RoutingController, RoleResolverService and LhsRecommendationStore carried
the same toArray(): keep an array, else the object's jsonSerialize() array,
its toArray() array or its public properties. That reading is now
Support\ObjectArray::of(); each toArray() delegates to it.

Assisted-by: ClaudeCode:claude-opus-5-5
…ject-array

# Conflicts:
#	lib/Controller/RoutingController.php
@rubenvdlinde
rubenvdlinde merged commit 8be80d2 into development Nov 13, 2026
5 of 8 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/dossiq @ 5888791

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ❌
psalm ❌
phpstan ✅
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-manifest ✅
check-vue3-compile ✅
test-l10n ✅
format ❌
check-schema-l10n ❌
check-l10n-js ✅
check-debt-ratchet ❌
check-types-e2e ✅
composer ❌ ✅ 109/109
npm ✅ ✅ 657/657
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ❌
Newman ⏭️
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-15 02:00 UTC

Download the full PDF report from the workflow artifacts.

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