Skip to content

test(aggregation): remove the coverage metadata that was discarding coverage - #2899

Merged
rubenvdlinde merged 2 commits into
developmentfrom
fix/coverage-metadata-discards-coverage
Aug 27, 2026
Merged

test(aggregation): remove the coverage metadata that was discarding coverage#2899
rubenvdlinde merged 2 commits into
developmentfrom
fix/coverage-metadata-discards-coverage

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Closes #2847.

@covers was not focusing the measurement, it was deleting it

Under beStrictAboutCoverageMetadata="true", PHPUnit does not merely restrict
recording to the units a test names — it marks any test that executes anything
else risky and throws that test's coverage away entirely. The message says
so once you look for it:

This test executed code that is not listed as code to be covered or used:
- OCA\OpenRegister\Db\Register
- OCA\OpenRegister\Db\Schema
- OCA\OpenRegister\Service\Aggregation\AggregationQuery

Almost every test in this directory legitimately runs a collaborator —
AggregationQuery, PlaceholderResolver, the Db entities — so naming the class
under test discarded the whole file's measurement.

Measured

Locally with pcov, identical scope both runs (237 tests, 461 assertions):

with @covers without
AggregationRunner lines 44.39% (613/1381) 80.30% (1109/1381)
AggregationRunner methods 9.80% (5/51) 33.33% (17/51)
statements recorded in scope 1618 2137
Risky tests 33 0

Same tests, same assertions, same executed lines. Only the attribution differs.

⚠️ These are pcov numbers. coverage-guard.php's own docblock records that
CI measures with xdebug and the two do not count statements identically. Treat
the direction as the result and let CI's --against measurement be the
authority.

.coverage-baseline is deliberately untouched — the guard treats a
measurement above the floor as good news and exits 0, and this only moves it up.

Also

TimeseriesRequestValidatorTest carried @coversDefaultClass with not one
@covers ::method to pair with it: naming a default nothing used, while still
restricting recording.

The reasoning already existed — measured — in
AggregationJoinAndCompositeGroupByTest's docblock. The other ten files simply
never had it applied. Each now carries a short note pointing there, so the
annotation is not helpfully restored later by someone tidying up.

Verified

  • full suite 17336 tests, 0 failures (the 3 risky remaining are pre-existing
    TextExtractionServiceTest no-assertion tests, untouched here)
  • phpcs.xml scans lib only, so these files are not in its scope
  • tests-only change; no lib/ code touched

…overage

Closes #2847.

Under `beStrictAboutCoverageMetadata="true"`, PHPUnit does not merely
restrict recording to the units a test names — it marks any test that
executes anything else RISKY and throws that test's coverage away
entirely. The message is explicit once you look:

    This test executed code that is not listed as code to be covered or used:
    - OCA\OpenRegister\Db\Register
    - OCA\OpenRegister\Db\Schema
    - OCA\OpenRegister\Service\Aggregation\AggregationQuery

Almost every test in this directory legitimately runs a collaborator —
AggregationQuery, PlaceholderResolver, the Db entities — so naming the
class under test did not focus the measurement, it deleted it.

Measured locally with pcov, identical scope both runs (237 tests, 461
assertions):

                          with @Covers        without
  AggregationRunner       44.39% (613/1381)   80.30% (1109/1381)
  ...methods               9.80% (5/51)       33.33% (17/51)
  scope statements        1618                2137
  Risky tests               33                   0

Same tests, same assertions, same executed lines — only the attribution
differs.

⚠️ Those are pcov numbers. coverage-guard.php's own docblock records that
CI measures with xdebug and the two do not count statements identically,
so treat the DIRECTION as the result and let CI's `--against` measurement
be the authority. `.coverage-baseline` is untouched: the guard treats a
measurement above the floor as good news, and this only moves it up.

`TimeseriesRequestValidatorTest` had `@coversDefaultClass` with not one
`@covers ::method` to pair with it — naming a default nothing used, while
still restricting recording.

The reasoning already existed, measured, in
AggregationJoinAndCompositeGroupByTest's docblock; the other ten files
simply never had it applied. Each now carries a short note pointing there,
so the annotation is not helpfully restored later.

Full suite: 17336 tests, 0 failures.
CI failed all six PHPUnit cells with

    "@Covers ::method`" is invalid

My own explanatory comment was the cause. PHPUnit parses a CLASS docblock,
so the sentence describing what had been removed re-declared it — and the
method-scoped spelling is malformed, so it errored rather than being
tolerated. A comment about the bug became the bug.

Every docblock added by this branch now names the annotation without a
leading at-sign, and TimeseriesRequestValidatorTest says why so the next
person does not helpfully "fix" the prose.

(I wrote the replacement comment containing the same literal string once
more before catching it. It is a genuinely easy trap: the natural way to
document an annotation is to write it.)

The pre-existing mentions in AggregationJoinAndCompositeGroupByTest are
left alone — those parse harmlessly; only the method-scoped form is
malformed.

Full suite: 17498 tests, 0 failures, no invalid annotation.
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ dc413a3

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-specs
test-l10n
format
check-schema-l10n
check-l10n-js
composer ✅ 175/175
npm ✅ 545/545
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman
Playwright
Hydra gates

Quality workflow — 2026-08-27 06:16 UTC

Download the full PDF report from the workflow artifacts.

@rubenvdlinde
rubenvdlinde merged commit b8a6b91 into development Aug 27, 2026
84 checks passed
@rubenvdlinde
rubenvdlinde deleted the fix/coverage-metadata-discards-coverage branch August 27, 2026 07:04
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ ba54084

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-specs
test-l10n
format
check-schema-l10n
check-l10n-js
composer ✅ 175/175
npm ✅ 545/545
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman
Playwright
Hydra gates

Quality workflow — 2026-08-27 07:15 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.

1 participant