Repository navigation
refactor(support): share the stored row-list reading between the approval gates, routing, the flow projection, subsidies and the case journal - #5895
Merged
Conversation
… routing, flow projection and subsidies Assisted-by: ClaudeCode:claude-opus-5-5
…oval gates, routing, the flow projection and subsidies ApprovalGateDeclaration::rowsOf(), RoutingController::decodeSteps(), ProjectsOntoFlows::decodeList() and SubsidieService::rowsOf() read a stored list the same way: decode a JSON string, answer an empty list for anything not an array, keep the array rows in order. That reading is now Support\RowList::from(); each copy keeps its name and delegates. Assisted-by: ClaudeCode:claude-opus-5-5
… the case journal before sharing it Assisted-by: ClaudeCode:claude-opus-5-5
…t reading CaseLifecycleService::readJournal() and CaseJournal::entries() read the activity journal the same way as the other stored row lists, after turning a value that is not an array into a string. Both now do that conversion and hand the rest to Support\RowList::from(). Assisted-by: ClaudeCode:claude-opus-5-5
rubenvdlinde
requested review from
WilcoLouwerse,
bbrands02 and
rjzondervan
as code owners
November 11, 2026 16:20
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
Six classes read a stored list of rows the same way: decode a JSON string first, answer an empty list for anything that is then not an array, and keep the entries that are rows, in order and re-indexed.
Service\CaseType\ApprovalGateDeclarationrowsOf()(private static)Controller\RoutingControllerdecodeSteps()Service\Support\ProjectsOntoFlows(trait)decodeList()Service\Subsidie\SubsidieServicerowsOf()Service\CaseLifecycleServicereadJournal(), after turning a value that is not an array into a stringService\Lifecycle\CaseJournalentries()(public), the sameThat reading is now one static helper,
Service\Support\RowList::from()(split in two units so each stays small). Each copy keeps its name and visibility and delegates, so no caller changes;RoutingController::reroute()(#5340) is not touched. The copies were spelled three ways (three decode into a temporary in two different shapes, one decodes in place); all answer the same, as the tests below pin, and the helper uses the shortest spelling. The two journal readers keep their own conversion of a non-array value to a string (so an object value still fails as before) and hand the rest to the helper.This replaces #5894 so that the two journal readers join the same change: a second PR adding the same helper would be reported by the duplicated-fragment gate against the copies this one removes.
Other methods (
LhsRecommendationService::indexCells(),AdmissibilityJudgement::declarationFor(),StatusChecklist::itemsFor(),RemedyClauseDeclaration::declarationFor()) start with the same JSON decoding but go on to read something else, so they are not copies of this reading and are left alone.Characterisation tests
tests/Unit/Service/Support/RowListCopiesTest.php, committed first and green on the old code: every copy (by reflection; the trait through a migrator that composes it) against ten stored values: a JSON list and object with non-row entries, a JSON scalar, invalid JSON, an empty string, an array with keys and non-row entries (re-indexed), an empty array, null, an integer and an object. 40 cases.tests/Unit/Service/Lifecycle/CaseJournalReadingCopiesTest.php, committed before its change and green on the old code: both journal readers against seven stored journals, and that an object journal still fails the string conversion. 16 cases.What ran
phpunit -c phpunit-unit.xmlon both new tests, every unit test class that names one of the six classes or the two flow migrators, andtests/Unit/Architecture: 389 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).Duplication figures (duplicated 6-line windows, before -> after)
RoutingController<->ApprovalGateDeclaration: 12 -> 0ProjectsOntoFlows<->SubsidieService: 6 -> 0CaseLifecycleService<->CaseJournal: 9 -> 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).RowListis 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