Skip to content

refactor(cases): share the register context between CaseSplitStore and TakeoverStore - #5856

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

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

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

CaseSplitStore and TakeoverStore each carried their own copy of the register reading: the object service (refused with "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 for the incident log and the custody chain.

Both stores now build one DossierRegister from the SettingsService they are given and delegate context() and schema() to it. Public methods, constructor signatures (positional and named), DI wiring, return values, exception classes and messages, and the order of the settings reads are unchanged. The methods of these files changed by open PRs (CaseSplitStore::discardCase in #5349, TakeoverStore::writeCase in #5353) are not touched; they keep calling context() / schema().

Characterisation tests

tests/Unit/Service/Cases/StoreRegisterContextTest.php, committed first and green on the old code: for both stores, 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.

What ran

  • phpunit -c phpunit-unit.xml on the new test, tests/Unit/Service/Cases, the three takeover test classes and tests/Unit/Architecture: 231 tests, all green but one inherited failure.
  • phpcs and phpstan analyse on the touched files: no errors (the four @spec warnings on existing public methods were there before).

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

Duplication figures

CaseSplitStore <-> TakeoverStore: 19 duplicated 6-line windows before, 7 after. What remains is the public uuidOf() / context() / schema() delegate trio and the refusal shape of requireCase(), whose rule constants and sentences differ per store.

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


Generated by Claude Code

…tore before sharing it

Assisted-by: ClaudeCode:claude-opus-5-5
…d TakeoverStore

Both stores read the object service, the dossier register and a configured
schema with the same checks and sentences that Custody\DossierRegister
already holds. They now build one DossierRegister from the settings they
were given and delegate context() and schema() to it; callers, 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