Skip to content

[access] test(tenancy): cover tenant usage, the slug conflict and the reveal audit middleware - #7570

Merged
rubenvdlinde merged 2 commits into
mainfrom
cloud/t02-tenancy
Nov 9, 2026
Merged

rubenvdlinde merged 2 commits into
mainfrom
cloud/t02-tenancy

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What this covers

PHPUnit tests for three tenancy/audit classes in lane T02's scope:

File Before (CI clover, development 30fbb6d) After (subset run)
lib/Middleware/RevealAuditMiddleware.php 0/11 11/11 (100%)
lib/Db/TenantUsage.php 0/26 26/26 (100%)
lib/Exception/OrganisationSlugConflictException.php 0/2 2/2 (100%)
  • RevealAuditMiddlewareTest: reveals are flushed after a controller returns and after it throws; the same response / the same exception goes out; a failing flush is logged and never replaces either.
  • TenantUsageSerialisationTest: every field serialised (dates as ISO 8601 in a fixed UTC zone, no clock dependency), a fresh row's zero/null shape, and type hydration from a database row.
  • OrganisationSlugConflictExceptionTest: 409, message, slug and cause.

What ran

php -d pcov.enabled=1 -d pcov.directory=lib vendor/bin/phpunit -c phpunit.xml --no-progress --coverage-clover /tmp/t02h.xml <the 3 new test files> → OK (8 tests, 20 assertions), then clover_files.py on the T02 file list (subset run: a lower bound of the full-suite number). Weak-test scanner reports none of the new tests. php-cs-fixer applied.

Mutation samples (each reverted, never committed)

  • mutation: lib/Middleware/RevealAuditMiddleware.php:111 dropped the flush in afterException -> 2 tests failed
  • mutation: lib/Db/TenantUsage.php:126 period format('c') -> format('Y-m-d') -> 1 test failed
  • mutation: lib/Exception/OrganisationSlugConflictException.php:42 code: 409 -> code: 400 -> 1 test failed

No production code changed. Tests written with Claude Code.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Newman API Test Suite (api-test-coverage) is red, but not because of this PR.

The failures are 11 errors and 11 failures across seven test classes that this PR does not touch:

  • A18InterfaceBindingsTest
  • TextExtractionJobsGoldenTest
  • EndpointsControllerAnswersGoldenTest
  • JobRunMapperNarrowGoldenTest
  • SchemaConfigValidatorsGoldenTest
  • FileVersioningHandlerGoldenTest (Cannot declare class OCA\Files_Versions\Versions\IVersionManager)
  • ProcessingLogServiceGoldenTest

This PR only adds test files (tenancy). The same seven classes fail in this workflow on every other open cloud/* PR I checked, for example cloud/k41-view-styles. The latest completed run of this workflow on all 25 most recent branches has concluded failure.

On development (732e0ed), those classes pass when run on their own (67 tests). That points at the full-suite run in this job, not at any one change. No fix exists yet. Fixing it means touching those tests, which belong to other lanes, so I am not widening this PR. I have not re-run the job: the failure is the same on every branch, so a re-run would not tell us anything new.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde changed the base branch from development to main November 9, 2026 06:54

Copy link
Copy Markdown
Contributor Author

The quality checks that are failing or will fail here are inherited from development. This PR adds only PHPUnit test files.

Frontend Check (test:l10n:parity) failed here. This PR changes no file under l10n/ or src/.

I have traced the other quality checks on #7555, which has the same kind of diff (new PHPUnit test files only, under tests/Unit/). They fail there on existing code this PR does not touch:

  • test:l10n: 14 keys missing from en.js. CLAUDE.md already records this as red at development.
  • test:l10n:parity: locale bundles.
  • eslint: 769 problems in existing JS.
  • phpcs, phpstan and psalm: findings in existing lib/ files, including stale psalm baseline entries.
  • Frontend Tests (unit): src/components/shared/refreshButton.spec.js.
  • Hydra Gates (forced full-repo run): controller and Vue gates.

When these checks fail here the same way, I will not add a comment per check. The details and log excerpts are in the comments on #7555. The lane rules forbid me from changing production, frontend or locale code in a test-only PR. No fix exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

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

phpmd's findings are all in existing production files under lib/. The files with the most findings are lib/Service/OperatorEvaluator.php, lib/Service/Archival/ArchivalNominationService.php, lib/Service/Archival/ArchivalDecisionResolver.php, lib/Db/MagicMapper/MagicCrossTableReaderInterface.php and lib/Mcp/AttributeToolScanner.php. No finding points at a file under tests/, and none of the test files this PR adds appears in the log. The earlier note on this PR did not list phpmd. It has the same cause and the same remedy as the checks listed there. No fix exists yet.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit 53261dc 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 @ b96db0e

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 17: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