Skip to content

[access] test(backgroundjob): cover eight zero-coverage background jobs - #7523

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

rubenvdlinde merged 1 commit into
mainfrom
cloud/t04-jobs

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

SIG coverage round t1, lane T04: PHP unit tests for background jobs.

Covered

This PR adds new test files only and changes no production code. The new tests carry no @covers or #[CoversClass]. phpunit.xml sets beStrictAboutCoverageMetadata=true, and that is why the existing ConnectionSeamReportJobTest and ImportPreviewRunnerGoldenTest record 0: they execute classes that are missing from their @uses lists, so PHPUnit marks them risky and discards their coverage.

File Before (CI clover, development 30fbb6d) After (subset run)
lib/BackgroundJob/ConnectionSeamReportJob.php 0/40 40/40
lib/BackgroundJob/TemporalCalculationSweepJob.php 0/34 34/34
lib/BackgroundJob/BulkLegalHoldJob.php 0/25 12/25 (see below)
lib/BackgroundJob/ImportPreviewRunner.php 0/24 24/24
lib/BackgroundJob/SweepExpiredExportRunsJob.php 0/19 19/19
lib/BackgroundJob/SubjectExportJob.php 0/15 15/15
lib/BackgroundJob/FlowScheduleWorker.php 0/13 13/13
lib/BackgroundJob/HandoffQueueDrainJob.php 0/13 13/13
Total 0/183 170/183 (92.9%)

BulkLegalHoldJob is left at 48% on purpose. Lines 79–95 look wrong. The job calls MagicMapperInterface::findAll(filters: [], schema: $schemaId, _rbac: false, _multitenancy: false), but MagicObjectFinderInterface::findAll has no _rbac or _multitenancy parameter, and its schema parameter takes a ?Schema entity, not an id. PHP therefore throws Error (unknown named parameter). catch (Exception) does not catch an Error, so no legal hold is ever placed. A test of that path would pin the bug, so this PR only covers the refusal path and the catch path. The bug needs its own fix.

Ran

  • php -d pcov.enabled=1 -d pcov.directory=lib vendor/bin/phpunit -c phpunit.xml --coverage-clover /tmp/jobs.xml --filter '<the 8 new test classes>' tests/Unit/BackgroundJob: OK (48 tests, 94 assertions), 0 risky. This was a subset run, so the coverage figures are a lower bound.
  • weak.php over tests/Unit/BackgroundJob reports none of the new files.

Mutation samples (each reverted)

  • mutation: lib/BackgroundJob/ConnectionSeamReportJob.php:140 $others === [] -> !== [] -> 5 tests failed
  • mutation: lib/BackgroundJob/TemporalCalculationSweepJob.php:111 $interval < MIN -> <= -> 1 test failed
  • mutation: lib/BackgroundJob/SweepExpiredExportRunsJob.php:117 $swept < SWEEP_BATCH -> <= -> 3 tests failed
  • mutation: lib/BackgroundJob/BulkLegalHoldJob.php:68 === null -> !== null -> 4 tests failed
  • mutation: lib/BackgroundJob/ImportPreviewRunner.php:147 === PHASE_COMMIT -> !== -> 6 tests failed
  • mutation: lib/BackgroundJob/SubjectExportJob.php:75 === '' -> !== '' -> 5 tests failed
  • mutation: lib/BackgroundJob/FlowScheduleWorker.php:75 !== [] -> === [] -> 2 tests failed
  • mutation: lib/BackgroundJob/HandoffQueueDrainJob.php:89 dropped || $summary['failed'] > 0 -> 1 test failed

The tests were written with Claude Code.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red Newman API Test Suite check does not come from this PR.

It fails at the step "PHPUnit unit suite (in-container, HARD GATE)". That step currently fails the same way on every PR, including JS-only ones such as #7510.

Run Tests Errors Failures Warnings
#7510 (JS-only baseline) 49064 11 11 1
this PR 49112 11 11 1

The 48 extra tests are exactly this PR's 48 new tests, and all of them pass. The failing tests are ProcessingLogServiceGoldenTest, SearchReferenceResolverGoldenTest and others, none of which this PR touches.

No fix exists yet, and it belongs in its own PR. #7519 has the details.


Generated by Claude Code

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

Copy link
Copy Markdown
Contributor Author

The red quality / … checks (test:l10n, test:l10n:parity, format, eslint, phpstan, psalm) are not caused by this PR. This one comment covers all of them, including any that are still running.

This PR only adds PHP test files under tests/Unit/BackgroundJob/.

  • test:l10n and test:l10n:parity: both are red on plain development. I reproduced parity at 70e5570: an untranslated key, "We could not count the objects…", is in en.js but missing from the other locales. The repo's CLAUDE.md already records test:l10n as red at HEAD.
  • format and eslint: these check frontend and JSON files. The eslint errors are in files from development, for example tests/Unit/Controller/fixtures/notification-history-controller-golden.json.
  • phpstan and psalm: both analyse only lib/, which this PR does not touch.

#7519 has the evidence for each check. Each needs its own fix on development, and none exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The quality / PHP Quality (phpcs) and quality / Hydra Gates checks fail for reasons outside this PR, which only adds files under tests/:

  • phpcs.xml checks only <file>lib</file>.
  • The failing Hydra gates (stub-scan, no-admin-idor, nc-input-labels, redundant-controller, form-label-association, spec-anchor-existence, controller-exception-translation) inspect lib/, src/ and appinfo/.

Both are standing debt on development; see #7519.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The quality / PHP Quality (phpmd) check isn't red because of this PR either. The repo's composer phpmd script runs phpmd lib … only, and this PR adds files under tests/ only. The failure comes from development; see #7519.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

If the quality / Frontend Tests (unit) check (the jest suite) is red, this PR is not the cause. The PR adds only PHPUnit files under tests/Unit/ and changes nothing in src/, no .js/.vue file and no jest config, so jest runs the same code as on development. The same failure shows on other PRs, for example #7554.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit 01bf82b 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 @ 5203260

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 ❌ 49083/49093 · 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 13:08 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