fix(samenwerkverzoek): honour the ObjectServiceInterface contract - #855
Conversation
All six PHPUnit matrix cells are red on `development`. Two separate defects against OpenRegister's published ObjectServiceInterface, and the first one is a production bug, not a test artefact. 1. `initiateSamenwerking()` and `respondToSamenwerking()` are both declared `: array`, but `saveObject()` returns an `ObjectEntityInterface`. Returning it straight out is a TypeError on every call — including from DsoController::respondSamenwerking(), which is why it surfaced as an ERROR rather than a failed assertion. Both now normalise through an `asArray()` helper, mirroring the helper of the same name already in CaseCollaborationService, and staying defensive so either shape works. 2. `testInitiateSamenwerkingCreatesObject` pinned the OLD argument order ($register, $schema, $object). The contract takes $object FIRST, and the caller uses named arguments, so the double receives ($object, $extend, $register, $schema). The sibling test at line 231 had already been corrected and carried a comment saying exactly this — this one was missed. It now also asserts the register and schema it was silently ignoring. Verified in a PHP 8.4 container with OpenRegister's real Contract interfaces preloaded, which reproduces CI exactly (a plain standalone run cannot resolve them and errors identically on both sides, so it cannot discriminate): pristine development 1931 tests, 2 errors, 1 failure, 1 risky this branch 1931 tests, 0 errors, 0 failures Exactly the three SamenwerkverzoekServiceTest cases move to passing, and nothing is introduced.
The helper I added took `mixed $value`, and that pushed SamenwerkverzoekService's CouplingBetweenObjects from 12 to 13, which is the hydra-gates threshold. phpmd is GREEN on this branch's merge-base (34a35dc) and red on the branch, so it was mine. `ObjectServiceInterface::saveObject()` returns an `ObjectEntityInterface`, which extends `JsonSerializable`, so the defensive is_array() branch was never reachable. Calling `->jsonSerialize()` at the two sites is both simpler and adds no type reference at all. Same behaviour: full suite still 1931 tests, 0 errors, 0 failures.
|
Update — phpmd was mine, and it is fixed. The first push turned Cause: the Fix: drop the helper. Behaviour is unchanged: the full suite is still 1931 tests, 0 errors, 0 failures (baseline
|
Quality Report — ConductionNL/procest @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ❌ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-manifest | ✅ | ||||
| check-vue3-compile | ✅ | ||||
| test-l10n | ✅ | ||||
| format | ✅ | ||||
| composer | ✅ | ✅ 104/104 | |||
| npm | ✅ | ✅ 535/535 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ❌ | ||||
| PHPUnit | ❌ | ||||
| Newman | ⏭️ | ||||
| Playwright | ❌ | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-08-15 23:18 UTC
Download the full PDF report from the workflow artifacts.
Quality Report — ConductionNL/procest @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ✅ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ✅ | ||||
| stylelint | ✅ | ||||
| build | ✅ | ||||
| check-manifest | ✅ | ||||
| check-vue3-compile | ✅ | ||||
| test-l10n | ✅ | ||||
| format | ✅ | ||||
| composer | ✅ | ✅ 104/104 | |||
| npm | ✅ | ✅ 535/535 | |||
| app:check-code | ⏭️ | ||||
| info.xml | ✅ | ||||
| REUSE | ❌ | ||||
| PHPUnit | ✅ | ||||
| Newman | ⏭️ | ||||
| Playwright | ✅ | ||||
| Hydra gates | ❌ |
Quality workflow — 2026-08-16 00:08 UTC
Download the full PDF report from the workflow artifacts.
All six PHPUnit matrix cells are red on
development. Two separate defects against OpenRegister's publishedObjectServiceInterface— and the first is a production bug, not a test artefact.1. A TypeError on every call (production)
initiateSamenwerking()andrespondToSamenwerking()are both declared: array, butObjectServiceInterface::saveObject()returns anObjectEntityInterface. Returning it straight out of a method declared: arrayis aTypeErroron every invocation — including fromDsoController::respondSamenwerking(). That is why it surfaced as an ERROR rather than a failed assertion.Both call sites now normalise through an
asArray()helper, mirroring the helper of the same name already present inCaseCollaborationService, and staying defensive so either shape works.2. A test pinned to the old argument order
testInitiateSamenwerkingCreatesObjectexpectedsaveObject('procest-register', …)— the old($register, $schema, $object)order. The contract takes$objectfirst, and the caller uses named arguments, so the double receives($object, $extend, $register, $schema).The sibling test at line 231 had already been corrected and carried a comment saying exactly this; this one was missed. It now also asserts the register and schema it was silently ignoring.
Verification
Run in a PHP 8.4 container with OpenRegister's real
Contractinterfaces preloaded. That detail matters: a plain standalone run cannot resolveOCA\OpenRegister\Contract\ObjectServiceInterfaceand errors identically on both sides, so it cannot discriminate. With them preloaded the environment reproduces CI's numbers exactly.developmentExactly the three
SamenwerkverzoekServiceTestcases move to passing. Nothing introduced.