Skip to content

[access] refactor(object): reach four lib/Service/Object helpers through interfaces - #7592

Merged
rubenvdlinde merged 4 commits into
mainfrom
cloud/k15-retention-draft-frames
Nov 9, 2026
Merged

rubenvdlinde merged 4 commits into
mainfrom
cloud/k15-retention-draft-frames

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Summary

SIG component-independence work, lane K15 (round 10c). Four concrete classes in lib/Service/Object were named from other top-level components. Each of those callers now names only an interface, so the classes are hidden. This changes types only: no allowed or refused outcome changes.

Class Was named from Now
RetentionDestruction BackgroundJob/DestructionListRun, Listener/ObjectStateDeleteGuardListener (new) RetentionDestructionInterface. The listener gets it through its autowired constructor (2 → 3 params). The list run gets it from the container it already holds.
DraftRemovalFrame BackgroundJob/DraftExpiryJob (static asJob) DraftRemovalFrameInterface. asJob is now an instance method. The job's constructor goes 3 → 4 params, and its @SuppressWarnings(StaticAccess) goes because the static call is gone.
ConflictReports Controller/Support/ObjectVersionGuard (static from) The guard calls $container->get(ConflictReportInterface::class). ContractBindings already aliases that interface to ConflictReport, so this is the same shared instance. ConflictReports had no other caller and is deleted.
CorrectionTarget Controller/CorrectionsController (new) CorrectionTargetsInterface::forRecord(). The constructor keeps 4 params: it passes AppIdentity::APP_ID to the parent instead of receiving $appName, as ScopesController, SetupController and others already do.
  • New bindings are in lib/Service/Bindings/ObjectsBindings.php: RetentionDestructionInterface, DraftRemovalFrameInterface and CorrectionTargetsInterface.
  • Both frames keep their static state. Every instance therefore still reads the one destruction depth, or the one acting job, of the call stack.

Why [access]

The retention-destruction frame decides whether the delete guard lets a lock or the archive be bypassed. The draft-removal frame names the actor in the audit entry. Neither one's logic changes, and the guard check still runs before the delete.

Test Coverage

  • Delete guard. ObjectStateDeleteGuardListenerTest covers the refusals (locked by someone else, archived) and the allowed cases (lock holder, the run holding the lock, open object, trashed row, retention destroying a locked and archived object). It passes on the old code and on the new code; only its constructor call changed.
    • Mutation check: flipping isRunning() === true to === false fails 3 of its 8 tests. The mutation was reverted.
  • Destruction golden. DestructionExecutionJobGoldenTest records every container lookup. Its fixture gains exactly one get RetentionDestructionInterface entry per case (12 cases). This is the deliberate new lookup; no other line in the fixture moves.
  • Version-conflict golden. ObjectsControllerVersionConflictGoldenTest now expects the lookup under ConflictReportInterface::class, which resolves to the same instance.
  • Other tests. DraftExpiryJobTest and CorrectionsControllerTest follow the constructor changes. The new tests/Unit/Architecture/K15InterfaceBindingsTest.php checks that each binding is present and that each class implements its interface.
  • Guards. Ran on the branch merged with current development: tests/Unit/Architecture, Contract, Kernel, Service/Rules, all of tests/Unit/Controller (which includes both wiring tests), BackgroundJob, Listener, Service/Object and Service/Bindings. Result: OK, 17155 tests, 7 skipped. All skips pre-existing.
  • Static checks.
    • php -l passes.
    • phpcs: no new warnings. The two warnings it reports, a missing class @spec on CorrectionsController and on DraftRemovalFrame, are already on development.
    • phpmd (phpmd.xml) reports nothing.
    • phpstan reports no errors on the touched files.
  • Stale comment. tests/Unit/Architecture/C12/SmallServiceHelpers.php still says in a comment that the guard goes through ConflictReports. That file is a guard, so this PR leaves it unedited.

Numbers (lane_measure.py, K15 scope)

  • Exposed LOC of the K15 target classes: 526 → 481. That is 45 LOC: RetentionDestruction 17, CorrectionTarget 11, ConflictReports 9 and DraftRemovalFrame 8.
  • Interfacing: gt4 252 and gt6 17 do not change (targets ≤ 527 and ≤ 56, already met).

AI-assisted: this change was written by Claude Code and checked against the lane brief.


Generated by Claude Code

…h interfaces

DestructionListRun and ObjectStateDeleteGuardListener built RetentionDestruction
with new, and DraftExpiryJob called DraftRemovalFrame::asJob() statically, so
both classes were named from lib/BackgroundJob and lib/Listener. They now
implement RetentionDestructionInterface and DraftRemovalFrameInterface, bound in
ObjectsBindings; the listener and the expiry job take the interface in their
autowired constructors and the list run asks its container for it.

Both frames keep their static state, so every instance reads the one count or
acting job of the call stack: outcomes are unchanged. The destruction golden
records the one extra container lookup per run; nothing else in it moves.

Assisted-by: ClaudeCode:claude-opus-5-5
ObjectVersionGuard asked ConflictReports::from() for the container entry under
ConflictReport's class id, so lib/Controller named a concrete lib/Service class.
ConflictReportInterface is already an alias of ConflictReport in
ContractBindings, so asking for the interface returns the same shared instance.
The guard now does that, and ConflictReports, which had no other caller, goes.

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

CorrectionsController built CorrectionTarget with new. It now asks
CorrectionTargetsInterface, bound to CorrectionTargets in ObjectsBindings, so
lib/Controller no longer names the value object. The constructor keeps four
parameters: it passes AppIdentity::APP_ID to the parent instead of receiving
its own app id, as the other controllers already do.

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde changed the base branch from development to main November 9, 2026 06:53

Copy link
Copy Markdown
Contributor Author

Newman API Test Suite (api-test-coverage) is red. The failing tests are not in the code this PR touches.

The PHPUnit run inside that job reports 11 errors and 11 failures:

  • Errors:
    • FileVersioningHandlerGoldenTest: Cannot declare class OCA\Files_Versions\Versions\IVersionManager, because the name is already in use. An earlier test in the same process has already declared it.
    • JobRunMapperNarrowGoldenTest.
  • Failures:
    • TextExtractionJobsGoldenTest
    • EndpointsControllerAnswersGoldenTest
    • SchemaConfigValidatorsGoldenTest
    • ProcessingLogServiceGoldenTest
    • A18InterfaceBindingsTest for Settings\ObjectRetentionHandler

Why it is not this PR's:

  • None of these tests covers a class this PR changes.
  • The same workflow has failed on every recent cloud/* branch, Vue-only ones included. It also failed on refactor(magic-search): keep buildObjectFilterConditionsSql below its base size #7520, a one-line change, with the same IVersionManager and text-extraction failures.
  • On origin/development, FileVersioningHandlerGoldenTest and the text-extraction tests pass when run alone, so the cause is test-order pollution in the full suite.
  • The PHPUnit set this PR's own changes reach passes on the branch merged with development: Architecture, Contract, Kernel, Controller, BackgroundJob, Listener and Service/Object. That is 17155 tests, all OK.

No fix exists yet. I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

quality / Frontend Tests (unit) is red, and the failure is not this PR's.

  • What fails: one suite, src/views/migrationPack/migrationPackTables.dom.golden.spec.js. Jest cannot parse it ("Jest encountered an unexpected token"), so its tests never run. The other 239 suites pass: 4965 tests, 0 failures.
  • Why it is not this PR's: this PR changes only PHP under lib/ and tests/Unit. It touches no file under src/ and no Jest config. The failing spec arrived with the branch's merge of development, which brought in the recent migration-pack commits 857b949e9, 0cbfd25b4 and 1c6b8f484.
  • Fix: none exists yet. I could not re-run the job from this session.

Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

quality / PHP Quality (phpstan) is red, and the cause is not in this PR.

PHPStan reports 24 errors, all in 12 files that this PR does not touch:

  • BackgroundJob/FileTextExtractionJob
  • Controller/EndpointsController
  • Controller/Support/RegisterStatistics
  • Controller/TaskNotesController
  • Controller/WebhooksController
  • Db/Tenancy/TenancyIdentityTrait
  • Notifications/Controller/NotesController
  • Search/Service/GraphQL/GraphQLService
  • Service/Flow/FlowService
  • Service/Import/ImportPreviewService
  • Service/Integration/BuiltinProviders/NotesProvider
  • Service/Task/TaskSequenceService

The errors are calls to methods that the interfaces do not declare, plus dead catch blocks. Examples:

  • NoteServiceInterface::requireNoteOf()
  • ImportPreviewRowMapperInterface::persist()
  • TaskSequenceMapperInterface::update()
  • TextExtractionServiceInterface::extractFile()

They point to other lanes' interface swaps that are already merged into development. None of them names an interface or class this PR adds or changes.

PHPStan on this PR's own touched files (lib/ diff plus the new interfaces) reports no errors locally.

No fix exists yet. I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Four more checks are red. None of the findings is in a file this PR changes.

  • PHP Quality (psalm): findings in 35 lib/ files. Examples: AppHost/ObservabilityWiring, Controller/CredentialController, Db/AuditTrail, Db/EndpointMapper, Db/FindLinksByObjectUuidTrait. I intersected that list with this PR's lib/ diff and the overlap is empty.
  • Vue Quality (eslint): reports src/components/PaginationComponent.vue, a file this PR does not touch.
  • Frontend Check (format): reports src/ files this PR does not touch, for example RegisterSchemaCard.vue, ExtractionTab.vue and PackPreviewPanel.vue.
  • Frontend Check (test:l10n:parity): de, fr and other locales are each missing the frontend key "We could not count the objects. Close this window and try again.".

This PR changes only PHP under lib/ and tests/, plus one test fixture JSON. It has no src/ or l10n/ changes. All four failures come in with the merge of current development.

No fix exists in this PR's scope. I could not re-run the jobs from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

quality / PHP Quality (phpcs) is red. Its errors are all in 8 files that this PR does not touch:

  • lib/Db/CaseItem.php
  • lib/Db/EntityRelation.php
  • lib/Db/ImportPreviewRow.php
  • lib/Db/MagicMapper/MagicObjectSearchInterface.php
  • lib/Db/RuleRun.php
  • lib/Service/ContractBindings.php
  • lib/Service/Flow/FlowTokenRouter.php
  • lib/Service/Object/SaveObject/RelationCascadeHandler.php

I intersected this list with the PR's diff and nothing overlaps. Locally, phpcs reports no errors on this PR's touched files. The only warnings are two missing class-level @spec tags, and both are already on development.

As with the other quality checks above, these errors arrive with the merge of current development. No fix exists in this PR's scope, and I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

quality / Hydra Gates is red: 7 gates failed. No finding names a file this PR touches.

I ran vendor/bin/hydra-gates (full scope) locally on this PR's head and grepped every gate log for the touched files and the classes it adds. There are no matches. The CI counts are a little higher than mine because CI ran on a newer development merge.

Gate What it flags
gate-3 stub-scan Service/Integration/Providers/TalkRoomScope.php
gate-17 redundant-controller Service/VocabularyObjectStore.php::save
gate-46 spec-anchor-existence src/store/modules/auditTrail.js and tests/Unit/Service/Flow/ObjectWriteAccessGoldenTest.php
gate-7 no-admin-idor Repo-wide controller findings. None of them is CorrectionsController::correct, whose session check stays first.
gate-49 controller-exception-translation Repo-wide controller findings. None of them is CorrectionsController::correct.
gate-12 nc-input-labels Vue templates only; this PR has no src/ changes.
gate-40 form-label-association Vue templates only; this PR has no src/ changes.

These failures arrive with the merge of current development. No fix exists in this PR's scope, and I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

quality / PHP Quality (phpmd) is red. Its findings are in 354 lib/ files, and none of them is a file this PR changes.

  • I intersected the reported files with this PR's diff, and the overlap is empty.
  • Locally, phpmd (phpmd.xml) on this PR's touched files reports nothing.
  • The PR also removes one @SuppressWarnings(PHPMD.StaticAccess), from DraftExpiryJob::run. The static call it covered is gone.

Like the other quality checks above, this failure arrives with the merge of current development. No fix exists in this PR's scope, and I could not re-run the job from this session.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit 1e58e08 into main Nov 9, 2026
36 of 49 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 79f07ba

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 ✅
test-coverage-ratchet ✅
composer ✅ ✅ 168/168
npm ✅ ✅ 641/641
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ cancelled — no verdict
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-09 19:03 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.

2 participants