Repository navigation
[access] refactor(support): share the result-to-array reading of routing, role resolution and the recommendation store - #5862
Merged
Conversation
… 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
rubenvdlinde
requested review from
WilcoLouwerse,
bbrands02 and
rjzondervan
as code owners
November 11, 2026 14:51
…ject-array # Conflicts: # lib/Controller/RoutingController.php
Contributor
Quality Report — ConductionNL/dossiq @
|
| 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.
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
RoutingController,RoleResolverServiceandVth\LhsRecommendationStorecarried the sametoArray(mixed $value): array, 23 lines each: keep an array; for an object take itsjsonSerialize()array, else itstoArray()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). EachtoArray()keeps its name and visibility and delegates to it, so every caller stays untouched, includingRoutingController::reroute(#5340) andLhsRecommendationStore::loadRecommendation/persistRecommendation(#5340, #5353).It is a separate helper from
SerialisedArray::of()(#5860, #5861) on purpose: that one ignorestoArray()and does not cast, and the two behaviours are kept apart rather than merged.The title carries the access prefix because
RoleResolverServiceresolves 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 thejsonSerialize()->toArray()-> cast fallbacks. 24 cases.jsonSerialize()array turnedRoleResolverCaseRolesTest::testEveryRecordShapeIsReadand fourLhsOverrideAuthorizationTestcases red; making it drop an array input turned the role test andtestAClaimedHarshRecommendationCannotUnlockAnEscalationred. Restored, all green.What ran
phpunit -c phpunit-unit.xmlon the new test, every unit test class that names one of the three classes or the recommendation service, andtests/Unit/Architecture: 237 tests, all green but one inherited failure.phpcsandphpstan analyseon the touched files: no findings.Inherited:
ServiceCatchReturnsNullTest::testEveryAllowlistEntryNamesALiveSiteis red on development too (a stale allowlist entry forlib/Service/Settings/OpenRegisterBridge.php), untouched here.Duplication figures (duplicated 6-line windows, before -> after)
RoutingController<->RoleResolverService: 16 -> 0RoutingController<->LhsRecommendationStore: 16 -> 0Found after opening, from a full
phpmdrun: with this changeRoutingControllerreaches a coupling between objects of 13, one over the rule's limit (CouplingBetweenObjects, under 13).ObjectArrayis 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