Skip to content

[access] refactor(object): SaveObject private save steps take fewer parameters - #7637

Merged
rubenvdlinde merged 3 commits into
mainfrom
cloud/k17-saveobject-methods
Nov 9, 2026
Merged

rubenvdlinde merged 3 commits into
mainfrom
cloud/k17-saveobject-methods

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Lane K17 (round 10c), SIG unit interfacing: the private save steps of SaveObject.

What changed

  • prepareObjectForCreation (8 → 4 params): takes ObjectPayload (data + @self) and the save's ObjectSaveFlags (acting user, unowned, explicit owner). The _multitenancy parameter was never read in the body, so it is dropped.
  • prepareObjectForUpdate (5 → 4): takes ObjectPayload. Both of its callers (the save path and updateObject's persist step) build the payload.
  • recordSharedMasterDataRefusal (5 → 3) and refuseSharedMasterDataWrite take ObjectWriteTarget (register id, schema id, uuid). The target is built in the non-strict SaveObject file, so the int coercion of the ids is the same as before.
  • delegateObjectSourceWrite (6 → 2): takes the save call and the object-source annotation.
  • findAndValidateExistingObject (5 → 3): its one caller always passed _rbac: false, _multitenancy: false. The lookup now passes false to the mapper itself, with the reason kept beside it, so the values reaching the mapper are unchanged.
  • New value objects in lib/Service/Object/SaveObject/: ObjectPayload (used by create and update preparation) and ObjectWriteTarget (used by the guard and its recorder).

Access

  • First commit: SaveObjectAccessPathsGoldenTest, written and run against the old code. It pins the shared master data guard (the register/schema ids it asks, the audit row and log line of a refusal), the read-only object-source rejection after an allowed guard, and the existing-object lookup: no RBAC or multitenancy; a free object is returned; another row or no row means a create; locked, archived and frozen objects are refused. It passes unchanged after the refactor.
  • Mutation checks: asking the guard about the register instead of the schema fails the golden, and so does passing _rbac: true to the lookup.
  • The check order is unchanged: the guard still runs before anything is prepared or persisted.

Tests

  • Reflection-driven tests of these private methods now pass the new argument shapes (KeyOrderPreserve, OwnerClaimRefusal, WriteOnly, Unreadable and Unwritable preserve, Dispatch, SaveObjectTest).
  • Ran every tests/Unit file naming SaveObject: all OK (SaveObjectsTest keeps its 1 pre-existing skip).
  • Ran tests/Unit/Architecture, Contract, Kernel, Service/Rules, ControllerServicesWiringTest and ControllerSessionWiringTest, merged with development: 2680 OK.
  • phpcs and phpstan are clean on the touched lib files.

Numbers (lane_measure K17, this branch alone)

  • Over 4 parameters: 469 → 240 LOC
  • Over 6 parameters: 151 → 99 LOC

Not changed, and why

AI-assisted: written by Claude Code (Claude) for lane K17.


Generated by Claude Code

… them

Pins the shared master data guard (which register and schema it asks about,
the audit row and log line a refusal leaves), the read-only object-source
rejection that follows an allowed guard, and the existing-object lookup of a
save (no RBAC or multitenancy; free object returned; locked, archived and
frozen objects refused). Driven through private entry points whose
signatures do not change.

Assisted-by: ClaudeCode:claude-opus-5-5
- prepareObjectForCreation (8 -> 4): takes an ObjectPayload (data and @self)
  and the save's ObjectSaveFlags; the unused multitenancy flag is dropped.
- prepareObjectForUpdate (5 -> 4): takes an ObjectPayload.
- recordSharedMasterDataRefusal (5 -> 3) and refuseSharedMasterDataWrite
  take an ObjectWriteTarget (register id, schema id, uuid).
- delegateObjectSourceWrite (6 -> 2): takes the save call and the annotation.
- findAndValidateExistingObject (5 -> 3): its one caller always passed
  _rbac and _multitenancy false; the lookup now passes false itself, with
  the reason beside it.

The access golden committed before this change passes unchanged.

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

Copy link
Copy Markdown
Contributor Author

The red Newman API Test Suite check does not come from this PR.

The PHPUnit step inside the Nextcloud container fails with 11 errors and 11 failures. None of them are in files this diff touches. The failing tests are:

  • FileVersioningHandlerGoldenTest: "Cannot declare interface OCA\Files_Versions\Versions\IVersionManager", because the container ships that class.
  • JobRunMapperNarrowGoldenTest
  • EndpointsControllerAnswersGoldenTest
  • ProcessingLogServiceGoldenTest
  • TextExtractionJobsGoldenTest
  • SchemaConfigValidatorsGoldenTest
  • SearchReferenceResolverGoldenTest
  • A18InterfaceBindingsTest

The same set fails on unrelated open PRs #7541, #7543, #7538, #7540, #7575 and #7594. Outside the container these tests pass on plain development. There is no fix yet, and it does not belong in this PR.

The tests this PR changes pass in the same run. These include the new SaveObjectAccessPathsGoldenTest and every SaveObject test that drives the reshaped private methods.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit f21a039 into main Nov 9, 2026
32 of 42 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 89f558f

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 ❌ 49106/49116 · 19 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-09 23:49 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