Skip to content

refactor(support): share the stored-reference uuid readings of the dossier, merge, deadline and term services - #5888

Merged
rubenvdlinde merged 4 commits into
developmentfrom
quality/h16-dossier-reference-uuid
Nov 12, 2026
Merged

rubenvdlinde merged 4 commits into
developmentfrom
quality/h16-dossier-reference-uuid

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Six classes carried one of two private readings of the uuid a stored reference names. Both trim a bare uuid string and answer an empty string for anything that is neither a string nor an array; they differ only in how they read a row:

Reading Copies
an objection dossier row: the first of id, uuid, @self.uuid, case, target that holds a string DossierCompiler::extractUuid(), Bezwaar\BezwaarCreationHook::extractUuid()
any other reference row: its id, cast to a string Cases\CaseMergeStore::referencedId() (public), and referenced() in Listener\DeadlineCaseCreatedListener, Listener\OneStatutoryTermPerCaseListener and Listener\TermStatusClockListener

Both are now Service\Support\ReferencedUuid::inDossierReference() and inReference(), which share one dispatch (string, row, anything else) and differ only in the row reading. Each copy keeps its name, visibility and signature and delegates, so no caller changes, including BezwaarCreationHook::linkRelatedCase() / onBezwaarCreated() (#5353) and DeadlineCaseCreatedListener::handle() (#4886).

Support\ReferenceId::of() (#5866) and Support\CaseRegisterReads::uuidOf() were not reused: they read id then uuid, which is a third reading again.

Characterisation tests

Committed before each change and green on the old code:

  • tests/Unit/Service/Support/DossierReferenceUuidCopiesTest.php: both extractUuid() copies against 13 references, including a numeric or null id that is skipped, an empty id that is taken, and a nested @self that is not read. 26 cases.
  • tests/Unit/Service/Support/ReferencedIdCopiesTest.php: the four referencedId() / referenced() copies against 8 references, including a numeric id that is cast and a lone uuid that is not read. 32 cases.

What ran

  • phpunit -c phpunit-unit.xml on both tests, every unit test class that names one of the six classes or CaseMergeService, and tests/Unit/Architecture: 386 tests, all green but one inherited failure.
  • phpcs and phpstan analyse on the touched files: no errors (the @spec warnings on CaseMergeStore's public methods were there before).
  • The duplicated-fragment and unit ratchet (gate 122) against development: 0 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)

Found after opening, from a full phpmd run: with this change DeadlineCaseCreatedListener reaches a coupling between objects of 13, one over the rule's limit (CouplingBetweenObjects, under 13). ReferencedUuid 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

… and the objection hook

Assisted-by: ClaudeCode:claude-opus-5-5
…er compiler and the objection hook

DossierCompiler and BezwaarCreationHook carried the same private
extractUuid(): a trimmed string, or the first of id, uuid, @self.uuid,
case and target that holds a string. That reading is now
Support\DossierReferenceUuid::from(); both copies keep their name and
delegate.

Assisted-by: ClaudeCode:claude-opus-5-5
…he term and deadline listeners

Assisted-by: ClaudeCode:claude-opus-5-5
…ossier references

CaseMergeStore::referencedId() and the referenced() of the deadline,
statutory-term and term-clock listeners carried the same reading: a
trimmed string, or a row's id as a string. The helper becomes
Support\ReferencedUuid with one dispatch and two row readings,
inDossierReference() and inReference(); all six copies delegate.

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