Skip to content

refactor(db): FlowMapper and ConfigurationMapper are reached through an interface - #6746

Merged
rubenvdlinde merged 8 commits into
mainfrom
cloud/a04-flow-config-interfaces
Nov 9, 2026
Merged

rubenvdlinde merged 8 commits into
mainfrom
cloud/a04-flow-config-interfaces

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What changed

FlowMapper (fan-in 28) and ConfigurationMapper (fan-in 13) get a narrow interface next to them, FlowMapperInterface and ConfigurationMapperInterface, bound in DbRegistrar (alphabetical). Constructor-injected callers and container lookups by class constant switch to the interface; the alias resolves to the same shared instance, so nothing changes at runtime.

A few callers keep naming the class, on purpose:

  • ExportHandler and ImportHandler (ConfigurationMapper): both are touched by open pull requests.
  • ExampleSetFlows, FlowRunService, FlowDelegationCheck, FlowRunVersionPin, FlowRunAttribution (FlowMapper): they resolve the mapper from the container by name, and a shared test harness or a golden test keys its container fake on that name.

tests/Unit/Architecture/A04InterfaceBindingsTest.php pins the bindings and the implementations, and makes sure no file outside Db names either class beyond that known list. After the change, FlowMapper has 6 incoming dependencies and ConfigurationMapper has 4.

No behaviour, route, migration, stored data or public signature changes.

What ran

  • phpunit -c phpunit.xml --no-coverage on these paths: tests/Unit/Service/Flow (1,867), tests/Unit/Repair (178), tests/Unit/AppHost/Scheduling, tests/Unit/BackgroundJob, tests/Unit/Listener, tests/Unit/WorkflowEngine, tests/Unit/Service/{ObjectAction,Task,Config}, every test that names ConfigurationMapper or ConfigurationService (87 files), plus tests/Unit/Contract, Architecture, Kernel, Service/Interaction and Controller/ControllerServicesWiringTest.php. All green.
  • php -l, phpcs (no new findings) and phpstan on every touched file. phpstan's only messages are two "only written" property notes on ConfigurationMapper, and those also show up at base.

Rating (my area: lib/Db outside the entities and the MagicMapper and SchemaMapper directories; check_sig_maintainability five-star profile, fan-in measured across the whole app)

  • Module coupling, share of LOC in modules with fan-in >10/20/50: 9.30% / 5.23% / 1.59% before, 7.81% / 4.55% / 1.58% after.
  • Area rating estimate: 3.27 – 3.51 before, 3.31 – 3.55 after.

AI-assisted: this change was written by Claude Code (claude-opus-5-5) in an automated session and is not merged; it needs a human review.


Generated by Claude Code

claude and others added 3 commits November 7, 2026 22:16
…an interface

Callers outside the Db component now type against FlowMapperInterface
and ConfigurationMapperInterface, bound in DbRegistrar. The mappers'
own fan-in drops from 28 and 13 to a handful; the remaining namers are
files in open pull requests or resolved by name through a shared test
harness, pinned in A04InterfaceBindingsTest so the list cannot grow.

No behaviour changes: the alias resolves to the same shared instance.

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5

# Conflicts:
#	lib/Service/ObjectAction/ObjectActionStepsFlow.php
TaskFormResolver now takes its readers through TaskFormResolverServices
(from development); the conflict is resolved on that side and the
bundle types the flow reader as FlowMapperInterface instead.

Assisted-by: ClaudeCode:claude-opus-5-5

Copy link
Copy Markdown
Contributor Author

Newman API Test Suite (workflow api-test-coverage.yml) failed on 981bd76, which is this PR's first commit. The failure does not come from this PR:

  • The same workflow fails on development (dc5482c40) and on every other branch in its last 20 completed runs.
  • None of the failing tests touch this diff. They are JobRunMapperNarrowGoldenTest, FileVersioningHandlerGoldenTest (Cannot declare interface OCA\Files_Versions\Versions\IVersionManager, an eval'd stub declared twice in one process), TextExtractionJobsGoldenTest, EndpointsControllerAnswersGoldenTest and SchemaConfigValidatorsGoldenTest.
  • This PR only changes types. It switches FlowMapper and ConfigurationMapper callers to their interfaces.

There is no fix on development yet, so there is nothing to port. The check is running again on the current head (fe4d5e6, which merges in development).


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

quality / Frontend Check (test:l10n) fails on fe4d5e6, but the failure doesn't come from this PR:

  • node tests/l10n/check-l10n.js on current development reports the same thing: FAIL — 12 translation key(s) used in source but MISSING from l10n/en.js.
  • This PR changes only PHP under lib/ and tests/. It touches no frontend source and no l10n/ file.

The missing keys come from development (see the "Known state" note in CLAUDE.md). Adding them belongs in its own l10n commit, which this PR shouldn't carry. No fix exists on development yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Three more frontend checks fail on fe4d5e6. None of them comes from this PR, which changes 0 files under src/ or l10n/ and no .js, .vue or .ts files, only PHP under lib/ and tests/:

  • Frontend Check (test:l10n:parity): node tests/l10n/check-l10n-parity.js on current development fails the same way. The key "We could not count the objects. Close this window and try again." is missing from several locales.
  • Frontend Tests (unit): 4 failures, in relationTabs.dom.golden.spec.js and shared.confirmDialogs.dom.golden.spec.js. Both are frontend golden specs whose sources this PR does not touch.
  • Frontend Check (format): Prettier reports 38 files, and none of them is in this diff.

All three come from development. No fix has landed there yet, so there is nothing to port into this PR.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Three more checks are red on fe4d5e6: PHP Quality (phpstan), PHP Quality (psalm) and Vue Quality (eslint). None of their findings is in a file this PR changes.

  • phpstan, 14 errors. They are in FileTextExtractionJob, EndpointsController, RegisterStatistics, TaskNotesController, WebhooksController, NotesController, GraphQLService, NotesProvider and Db/Tenancy/TenancyIdentityTrait (unreachable statement, in the context of SchemaMapper).
  • psalm, 24 errors. Some are UnusedBaselineEntry (HandlesExceptionsTrait, CalendarEventService, SaveObjects, TaskService, DbalObjectSourceProvider). The rest are in entity, service and mapper files. None touches FlowMapper, ConfigurationMapper or the callers this PR retypes.
  • eslint. Every finding is in src/ Vue and JS files, and this PR changes none of them.

This PR only changes PHP types: interfaces, DbRegistrar bindings, caller type hints and one architecture test. Running phpstan, psalm and phpcs locally on those files gives no new findings. The red checks come from development, and there is no fix there yet that I could port.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

PHP Quality (phpcs) also fails on fe4d5e6, and none of the errors is in a file this PR changes.

There is one error in each of seven files: Db/ImportPreviewRow, Db/RuleRun, Db/EntityRelation, Db/CaseItem, Db/MagicMapper/MagicObjectSearchInterface, Service/Object/SaveObject/RelationCascadeHandler and Controller/FlowTimerDiagnosticController.

Run locally, phpcs on every file this PR changes is clean. These errors come from development, and there is no fix there yet to bring in.


Generated by Claude Code

…e mirrors

ConfigurationMapperInterface repeats the $_multitenancy and
$systemLookup flags of ConfigurationMapper's public signature, which
the baseline already carries for the mapper. The interface gets the
same entry instead of a suppression annotation.

Assisted-by: ClaudeCode:claude-opus-5-5
…lass's

FlowMapperInterface::findAllFlows and ConfigurationMapperInterface::findAll
repeated the one-parameter-per-line layout of the signatures they mirror,
which the SIG ratchet (gate-122) counts as a new 6-line clone. The
parameters are grouped instead; the signatures are unchanged.

Assisted-by: ClaudeCode:claude-opus-5-5

Copy link
Copy Markdown
Contributor Author

Hydra Gates on fe4d5e6:

  • gate-122 (SIG ratchet). This one was this PR's. Two interface signatures repeated, line for line, the parameter layout of the class signatures they mirror, and the ratchet counted each as a new 6-line clone. Fixed in 3247bf6fe: the parameters are grouped and the signatures are unchanged. A local ratchet run against the merge base now gives 0 findings.
  • gate-3 (stub-scan), gate-17 (redundant-controller), gate-46 (spec-anchor-existence) and gate-49 (controller-exception-translation). These run over the whole tracked tree (SCOPE-MODE: full), not this diff. The run lists none of this PR's files under them, so they are inherited from development.

Generated by Claude Code

development retyped other dependencies on the same constructor lines
(FlowRunStepMapperInterface, FlowVersionMapperInterface,
AppConfigurationImporterInterface, ConfigurationTransferInterface) and
added many DbRegistrar bindings. Each conflict takes development's side
and keeps the FlowMapperInterface / ConfigurationMapperInterface types;
DbRegistrar keeps both sets of bindings in order.

Assisted-by: ClaudeCode:claude-opus-5-5

Copy link
Copy Markdown
Contributor Author

quality / Integration Tests (Newman) failed on fe4d5e6, two commits behind the current head a621d60. Three assertions failed:

  1. 18b. Restore Deleted Object: expected the response to be one of [200, 500], got 412.
  2. openregister-dates-follow / "The contact follows": the contact's destruction date came back undefined.
  3. notify-on-change: a flow step failed on The call to source "d1478ebc-…".

None of the three goes through code this PR changes in behaviour. The PR only retypes FlowMapper and ConfigurationMapper callers to interfaces that resolve to the same shared instance, and it touches no object restore, retention-date or source-call code. The flow failure is in the source call a step makes, not in how the flow is loaded.

I can't yet compare with development. Every recent run of this job on other branches was cancelled, and the run on development (42484299859) is still pending, as is the run on this PR's current head (42484768011). I'll compare the two once they finish. If any of these assertions passes on development and fails here, I'll fix it on this branch.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 57fc8d6

Check PHP Vue Security License Tests
lint ⏭️
phpcs ⏭️
phpmd ⏭️
psalm ⏭️
phpstan ⏭️
phpmetrics ⏭️
eslint ⏭️
stylelint ⏭️
build ⏭️
composer ⏭️ ⏭️
npm ⏭️ ⏭️
app:check-code ⏭️
info.xml ⏭️
REUSE ⏭️
lockfile sync ⏭️
PHPUnit ❌ cancelled — no verdict
Newman ❌ cancelled — no verdict
Playwright ❌ cancelled — no verdict
Hydra gates ❌ cancelled — no verdict

Quality workflow — 2026-11-08 20:45 UTC

Download the full PDF report from the workflow artifacts.

development retyped FlowSemanticVersion, FlowTriggerIndex and
PrincipalResolverRegistry on the same Repair lines and added the
ConfigurationDeployment/Draft mapper bindings. Each conflict takes
development's side and keeps the FlowMapperInterface type; DbRegistrar
keeps both sets of bindings in order.

Assisted-by: ClaudeCode:claude-opus-5-5

Copy link
Copy Markdown
Contributor Author

Follow-up on Integration Tests (Newman). On the current head d772a04, the same three assertions fail as on fe4d5e6: 18b. Restore Deleted Object (412), The contact follows (destruction date undefined) and notify-on-change (a step's call to a source fails). Nothing new fails.

I still can't compare against development. Every run of this workflow on another branch has been cancelled, and the latest run on development (42524938478) is queued. A static check of the code those assertions exercise:

  • Object restore: DeletedController and lib/Service/Object/* reference neither FlowMapper nor ConfigurationMapper.
  • The flow step: it loads the flow the same way as before, through the same shared instance, now typed by its interface. The step fails on the outbound source call, which this PR doesn't touch.
  • Retention dates: this PR doesn't touch them.

When the development run completes, I'll compare it with this one. If an assertion passes there and fails here, I'll fix it on this branch.


Generated by Claude Code

@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 2d5319e

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-specs ✅
test-l10n ❌
test-l10n-parity ❌
format ❌
check-schema-l10n ✅
composer ✅ ✅ 168/168
npm ✅ ✅ 641/641
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ 48933/48943 · 20 skipped
Newman ❌ 1625/1628
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-08 22:06 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde changed the base branch from development to main November 9, 2026 06:57
@rubenvdlinde
rubenvdlinde merged commit b8bbb12 into main Nov 9, 2026
35 of 49 checks passed
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