Skip to content

[access] test(rbac): cover grant fit, reveal masking, lock, audit and read-access classes - #7546

Merged
rubenvdlinde merged 6 commits into
mainfrom
cloud/t03-rbac-zero
Nov 9, 2026
Merged

rubenvdlinde merged 6 commits into
mainfrom
cloud/t03-rbac-zero

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Covers nine access, audit and lock classes from lane T03 (round t1, SIG test coverage). Five of them had no coverage at all.

What is covered (new test files only)

  • lib/Service/Rbac/GrantRuleFit.php (was 0/42) → tests/Unit/Service/Rbac/GrantRuleFitTest.php. Covers: role entries and entries with no match are unconditional; a static clause the record satisfies vs. one it fails; values that read the caller ($userId, $organisation.x, $memberOf, nested operands) are relative and never evaluated; lookalike strings stay static; principal typing (user: prefix, user entry alone or in a holder list, pseudo principals, groups).
  • lib/Service/Rbac/ExplicitRevealChangeMask.php (was 0/13) → ExplicitRevealChangeMaskTest.php. Covers: plain scalar, array, null, both diff sides, a null side.
  • lib/Service/Rbac/ObjectAuthorizationWriter.php (was 0/12) → ObjectAuthorizationWriterTest.php. Checks it is a single-column UPDATE of _authorization on the row with this _uuid in the right table, and that a block with no scope logs a null scope.
  • lib/Service/Sharing/AccessLinkActs.php (was 0/17) → tests/Unit/Service/Sharing/AccessLinkActsTest.php. A comment is written as the link with public visibility; an upload is stored with share: false.
  • lib/Service/Object/AuditHandler.php (was 0/45) → AuditHandlerTest.php. Covers: defaults; only known, non-empty filters pass through, and a caller-supplied object_uuid cannot replace the binding; empty values are dropped; a mapper failure is logged and rethrown.
  • lib/Service/Object/LockAuthorization.php (was 23/51) → LockAuthorizationBehaviourTest.php. Covers: the update-permission check on lock; no session; break is admin-only; the holder, admin and owner may release; a run lock is never released by an owner; manage-rule groups as an id or {group}; every missing-rule path refuses (no or empty schema id, unreadable schema, no authorization, no manage, groups backend failure).
  • lib/Service/Rbac/StoredRuleBlocks.php (was 15/39) → StoredRuleBlocksTest.php. Covers: the stored schema and register rows (table, id and type bound), undecodable columns, a missing row, no id / no connection, and property block pairing with the stored copy.
  • lib/Service/Task/Authorization/FailClosedGroups.php (was 7/22) → tests/Unit/Service/Task/Authorization/FailClosedGroupsTest.php. Covers: a working backend, an empty group id, a throwing backend failing closed, no backend.
  • lib/Service/Object/ObjectReadAccess.php (was 18/32) → ObjectReadAccessBehaviourTest.php. Covers: an ambiguous identifier is surfaced by readableOrAmbiguous and swallowed by readable; a missing object; schemaOf, registerIdOf and the notReadable 404.

What ran
Each file with vendor/bin/phpunit -c phpunit.xml <file>: 51 tests, 0 failures. Merged with current origin/development before opening. weak.php reports none of these tests.

Numbers
Before: the CI clover on development 30fbb6d, per file above.
After: coverage not measured. No coverage driver could be installed in this sandbox: there is no pcov/xdebug package, and building one from source was not permitted. CI's coverage job will report the new number.

Mutation samples (each change applied by hand; the tests went red; reverted, never committed)

  • mutation: lib/Service/Rbac/GrantRuleFit.php:92 readsTheCaller() check bypassed (caller tokens treated as static) -> 2 tests failed
  • mutation: lib/Service/Rbac/ExplicitRevealChangeMask.php:49 only the old side of a diff masked -> 2 tests failed
  • mutation: lib/Service/Rbac/ObjectAuthorizationWriter.php:81 WHERE column _uuid changed to uuid -> 1 tests failed
  • mutation: lib/Service/Sharing/AccessLinkActs.php:115 upload stored with share: true -> 1 tests failed
  • mutation: lib/Service/Object/AuditHandler.php:155 default order DESC -> ASC -> 2 tests failed
  • mutation: lib/Service/Object/LockAuthorization.php:145 run-lock guard in mayReleaseUserLock dropped -> 1 tests failed
  • mutation: lib/Service/Rbac/StoredRuleBlocks.php:101 non-array stored block no longer nulled -> 1 tests failed
  • mutation: lib/Service/Task/Authorization/FailClosedGroups.php:72 failing isAdmin backend fails open (returns true) -> 1 tests failed
  • mutation: lib/Service/Object/ObjectReadAccess.php:123 ambiguous identifier swallowed (return null instead of rethrow) -> 1 tests failed

Left

  • lib/Service/Rbac/EffectiveAuthorization.php has no new test. EffectiveAuthorizationGoldenTest, which landed on development after the baseline, already pins every branch, so a new test would only duplicate it.
  • LockAuthorization::mayManageSchema(): the admin branch and the null-user branch cannot be reached. mayUnlock() has already returned for an admin or a missing session before it gets there. This is a finding (b), not a gap in the tests.

Tests written with Claude Code.


Generated by Claude Code

…rizationWriter and AccessLinkActs

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

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

Assisted-by: ClaudeCode:claude-opus-5-5
…k pairing

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

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

Copy link
Copy Markdown
Contributor Author

CI note: Newman API Test Suite is red on 00cf58d (job), and the failure is not this PR's.

The failing tests are the same set that fails on #7517: JobRunMapperNarrowGoldenTest, FileVersioningHandlerGoldenTest (an IVersionManager redeclaration from eval'd code), A18InterfaceBindingsTest, TextExtractionJobsGoldenTest, EndpointsControllerAnswersGoldenTest, SchemaConfigValidatorsGoldenTest, ProcessingLogServiceGoldenTest and SearchReferenceResolverGoldenTest. This PR adds and changes none of them. None of the nine test files it adds shows up in the failures.

No fix for this exists in this PR. I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

CI note: quality / Frontend Tests (unit) is failing on 00cf58d (job), but not because of this PR.

One jest suite fails to run: src/views/migrationPack/migrationPackTables.dom.golden.spec.js. The other 236 suites pass (4945 tests). This PR only adds PHPUnit test files and touches nothing under src/, so it cannot affect a jest suite. That suite belongs to frontend work outside this test-only lane, so no fix is ported here. I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

CI note: quality / Vue Quality (eslint) is failing on 00cf58d (job). The failure is not from this PR's changes.

ESLint reports problems in existing frontend files under src/, for example PaginationComponent.vue, RbacTable.vue, WebhooksSidebar.vue and cards/RegisterSchemaCard.vue. This PR changes nothing under src/; it only adds PHPUnit test files. Those frontend files are outside this test-only lane, so no fix is included here. I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

CI note: quality / Frontend Check (format) is failing on 00cf58d (job). The failures are not in this PR's files. Prettier flags existing frontend files under src/, the same set it flags on #7517, for example src/components/cards/RegisterSchemaCard.vue. This PR adds only PHPUnit test files and touches nothing under src/. I have not ported a fix into this PR, and I could not re-run the job from this session.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

CI note: quality / Frontend Check (test:l10n) is red on 00cf58d (job). The cause is outside this PR: 14 keys used in src/ are missing from l10n/en.js. That is the known red state on development, recorded in the repository's CLAUDE.md, and this PR touches neither src/ nor l10n/.

To avoid one comment per check: #7517 runs the same quality matrix from the same development base, and its comments already trace test:l10n:parity, format, phpcs, psalm, phpmd, phpstan and Hydra Gates to existing files under lib/, src/ and l10n/. This PR only adds PHPUnit test files under tests/Unit/Service/{Rbac,Object,Sharing,Task/Authorization}/, so the same holds here. I will comment again only if a check names one of those files.

I could not re-run jobs from this session.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit eee4814 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 @ 8213bb7

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 16:33 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