Skip to content

[access] test(command): cover reconcile/purge/backfill command gaps, three maintenance jobs and the class alias map - #7556

Merged
rubenvdlinde merged 1 commit into
mainfrom
cloud/t04-commands-jobs
Nov 9, 2026
Merged

rubenvdlinde merged 1 commit into
mainfrom
cloud/t04-commands-jobs

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

SIG coverage round t1, lane T04: PHP unit tests for maintenance commands and jobs. The [access] prefix is there because the purge command deletes objects and the group reconciler handles RBAC groups.

Covered

This PR only adds new test files; it changes no production code and adds no coverage metadata.

File Before (CI clover, development 30fbb6d) After (subset run)
lib/Command/ReconcileMagicTablesCommand.php 61/84 84/84
lib/Command/PurgeObjectCommand.php 93/101 101/101 (with existing tests)
lib/Command/BackfillObjectSlugsCommand.php 76/78 78/78 (with existing tests)
lib/BackgroundJob/ConsistencyCheckJob.php 0/11 11/11
lib/BackgroundJob/GroupReconcilerJob.php 0/8 8/8
lib/Command/Support/ApprovalRollbackRun.php 0/6 6/6
lib/BackgroundJob/CacheClearAndWarmJob.php 0/3 3/3
lib/AppInfo/ClassAliasMap.php 37/39 39/39
Total 267/330 330/330

Notes:

  • ConsistencyCheckJob stamps ranAt with new DateTime(), which is not injectable. The test therefore checks only the ATOM format of that value, never the value itself. Pinning the exact value would need a production seam: using the injected ITimeFactory would provide one.
  • ClassAliasMap keeps a process-wide static "autoloader registered" flag, so its coverage depends on which tests ran before it. The new tests run in separate processes, which makes their count stable whatever the order.

Ran

  • php -d pcov.enabled=1 -d pcov.directory=lib vendor/bin/phpunit -c phpunit.xml --coverage-clover /tmp/cj.xml --filter '<new + existing tests for these classes>' tests/Unit/Command tests/Unit/BackgroundJob tests/Unit/AppInfo: OK (50 tests, 146 assertions). This is a subset run, so its coverage is a lower bound.
  • weak.php reports none of the new files.

Mutation samples (each reverted)

  • mutation: lib/Command/ReconcileMagicTablesCommand.php:146 !== (int)$registerFilter -> === -> 1 test failed
  • mutation: lib/Command/Support/ApprovalRollbackRun.php:82 written++ -> written-- -> 2 tests failed
  • mutation: lib/Command/PurgeObjectCommand.php:295 schemaMapper->find replaced with a throw -> 1 test failed
  • mutation: lib/Command/BackfillObjectSlugsCommand.php:212 dropped the "The slug backfill failed: " prefix -> 1 test failed
  • mutation: lib/BackgroundJob/ConsistencyCheckJob.php:92 fallback '{}' -> 'null' -> 1 test failed
  • mutation: lib/BackgroundJob/GroupReconcilerJob.php:77 dropped the reconcile() call -> 2 tests failed
  • mutation: lib/BackgroundJob/CacheClearAndWarmJob.php:70 dropped warmupNameCache() -> 1 test failed
  • mutation: lib/AppInfo/ClassAliasMap.php:150 removed the self::$lazy !== [] condition -> 1 test failed

The tests were written with Claude Code.


Generated by Claude Code

…e maintenance jobs and the class alias map

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

Copy link
Copy Markdown
Contributor Author

The red Newman API Test Suite check on this PR has 12 failures. The baseline that all PRs share has 11. The extra failure is this PR's own test, ClassAliasMapBehaviourTest::testOnlyEagerEntriesRegisterNoAutoloader (Failed asserting that 1 is identical to 0).

The test assumes no ClassAliasMap autoloader is registered yet. The in-container suite runs inside a booted Nextcloud, where the openregister app has already registered that autoloader.

The fix is in #7640. That PR contains this PR's commit plus a one-line test change: the test now checks that an eager-only map adds no registration, instead of expecting a count of zero. The lane rules don't allow pushing to an open PR, so please merge #7640 instead of this one. The other 11 failures are the shared baseline described on #7519.


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

This PR adds only PHP test files. None of the red quality / … checks come from it; they are failing on development as well:

  • test:l10n and test:l10n:parity: keys are missing in the locales, and keys used in src/ are missing from en.js.
  • eslint: the errors are in files from development.
  • format: it checks frontend files, and this PR changes none.
  • Frontend Tests (unit): this PR changes no JS, Vue or jest config.
  • phpstan, psalm, phpcs and phpmd: they analyse only lib/.
  • Hydra Gates: it inspects lib/, src/ and appinfo/.

The evidence is in #7519 and #7523.

This PR's one real defect is the ClassAliasMapBehaviourTest failure under the in-container PHPUnit suite. It is fixed in #7640, so please merge #7640 instead of this PR.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit 949d72b into main Nov 9, 2026
36 of 49 checks passed
rubenvdlinde added a commit that referenced this pull request Nov 9, 2026
…oted

[access] test(appinfo): let the class alias map test run inside a booted app (supersedes #7556)
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ ca7e1d7

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 ❌ 49058/49069 · 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 16:36 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