Skip to content

refactor(decisions): split BesluitMigrationService::migrate and migrateRows into named steps - #5519

Merged
rubenvdlinde merged 3 commits into
developmentfrom
quality/f02-besluit-migration
Nov 10, 2026
Merged

rubenvdlinde merged 3 commits into
developmentfrom
quality/f02-besluit-migration

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

BesluitMigrationService::migrate (47 lines, complexity 7) and migrateRows (39 lines, complexity 6) checked decidiq and the target schema, read the source rows, wrote each one onto decidiq and tallied the outcome in two long methods. They now read as steps:

  • migrate() → blockedSummary() — the blocked answer when decidiq or its schema is missing;
  • migrateFrom() — reads the source rows and hands them on;
  • migrateRows() → migrateRow() — one row: skipped, migrated (or would be, on a dry run) or failed, each counted on the run.

The counters, the commit flag and the target schema the steps share travel in a BesluitMigrationRun that never leaves the service. The public signature is unchanged; the summary keys and their order, the messages, the log lines and the writes are identical.

Characterisation tests (committed first, green on the old code)

BesluitMigrationServiceTest::testTheSummaryKeepsItsWholeShape pins the whole summary of a blocked run (its keys, in order, and the zero counts) and of a dry run that meets a row without an id. The existing tests pin the migrated and detached paths.

What ran

  • vendor/bin/phpunit -c phpunit-unit.xml --no-coverage tests/Unit/Service/BesluitMigrationServiceTest.php tests/Unit/Service/LocalDecisionAuthoringTest.php tests/Unit/Architecture/OneDateWritePathTest.php: green on the old code and on the new.
  • tests/Unit/Architecture: green except ServiceCatchReturnsNullTest::testEveryAllowlistEntryNamesALiveSite, which fails on development too (a stale allowlist entry for lib/Service/Settings/OpenRegisterBridge.php); inherited.
  • vendor/bin/phpcs, vendor/bin/phpmd (both rule sets), vendor/bin/phpstan analyse and vendor/bin/psalm on the two files: clean.
  • The test file is also touched by refactor(dossiq): save objects through ObjectSaveOptions #5353 (the saveObject double's signature, at the top of the file); the new test sits in a different hunk and merges cleanly beside it.

Figures for the touched file

before after
migrate 47 lines, complexity 7 under 15 lines
migrateRows 39 lines, complexity 6 under 15 lines
new units — migrateFrom 18 lines, migrateRow 19 lines, complexity ≤ 5, ≤ 2 parameters
duplication 0 0

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


Generated by Claude Code

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.

1 participant