Skip to content

refactor(cmdb): carry the import run and row in context objects (REVIEW) - #1420

Merged
rubenvdlinde merged 4 commits into
developmentfrom
refactor/sig-cmdb-export-import-context
Nov 3, 2026
Merged

rubenvdlinde merged 4 commits into
developmentfrom
refactor/sig-cmdb-export-import-context

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

REVIEW: reads and writes imported organisations and owners. Held for a reviewer. No behaviour change is intended.

What

CmdbImportRun holds what every row of an import shares, and CmdbImportRow what one row found so far. The row and reconciliation steps now take one or two arguments. addRow moved onto the row, and transition and transitions read one item.

Golden

The first commit makes each test of CmdbExportImportServiceTest also compare everything it left in the doubles (register, saves, archive states, transitions, searches, log lines, address books, progress cache) with a recording. There are 106 recordings, 1.4 MB, made on the old code, and the refactor commit does not touch the file. Run times, durations, operation ids and generated uuids are placeholders. Green in Europe/Amsterdam, UTC and Asia/Tokyo, in random order, and with and without OpenRegister's vendor directory.

Durations needed care: the wall clock on this machine can step back, so a run logged "duration":-1 and failed the golden at random. The placeholder covers that, and the last test commit is that fix.

New tests

Mutants showed gaps in the old suite, so five tests were added and recorded on the old code too: the mapping, owners and manufacturer failure steps, the sheet row number given to the engine, the 1904 date system, and the schema a delete goes to.

Mutants

Capped, control survived: service 28 of 28, run 4 of 4, row 5 of 5. The 6 first-round survivors are the gaps above.

Numbers (with the other held PR on the same tree)

PHP on the combined tree, development to here, against the 4-star limit:

  • params >=3: 14.29% to 13.11% (limit 15%)
  • params >=5: 3.26% to 2.70% (limit 3.3%)
  • params >=7: 0.69% to 0.55% (limit 0.9%)
  • size >60: 28.47% to 28.16% (limit 8.3%, still missed)
  • McCabe >10: 14.58% to 14.54% (limit 7.3%, still missed)
    CMDB files only, LOC in units with 3+ params: 676 to 228.

Left at 3 parameters on purpose: runImport, merge, save, search, resolveContactPerson, contactByProperty, existingOwnerContact, logSafeMessage. These are small generic helpers (except runImport, 77 lines), and bundling their arguments would only hide them. The 12-parameter constructor is DI, and CmdbImportReport::addRow keeps its 9.

Verified

Linters on touched files after merging development: phpcs, phpstan, psalm, phpmd clean.
One heavy run on the combined tree of both held SQ6 PRs, 8e4e2e04 (development 3604e5b merged in): full PHPUnit under pcov with --fail-on-risky, exit 0, 1756 tests, 17377 assertions, 8 skipped. The 8 skips predate this work: OrganisationUserWorkflowTest (6) and ContactPersonHandlerTest (2), stale tests a refactor outran.
Hydra gates --scope-to-diff --base origin/development: 42 of 42 applicable ran. Two results to read: gate 122 found one new clone, this PR's link command constructor against ReferencesAuditCommand, fixed in 37053c8, then the ratchet re-ran with 0 findings in 49 changed units (30 inherited). Gate 116 failed because ajv was not installed in that tree; run on its own with ajv present it reports 0 findings, and connections.json is not in this diff. The full suite was not repeated for the one-line constructor change: its test file and phpcs were re-run.

🤖 Generated with Claude Code

Each of the 101 CmdbExportImportService tests now also compares what it
left in the doubles (register, saves, archive states, transitions,
searches, log lines, address books, progress cache) with a recording made
on the current code. Run times, operation ids and generated uuids are
replaced by placeholders, so the recording is the same in every time zone.

Assisted-by: ClaudeCode:claude-opus-5-5
CmdbImportRun holds what every row of an import shares and CmdbImportRow
what one row found so far, so the row and reconciliation steps take one
or two arguments in place of up to seven. The behaviour is unchanged: the
golden recorded on the previous commit's code passes as it is.

Assisted-by: ClaudeCode:claude-opus-5-5
The wall clock can step back during a run, which logs a duration of -1.

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde marked this pull request as ready for review November 3, 2026 22:30
@rubenvdlinde
rubenvdlinde merged commit 7f5b349 into development Nov 3, 2026
8 checks passed
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/stackiq @ 3f449e6

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-manifest ✅
check-vue-demi ✅
test-l10n ✅
format ✅
check-schema-l10n ❌
check-l10n-js ✅
composer ✅ ✅ 127/127
npm ❌ ✅ 807/807
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ✅ 1691/1691 · 8 skipped
Newman ⏭️
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ❌

Quality workflow — 2026-11-04 02:36 UTC

Download the full PDF report from the workflow artifacts.

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