Skip to content

[access] test(organisation): cover OrganisationMapper behaviour - #7549

Merged
rubenvdlinde merged 1 commit into
mainfrom
cloud/t01-organisation-mapper
Nov 9, 2026
Merged

rubenvdlinde merged 1 commit into
mainfrom
cloud/t01-organisation-mapper

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

What

New behaviour test tests/Unit/Db/OrganisationMapperBehaviourTest.php (no production code touched) for lib/Db/OrganisationMapper.php, the tenancy root mapper:

  • writes: insert uuid/timestamps + created event, update loads the previous state + updated event, delete event
  • save(): generated uuid, malformed uuid refused, uuid held by another organisation refused (exclusion of own id), slug taken before insert, insert race on the slug surfaces as OrganisationSlugConflictException with the cause, other insert failures logged and rethrown, update path
  • membership add/remove, all finders (uuid, slug, multiple incl. empty list, user incl. the PostgreSQL CAST branch, local tenants, paging, name), statistics
  • hierarchy guards: null parent, own parent, missing parent, descendant as parent (cycle), leaf, unloadable child, exactly 10 levels allowed and 11 refused; recursive chains incl. table prefix and failure fallback
  • active-organisation preference: cached read, no row, failing read logged, fallback to configured default (stored and cached), no default, storing the default fails but still returns it, update vs insert of the preference
  • config: entity RBAC enforcement only on enabled, default organisation key vs JSON blob vs absent
  • merge chains: followed to the end, missing/self reference, cycle warns, hop limit warns, findByUuidFollowingMerge

Existing golden tests for this mapper declare a narrow @covers; under beStrictAboutCoverageMetadata they are risky and their coverage is discarded, which is why CI showed 0/430. The new test carries no @covers.

Measured (subset run, lower bound of full suite)

php -d pcov.enabled=1 -d pcov.directory=lib vendor/bin/phpunit -c phpunit.xml --coverage-clover /tmp/t01-sub.xml tests/Unit/Db/OrganisationMapperBehaviourTest.php + clover_files.py

File before (CI) after
lib/Db/OrganisationMapper.php 0/430 430/430

51 tests, 121 assertions, green. phpcs clean. weak.php reports none of the new tests.

Mutation samples (each reverted, never committed)

  • mutation: lib/Db/OrganisationMapper.php:937 depth limit > 10 changed to > 11 -> 1 test failed
  • mutation: lib/Db/OrganisationMapper.php:895 dropped the own-parent guard -> 1 test failed
  • mutation: lib/Db/OrganisationMapper.php:1247 RBAC enforcement === 'enabled' changed to !== 'disabled' -> 1 test failed
  • mutation: lib/Db/OrganisationMapper.php:1327 dropped the merge-cycle check -> 1 test failed

Tests written with Claude Code.


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor Author

The Newman API Test Suite check (api-test-coverage) is red, but the cause is not in this PR.

The job runs the full PHPUnit suite. It ends with 11 errors and 11 failures, all in test files this PR does not touch:

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

OrganisationMapperBehaviourTest passes.

The same 22 tests fail on development (including a1fd993, the commit this branch was cut from) and on #7526. This PR only adds a test file, so there is no fix to port into it, and none exists yet. I did not re-run the check, because the base branch fails the same way.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Two l10n checks are red on this PR, but the cause is on development, not in this change. The PR adds a single PHP test file and touches no file under l10n/ or src/.

  • Frontend Check (test:l10n:parity): l10n/de.js is missing one key that exists in en.js: "We could not count the objects. Close this window and try again." I checked, and it is missing from de.js on development as well.
  • Frontend Check (test:l10n): some source strings used in src/ are not in l10n/en.js. This gate is already listed as red on development in the repo's CLAUDE.md, under "Known state".

Both fixes belong in the repo's own l10n commits, made through l10n:apply with one locale per commit, so they can't be made here. #7526 shows the same failures and the same remaining quality checks; there are details there.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Frontend Check (format) is red, but not because of this PR. Prettier flags 114 existing files, and every one is under src/. This PR changes no .js, .ts, .vue, .css or .scss file; it only adds a PHP test. The same failure shows on development and on #7526.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

Vue Quality (eslint) fails here with the same errors already explained on #7526. They are unused imports, triple-dot translated strings and import ordering, all in existing files under src/. This PR changes no front-end file, so it neither causes nor can fix them.

The other quality checks this PR shares with #7526 come from development in the same way: phpcs, phpstan, psalm (all three in lib/) and Hydra Gates (whole-repo scan). The details are in the comments on #7526.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

PHP Quality (phpmd) fails, but not because of this PR. Every violation it reports (615 entries) points at existing production code under lib/, for example lib/AppHost/AppHostRegistrar.php, lib/AppHost/ObservabilityWiring.php and lib/BackgroundJob/ConfigurationCheckJob.php. None points at tests/. This PR only adds a PHPUnit test file, so these findings come from development and can't be fixed here.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit faa2fa1 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 @ c5e8c3d

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