Skip to content

[access] test(rbac): cover reach revocation, deny matching, run locks, party links and token grant edges - #7578

Merged
rubenvdlinde merged 11 commits into
mainfrom
cloud/t03-rbac-reach
Nov 9, 2026
Merged

rubenvdlinde merged 11 commits into
mainfrom
cloud/t03-rbac-reach

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Covers ten access, lock, party and tenancy classes from lane T03 (round t1, SIG test coverage). Each new test file fills in the branches the existing tests leave out: failures, fallbacks and refusals.

What is covered (new test files only, before = CI clover on development 30fbb6d)

  • lib/Service/Rbac/ReachRevocationService.php (92/123) → ReachRevocationServiceFailureTest: covers every source failing (schemas, derived, delegations) with failed filled per source and attribution to system with no session; a schema update failing per schema, with empty and untouched schemas left unwritten; a forget failure and a delegation update failure recorded next to a successful revoke.
  • lib/Service/Rbac/PrincipalReachService.php (95/119) → PrincipalReachServiceDegradedSourcesTest: covers every source failing (an empty, zeroed listing, each failure logged); a schema with no actions is skipped; a provenance failure keeps the grant with grantedBy: null; derived grants are listed; no account means no group lookup.
  • lib/Service/TenantLogRedactor.php (66/75) → TenantLogRedactorFailSafeTest: covers no app config, a counter that cannot be read or written (the line is still dropped), the counter incrementing, and redact() returning the failure marker instead of the raw payload.
  • lib/Service/Rbac/AggregateVisibility.php (38/46) → AggregateVisibilityRevealTest: covers mayReadOnSomeRow (an ungoverned property, the rule's answer, a missing or throwing rule failing closed), isMaskedExplicit (masked unless trusted, other properties, no schema, no reveal service), and partitioning of explicit-reveal values.
  • lib/Service/Rbac/DenyEntryMatcher.php (32/38) → DenyEntryMatcherTest: covers string and array entries, the mcp scope, user prefixing, empty users, and conditional reporting (an empty or non-array match is unconditional).
  • lib/Service/Party/PartyLinkWriter.php (49/57) → PartyLinkWriterFieldsTest: covers display-name preference (declared property, then entity name, then uuid) and e-mail preference (correspondence first, then the general list, otherwise none).
  • lib/Service/Object/RunLockRegistry.php (80/87) → RunLockRegistryFailureTest: covers a blank run that is not recorded, the recorded row's fields, a record or forget failure that is swallowed, a blank-run release, a sweep that skips blank rows but still forgets them, and an unreadable object that is not released.
  • lib/Service/Vocabulary/ConceptDeleteGuard.php (58/63) → ConceptDeleteGuardRefusalTest: covers a concept with no identity, schemas that cannot be listed, holder sampling capped at 10 while the total stays complete, and both refusal texts with their fallbacks.
  • lib/Service/Rbac/TokenGrantValidator.php (41/45) → TokenGrantValidatorRefusalTest: covers an unreadable end date, a non-list axis, rate-limit bounds, and the edges of the lapse warning (no end date, already lapsed, today, a negative window). The clock is fixed.
  • lib/Service/Rbac/ObjectAccessHistory.php (50/54) → ObjectAccessHistoryEdgeTest: covers malformed change payloads, undecodable blocks, a blank or unreadable moment, and an undated change passed over, with that change named as the later change. Every timestamp carries an explicit UTC offset.

What ran

  • Each new file on its own: 41 tests, 0 failures.
  • vendor/bin/phpunit -c phpunit.xml tests/Unit/Service/Rbac tests/Unit/Service/Object tests/Unit/Service/Party tests/Unit/Service/Vocabulary: 5308 tests, 0 failures, 1 pre-existing skip.
  • Merged with current origin/development before opening.
  • weak.php flags none of these tests.

After: coverage was not measured. No coverage driver could be installed in this sandbox: there is no pcov or xdebug package, and building one from source was not permitted. CI's coverage job will report the new numbers.

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

  • mutation: lib/Service/Rbac/ReachRevocationService.php:181 unchanged-block skip dropped (writes schemas that never named the principal) -> 1 tests failed
  • mutation: lib/Service/Rbac/PrincipalReachService.php:195 empty-actions skip dropped -> 1 tests failed
  • mutation: lib/Service/TenantLogRedactor.php:189 redact() returns the raw context on failure -> 1 tests failed
  • mutation: lib/Service/Rbac/AggregateVisibility.php:182 isMaskedExplicit() always answers false -> 3 tests failed
  • mutation: lib/Service/Rbac/DenyEntryMatcher.php:170 empty match no longer excluded from conditional -> 1 tests failed
  • mutation: lib/Service/Party/PartyLinkWriter.php:237 correspondence addresses always replaced by the general list -> 1 tests failed
  • mutation: lib/Service/Object/RunLockRegistry.php:242 blank run/object guard dropped -> 1 tests failed
  • mutation: lib/Service/Vocabulary/ConceptDeleteGuard.php:137 holder sample cap removed -> 1 tests failed
  • mutation: lib/Service/Rbac/TokenGrantValidator.php:191 rate-limit floor 1 -> 0 -> 1 tests failed
  • mutation: lib/Service/Rbac/ObjectAccessHistory.php:147 'changed afterwards' picks the as-of change itself instead of the later one -> 1 tests failed

One sample at ObjectAccessHistory.php:114 (dropping the $change['at'] === null check) did not fail. It is equivalent: strtotime('') already returns false and takes the same branch. It was replaced by the sample at line 147.

Left

  • lib/Service/OrganisationUsageService.php's apcuAvailable() and apcuFetchInt() call APCu directly, and this sandbox has no APCu extension, so they are (c). That file is not part of this PR.

Tests written with Claude Code.


Generated by Claude Code

claude added 11 commits November 9, 2026 05:42
Assisted-by: ClaudeCode:claude-opus-5-5
…) fallback

Assisted-by: ClaudeCode:claude-opus-5-5
…eal masking

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

Assisted-by: ClaudeCode:claude-opus-5-5
…fier guards

Assisted-by: ClaudeCode:claude-opus-5-5
…ng and refusal texts

Assisted-by: ClaudeCode:claude-opus-5-5
… and lapse edges

Assisted-by: ClaudeCode:claude-opus-5-5
…oments and undated entries

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

Copy link
Copy Markdown
Contributor Author

CI note: Newman API Test Suite is red on dadff4a (job). The failure does not come from this PR.

These tests fail, the same set as on #7517 and #7546:

  • JobRunMapperNarrowGoldenTest
  • FileVersioningHandlerGoldenTest
  • A18InterfaceBindingsTest
  • TextExtractionJobsGoldenTest
  • EndpointsControllerAnswersGoldenTest
  • SchemaConfigValidatorsGoldenTest
  • ProcessingLogServiceGoldenTest
  • SearchReferenceResolverGoldenTest

This PR adds or changes none of them, and none of its ten new test files shows up in the failures. This PR contains no fix for them. 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) fails on dadff4a (job), but the failure is in existing frontend files under src/ (for example PaginationComponent.vue, RbacTable.vue, WebhooksSidebar.vue). This PR only adds PHPUnit test files and changes nothing under src/.

The same development base gives the same failures in the rest of the quality matrix: Frontend Tests (unit), format, test:l10n, test:l10n:parity, phpcs, psalm, phpmd, phpstan and Hydra Gates. On #7517 and #7546 each of these traces to existing files under lib/, src/ and l10n/, and none of them names a test file added in those PRs. This comment covers them for this PR too. I will comment again only if a check names one of this PR's ten new test files.

No fix is ported here, because those files are outside this test-only lane. I could not re-run jobs from this session.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit 75f223f into main Nov 9, 2026
37 of 49 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 6bbe83a

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 ❌ 49082/49092 · 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 17:32 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