Skip to content

refactor(architecture): publish the eight values ObjectServiceInterface names in lib/Contract (X00 b) - #10977

Merged
rubenvdlinde merged 3 commits into
mainfrom
cloud/mod-X00-named-values
Nov 21, 2026
Merged

rubenvdlinde merged 3 commits into
mainfrom
cloud/mod-X00-named-values

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Package X00, PR b of 3: the eight value types ObjectServiceInterface names move into lib/Contract

Wave 5, round 1, task 7.2. Stacked on #10976 (PR a): the eight values name the five values PR a publishes, so this branch contains PR a's commit; review only the second commit (959387d7). Land #10976 first.

What moved and why

  • New lib/Contract/<X>.php for ObjectSaveOptions, BulkSaveOptions, LockRequest, UnlockRequest, ObjectFindOptions, ObjectDeletion, ObjectPatch, ObjectValidationVerdict: class body verbatim (constructor, promoted readonly properties, methods, docblocks), no longer final. Within OCA\OpenRegister\Contract the type hints and the constructor defaults on other promoted types now resolve to the published classes (ObjectFindTarget, SavePolicy, SaveActor, BulkBatchDefaults, LockRunStep), so the published contract is self-contained: a leaf app that loads hydra-gates/contracts/ can build new ObjectSaveOptions() without any Kernel class. ObjectPatch dropped its explicit import of the Kernel ObjectFindTarget for that reason.
  • lib/Contract/ObjectFindTarget.php (from PR a): fromFindOptions() now takes the published ObjectFindOptions (a widening; the old name is a subclass).
  • lib/Kernel/Contracts/Value/<X>.php keeps its name as final class X extends \OCA\OpenRegister\Contract\X {}, @deprecated naming the new class. Positional and named construction, instanceof and type hints on the old name keep working; ObjectValidationVerdict stays JsonSerializable through its parent.
  • Receiving chain (package step 4) for this PR: a full vendor/bin/phpstan analyse of lib/ after the move reports exactly one new call that passes a published value into an old-typed parameter: ObjectService::patchWithinScope() passes ObjectPatch::$target (now Contract\ObjectFindTarget) to the private findPatchTarget(). That parameter is widened to Contract\ObjectFindTarget (imported as PublishedObjectFindTarget, because ObjectService keeps constructing the old name). It is in this PR rather than in PR c because without it patchObject() with a default-built target would hit a TypeError at runtime. Nothing else in lib/ changes.
  • ContractIsALeafTest::PUBLISHED lists the eight new files. No csv change: lib/Contract/ counts to Kernel through its directory row.

Behaviour: one difference by design, documented: a value built without an explicit nested value (for example new Kernel\...\ObjectSaveOptions()) now holds a default Contract\ObjectFindTarget / Contract\SavePolicy / Contract\SaveActor / Contract\BulkBatchDefaults instead of the old subclass. Same properties and values; every openregister parameter that receives one accepts the published type (phpstan clean), and the fleet check in PR c covers apps.

Exposed lines per area (measure()['exposed_loc'])

Area main c3d2067b after PR a after PR b diff vs main
Kernel 8,464 8,417 8,365 −99
Core 57,249 57,249 57,250 +1
Notifications 1,759 1,759 1,759 0
Search 1,344 1,344 1,344 0
Compliance 14,297 14,297 14,297 0
Files 1,458 1,458 1,458 0
Integrations 17,733 17,733 17,733 0
Processes 27,064 27,064 27,064 0
Configuration 997 997 997 0
Platform 61 61 61 0
Total 130,426 130,379 130,328 −98

Expected by the package: about +65 Kernel for the 13 stubs. Measured −99 Kernel so far: the moved code is named mostly by the Kernel stubs (same area); PR c, which types the published interface and ObjectService against the new names, is where the published files become exposed. Core +1 is the PublishedObjectFindTarget import in ObjectService.

References against the order

56 before, 56 after.

Newly exposed files / new Kernel files

modularity_check.py --check reports:

  • 13 new Kernel files (5 from PR a, 8 here): lib/Contract/{BulkBatchDefaults,BulkSaveOptions,LockRequest,LockRunStep,ObjectDeletion,ObjectFindOptions,ObjectFindTarget,ObjectPatch,ObjectSaveOptions,ObjectValidationVerdict,SaveActor,SavePolicy,UnlockRequest}.php: the published contract decided in task 7.2.
  • 1 newly exposed file: lib/Contract/ObjectFindTarget.php, named by ObjectService (Core) through the widened findPatchTarget() parameter: a value on the published contract's signature.

Nothing else.

Gate 67

The companion PR in ConductionNL/.github (opened with PR c) carries all 13 files and the changed ObjectServiceInterface.php, byte-identical. Not mergeable before that .github PR. Gate 67 is already red on main (see #10976).

What ran

  • php -l and vendor/bin/phpcs on the 17 changed lib files and ObjectService.php: clean.
  • vendor/bin/phpstan analyse --no-progress on all of lib/, compared with the same run on origin/main: 38 findings on both, identical lists (the one new finding the move caused, findPatchTarget, is fixed here).
  • vendor/bin/psalm --no-cache on lib/Contract/*.php, the 8 stubs and ObjectService.php: no errors.
  • python3 tools/sig/modularity_check.py --check: only the deliberate files above; no new reference against the order.
  • tools/sig/deptrac.sh areas --check: no new pair from this change (the same 2 stale-baseline pairs as on origin/main).
  • vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit/Architecture: OK (2371 tests, 8057 assertions).
  • tests/Unit/Contract/PromotedValueTypesTest.php (all 13 types: old name is an instance of the new; equal values from equal named arguments; equal defaults; positional construction on the old name; inherited methods; the named constructor returns the class it is called on; published nested values accepted by the old names) + ContractIsALeafTest: OK (49 tests, 155 assertions).
  • Every *Test.php under tests/Unit that names any of the 13 old names or Service\ObjectService (645 files): 9228 tests, 4 errors, all AnonymousEnvelopeReadPathsTest, which fails identically on origin/main.

Order

.github companion PR → #10976 (a) → this PR (b) → PR c.

Written with Claude Code (claude-opus-5-5)


Generated by Claude Code

…ce names in lib/Contract

ObjectSaveOptions, BulkSaveOptions, LockRequest, UnlockRequest, ObjectFindOptions,
ObjectDeletion, ObjectPatch and ObjectValidationVerdict move verbatim into
lib/Contract (task 7.2); their properties and the ObjectFindTarget named
constructor name the published classes. Each old Kernel\Contracts\Value name stays
as a deprecated final subclass with nothing of its own.

ObjectService::findPatchTarget() takes the published ObjectFindTarget, because
ObjectPatch::$target now has that type.

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde merged commit 9e05734 into main Nov 21, 2026
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