Skip to content

[access] refactor(people): share the register context of the seat, handover and role services - #5857

Merged
rubenvdlinde merged 2 commits into
developmentfrom
quality/h16-people-register
Nov 12, 2026
Merged

rubenvdlinde merged 2 commits into
developmentfrom
quality/h16-people-register

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

CaseSeats, InternalHandover, LeaverHandoverService and CaseRoleProjection each carried a private copy of the register reading: the object service ("OpenRegister is not available"), the configured register ("Dossier register not configured") and a configured schema ("Dossiq schema not configured"). Custody\DossierRegister already holds exactly that reading.

Each class now builds one DossierRegister from the SettingsService it is given and its private context() / requireRegister() and schema() delegate to it. Constructor signatures (positional and named), DI wiring, return values, exception classes and messages, and the order of the settings reads are unchanged. Methods of these files changed by open PRs (CaseSeats::nameCoordinator in #5353, CaseSeats::clearCoordinator in #5349, InternalHandover::writeCase and LeaverHandoverService::recordOnCase in #5353) are not touched; they keep calling the same private methods.

The path of CaseRoleProjection falls under the access paths, hence the title prefix; no access decision is involved, the class only reads the register and schemas.

Characterisation tests

tests/Unit/Service/People/RegisterContextCopiesTest.php, committed first and green on the old code: for all four classes (reached by reflection, the readings are private), the context pair, the refusal without OpenRegister (and that the register is then not read), the refusal without a register, a configured schema and the refusal of an unset schema key. 20 cases.

What ran

  • phpunit -c phpunit-unit.xml on the new test, tests/Unit/Service/People, the seat, handover, leaver and person-link test classes and tests/Unit/Architecture: 245 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)

  • CaseSeats <-> InternalHandover: 13 -> 1
  • CaseSeats <-> CaseRoleProjection: 9 -> 4
  • DossierRegister <-> CaseSeats (and the same for each of the other three): 6 -> 0

What remains between them is the two-line delegate pair and unrelated row helpers.

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


Generated by Claude Code

… services before sharing it

Assisted-by: ClaudeCode:claude-opus-5-5
…d role services

CaseSeats, InternalHandover, LeaverHandoverService and CaseRoleProjection each
carried a private copy of the object service, register and schema reading
that Custody\DossierRegister already holds. Each now builds one
DossierRegister from its settings and delegates to it; constructor
signatures, return values and exception messages are unchanged.

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