Skip to content

refactor(architecture): publish the five values the object values name in lib/Contract (X00 a) - #10976

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

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

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Package X00, PR a of 3: the five transitive value types move into lib/Contract

Wave 5, round 1, task 7.2 (published contract self-contained). This PR moves the five values that the eight ObjectServiceInterface values name in their own signatures: ObjectFindTarget, SaveActor, SavePolicy, BulkBatchDefaults, LockRunStep.

What moved and why

  • New lib/Contract/<X>.php for each of the five: the class body verbatim (constructor, promoted readonly properties, methods, docblocks). Three changes only, as the package says: the class is no longer final; ObjectFindTarget::fromFindOptions() builds new static(...) (return type static, with @phpstan-consistent-constructor / @psalm-consistent-constructor), so calling it on the old name still returns the old type; type hints on other promoted types follow in PR b (fromFindOptions() still takes the Kernel ObjectFindOptions until that one is promoted).
  • lib/Kernel/Contracts/Value/<X>.php keeps its name and becomes final class X extends \OCA\OpenRegister\Contract\X {}, @deprecated naming the new class. Every construction (positional or named), instanceof and type hint on the old name keeps working. No class_alias.
  • lib/Contract/ counts to Kernel through its existing directory row (Contract/,,Contract,,,,,Kernel), so scripts/component-map.csv and the generated files do not change.
  • ContractIsALeafTest::PUBLISHED lists the five new published files.

Nothing in lib/Service changes in this PR; no caller changes.

Re-measured on fresh origin/main (c3d2067b)

#10852, #10859 and #10929 (the open PRs the package named) are merged. No earlier X00 PR exists. None of the five types was in lib/Contract yet.

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

Area before after diff
Kernel 8,464 8,417 −47
Core 57,249 57,249 0
Notifications 1,759 1,759 0
Search 1,344 1,344 0
Compliance 14,297 14,297 0
Files 1,458 1,458 0
Integrations 17,733 17,733 0
Processes 27,064 27,064 0
Configuration 997 997 0
Platform 61 61 0
Total 130,426 of 462,011 130,379 of 461,964 −47

Expected by the package: about +65 for all 13 stubs. Measured −47 for these five: the code lines moved to lib/Contract/, which only the Kernel stubs name so far (same area, not exposed); the stubs that other areas name are a few lines each.

Functional view (rate_component_views.py, view C): unchanged, independence 1.42, entanglement 5.32, modularity 3.94.

References against the order

56 before, 56 after (modularity_check.py).

Newly exposed files / new Kernel files

modularity_check.py --check reports exactly five new Kernel files and nothing else:

  • lib/Contract/BulkBatchDefaults.php, lib/Contract/LockRunStep.php, lib/Contract/ObjectFindTarget.php, lib/Contract/SaveActor.php, lib/Contract/SavePolicy.php: the published contract decided in task 7.2 (Ruben, 2026-11-20). They are deliberate: the published ObjectServiceInterface reaches them through its values, and leaf apps can only load what lib/Contract (and its copy in hydra-gates/contracts/) holds.

No newly exposed file.

Gate 67

The hydra-gates/contracts/ copy in ConductionNL/.github gets these files in the companion PR opened with PR c (it carries all 13 files and the changed ObjectServiceInterface.php at once, byte-identical). This PR is not mergeable before that .github PR; land the .github PR first, or land a, b and c together after it.

Gate 67 on main today (runner and contracts from .github@main, against origin/main's lib/Contract), before this package: already FAIL — ObjectFileReaderInterface.php is not shipped in hydra-gates/contracts/, and ObjectServiceInterface.php differs (the shipped copy predates the value-object signatures). Not fixed here (ObjectFileReaderInterface is out of scope per the package; ObjectServiceInterface is replaced by the companion PR).

What ran

  • php -l on the 10 changed lib files: clean.
  • vendor/bin/phpcs on them: clean.
  • vendor/bin/phpstan analyse --no-progress on them and lib/Service/ObjectService.php (the fromFindOptions caller): [OK] No errors, exit 0.
  • vendor/bin/psalm --no-cache on them: no errors.
  • python3 tools/sig/modularity_check.py --check: only the five deliberate new Kernel files above; no new reference against the order.
  • tools/sig/deptrac.sh areas --check: no new violating pair from this PR. It reports 2 "new" pairs (ObjectSourceWiring -> CalendarEventService, RenderObject -> WatcherService) that it reports identically on origin/main without this change (stale baseline, not this PR).
  • vendor/bin/phpunit -c phpunit.xml --no-coverage tests/Unit/Architecture: 2371 tests; the only failure before the test update was ContractIsALeafTest::testContractHoldsOnlyThePublishedFiles (the list now names the five files); ContractIsALeafTest and the new test pass.
  • tests/Unit/Contract/PromotedValueTypesTest.php (new) + ContractIsALeafTest: OK (22 tests, 61 assertions).
  • Every unit test that names one of the five old names (174 files): 3372 tests, 4 errors, all in AnonymousEnvelopeReadPathsTest, which fails identically on origin/main (ObjectsControllerFactory::args() TypeError, not this PR).

Order

PR a → PR b (stacked on this branch) → PR c (stacked on b). The .github companion PR lands first.

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


Generated by Claude Code

…ead values name in lib/Contract

ObjectFindTarget, SaveActor, SavePolicy, BulkBatchDefaults and LockRunStep move
verbatim into lib/Contract (task 7.2). Each old Kernel\Contracts\Value name stays
as a deprecated final subclass with nothing of its own, so every construction,
instanceof and type hint keeps working. ObjectFindTarget::fromFindOptions() builds
the class it is called on (new static), so the old name still returns the old type.

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde merged commit 8843570 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