Skip to content

test(coverage): raise line coverage on formatters, config, assert and bench diagnostics - #309

Merged
roxblnfk merged 8 commits into
1.xfrom
tests
Aug 27, 2026
Merged

test(coverage): raise line coverage on formatters, config, assert and bench diagnostics#309
roxblnfk merged 8 commits into
1.xfrom
tests

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Aug 27, 2026

Copy link
Copy Markdown
Member

What was changed

Started as a coverage sweep and grew a few fixes the sweep uncovered.

Coverage: raised line coverage on branchy domain logic from 72.2% to 83.4%, worst-first, asserting real behaviour rather than colouring lines. Covered the value/failure formatters (Formatter, Helper, ValuePrinter, FailureMapper), ConfigInflector, the JSON TypeMatcher/AssertJson matchers, the Assert facade failure branches, the terminal/TeamCity loggers and formatters, the HTML DocumentBuilder, the bench Explanator/Renderer, the data-provider combinators, and the Status/Style value objects.

Fixes found along the way:

  • fix(bench): the variance bands in Explanator overlapped at frstdev == 10.0 exactly, emitting the contradictory HighVarianceLowIterTime and LowIterTime at once. Tightened the LowIterTime guard so the bands partition at 10.
  • fix(rector): Rector 2.6.4 swapped its DI container and dropped RectorConfig::tagged(), breaking every rule-fixture test at container build. Moved to findByContract() and bumped rector/rector to ^2.6.4. Reported upstream: tagged() removed from RectorConfig in patch 2.6.4 rectorphp/rector#9870
  • fix(rector): a rule that failed before any fixture ran (fixture resolution or container build) stored the error on the batch, which reporters only open and close, so it vanished into a bare "error" count. It is now surfaced as one errored data set, with a regression test.
  • refactor(codecov): small isset-guard to ??= cleanup in CoberturaReport.

See commit history for details.

Why?

A regression safety net for the parts of the framework that had the least of one. The sweep doubles as a bug hunt: assertions written against intended behaviour turn a wrong branch into a red test instead of a locked-in one, which is how the bench boundary and the two Rector issues surfaced.

Checklist

  • Tested
    • Unit tests added

…ert facade

Raise line coverage on branchy domain logic (project 72.2% -> 79.1%):
- Formatter, Helper, ValuePrinter, FailureMapper output renderers
- ConfigInflector attribute-driven hydration (every source + coercion)
- TypeMatcher JSON schema arms and parser guards
- Assert facade failure branches (same/notSame/true/false/null/contains/fail)
- Explanator bench diagnostics thresholds

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend renderer/logger suites to hit status arms, escaping, and
formatting branches:
- TerminalLogger 62.8% -> 98.6% (channel streaming, status symbols, diffs)
- TeamcityLogger 69.7% -> 98.5% (event arms, TeamCity value escaping)
- bench Renderer 70.8% -> 99.0% (rounds table, filtered/summary columns)
- BenchHandler toCaseSets + verdict boundary/INF cases

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…value objects

Round out coverage on assertion, output and data-plugin logic plus
core value objects (project 79.1% -> 83.4%):
- AssertJson matcher failure/path-parser branches -> 100%
- Teamcity Formatter message builders -> 97.8%
- HTML DocumentBuilder status/section branches -> 98.5%
- DataProviderInterceptor zip/cross/union + error guards -> 100%
- Status enum predicates and Style color helpers

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@roxblnfk
roxblnfk requested a review from a team as a code owner August 27, 2026 20:53
At frstdev == 10.0 exactly with low iter time, explain() emitted both
HighVarianceLowIterTime (>= 10.0, the 10-20 band) and the LowIterTime
all-clear notice (<= 10.0), a contradictory pair. Tighten LowIterTime's
guard to frstdev < 10.0 so the acceptable/high/very-high variance bands
partition at 10, and sync the DTO docblock to match.

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rector 2.6.4 swapped its DI container and dropped RectorConfig::tagged(),
which RectorRunner used to feed the freshly-registered rules to the
traverser, so every rector-fixture test errored at container build. Use
findByContract() (the replacement, returning a plain list) and require
rector/rector ^2.6.4 accordingly.

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...g/Internal/Middleware/RectorFixtureInterceptor.php 77.77% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

When fixture resolution or the Rector container build threw, the batch
stored the error on its own result. Reporters only open and close the
batch node (never re-report it), so the failure vanished into a bare
"error" count with no message, name, or trace. Emit it as one errored
data set instead, so every reporter renders it through the same path as
a failing fixture.

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ta set

Regression test for the swallowed-error fix: a rule whose fixtures path
escapes the project trips the containment guard before any fixture runs,
and the interceptor must report it as one errored data set (Failed batch
with a MultipleResult), not as a bare swallowed error.

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@roxblnfk
roxblnfk merged commit 8fc85ef into 1.x Aug 27, 2026
26 of 28 checks passed
@roxblnfk
roxblnfk deleted the tests branch August 27, 2026 22:03
roxblnfk added a commit that referenced this pull request Aug 27, 2026
fix(bench): partition the variance bands cleanly at frstdev == 10.0
fix(rector): resolve rule instances via findByContract, require rector/rector ^2.6.4 (Rector 2.6.4 dropped RectorConfig::tagged(); rectorphp/rector#9870)
fix(rector): surface a rule setup failure as an errored data set
refactor(codecov): null-coalescing assignment in CoberturaReport

Assisted-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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