Skip to content

Make the coverage and mutation reports say what they count - #26

Merged
vlsi merged 10 commits into
cribro-dev:mainfrom
vlsi:cribro-release-batch
Nov 29, 2026
Merged

vlsi merged 10 commits into
cribro-dev:mainfrom
vlsi:cribro-release-batch

Conversation

@vlsi

@vlsi vlsi commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Breaking changes. Two defaults change, and code that relied on the old behavior gets a different result:

  • pitestDiff and cribro:pitest-diff run PIT with the STRONGER mutator group where cribro.pitestMutators is not set; 1.1.1 ran DEFAULTS. The report can list more mutants and survivors than before. -Pcribro.pitestMutators=DEFAULTS or -Dcribro.pitestMutators=DEFAULTS restores the old group.
  • A test JVM argument that holds a quote or a #, or that leaves a { open, is no longer passed to PIT; it is listed with the arguments left out. The java launcher reads the argument file PIT writes as unquoted lines (hcoles/pitest#1511), so such an argument arrived changed: -Dq="x" arrived as x, and -Dh=a#b did not arrive.

This branch fixes ten issues reported from cribro 1.1.x runs on apache/calcite#5419 and NullAway, one commit per issue. Each commit message carries the problem, the approach, and its User-visible: lines, and closes its issue.

On Gradle 8.14.4, test stayed on the bundled JaCoCo 0.8.13 instead of 0.8.16: JacocoPlugin.DEFAULT_JACOCO_VERSION is a compile-time constant, and javac copied the value of the Gradle that compiles cribro. CribroPlugin now reads the field reflectively (#23).

The other changes make the reports say what they count:

OlderGradleTest.aBuildThatNamesNoJacocoVersionGetsCribros runs a build on Gradle 9.6.1, whose bundled JaCoCo 0.8.14 differs from the 0.8.15 of the Gradle that compiles cribro; a test on the current Gradle alone would not catch #23. The counts of #19 can differ from JaCoCo's for a Kotlin class: JaCoCo keeps some synthetic code such as a $default method, and leaves out a private empty constructor that the line tables count.

Scope. #14 (naming the operand of a partly covered condition) and #17 (recording an equivalent mutant) are left out: both need a design decision first. Naming a Kotest test by its whole chain of nested tests is #27, and a Spock feature by its source name #28. release-drafter builds its notes from pull request titles and labels, so this pull request gives one line for ten changes; the release notes need editing by hand, or the branch can be split by area into four pull requests.

🤖 Generated with Claude Code

vlsi and others added 2 commits November 28, 2026 01:05
On Gradle 8.14.4, a build that names no JaCoCo version kept the agent
Gradle bundles, 0.8.13, instead of the 0.8.16 from cribro.properties.
JacocoPlugin.DEFAULT_JACOCO_VERSION is a compile-time constant, so javac
copied the 0.8.15 of the Gradle 9.8.2 that compiles cribro into
CribroPlugin, and on a Gradle whose bundled version differs the build's
tool version never matched it.

CribroPlugin now reads the field reflectively, so the comparison uses
the default of the running Gradle. No other constant the plugin reads
from Gradle holds a version or a default; the rest are task, source
set, and group names. Where Gradle has no readable
JacocoPlugin.DEFAULT_JACOCO_VERSION, cribro leaves the build's JaCoCo
version as it is and says so at --info, rather than fail configuration.

User-visible:
On a Gradle whose bundled JaCoCo is older than cribro's, such as 8.14.4
or 9.6.1, test runs with the JaCoCo version from cribro.properties when
the build sets none.

Fixes cribro-dev#23

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On apache/calcite#5419, DEFAULTS gave 8 mutants, all killed, and
reported nothing, while STRONGER gave 13 with 2 survivors:
"replaced equality check with true" and "replaced comparison check with
true". Both pointed at the one branch the change left untested. DEFAULTS
has no mutator that replaces a check with true, so a branch the tests
never take shows only in the diff coverage report.

PIT mutates only the changed lines, so the extra mutators cost little:
the two runs took 428 s and 462 s.

PitestRun.DEFAULT_MUTATORS now holds the default, and PitestRun, the
Gradle task, the Maven goal, and both guides read it. The Maven tests
get the generated plugin descriptor on their classpath to check the
default Maven reads.

User-visible:
pitestDiff and cribro:pitest-diff run PIT with the STRONGER group where
cribro.pitestMutators is not set; the report can list more mutants and
survivors than before. -Pcribro.pitestMutators=DEFAULTS or
-Dcribro.pitestMutators=DEFAULTS restores the previous group.

Fixes cribro-dev#22

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vlsi
vlsi force-pushed the cribro-release-batch branch from d27c92f to 095f1d2 Compare November 28, 2026 06:05
@vlsi vlsi changed the title Fix ten report and configuration issues before the next release: JaCoCo default, STRONGER mutators, clearer counts Make the coverage and mutation reports say what they count Nov 28, 2026
@vlsi vlsi added the breaking-change Changes behavior that existing builds rely on label Nov 28, 2026
vlsi and others added 8 commits November 28, 2026 12:38
On apache/calcite#5419, pitestDiff ran the tests without
-Dcalcite.model.classes.allowed=org.,java.lang. and printed:

    PIT ran the tests without these JVM arguments of the test task, since it splits arguments at commas and whitespace: -Dcalcite.model.classes.allowed=org.,java.lang. -Djunit.jupiter.execution.timeout.default=5 m

PIT's --jvmArgs keeps a comma inside {...} (CommaAwareArgsProcessor in
pitest-command-line 1.30.2), so PitestJvmArgs now passes such an
argument in braces. Once any comma is inside braces, PIT removes every
brace from every argument, so an argument with a comma stays out where
it, or another passed argument, contains a brace of its own. A passed
argument that leaves a { open would join the next one, so it stays out
as well.

PIT writes each argument unquoted into the argument file the test JVM
starts with (hcoles/pitest#1511), and the java launcher splits a line of
it at whitespace, removes its quotes, and reads what follows a # as a
comment. An argument with whitespace, a quote, or a # therefore stays
out. PitestJvmArgs records the reason with each argument it leaves out,
and the message names each reason on a line of its own with its
arguments on the lines below it, one per line, so a reader sees which
rule excluded their argument and where an argument with whitespace
ends.
cribro:pitest-diff also names an argLine argument whose @{property} the
project does not define on a line of its own.

User-visible:
A test JVM argument with a comma and no whitespace, quote, #, or brace reaches the tests PIT runs, where no other argument PIT passes has a brace, and pitestDiff and cribro:pitest-diff no longer list it.
A test JVM argument with a quote or a #, or one that leaves a { open, is no longer passed to PIT, which would have changed it; it is listed with the arguments left out.
pitestDiff and cribro:pitest-diff list the arguments left out under one line per reason, "PIT ran the tests without these JVM arguments of the test task, since <reason>:", each argument on a line of its own indented by two spaces (cribro:pitest-diff says "surefire's default-test"), where the reason is "the java launcher splits a line of the argument file the test JVM starts with at whitespace, removes its quotes, and ends it at a # (hcoles/pitest#1511)", "PIT's --jvmArgs splits at a comma outside braces and removes every brace once a comma is inside them", "PIT's --jvmArgs joins an argument with a { that no } closes to the argument after it", or "PIT's --jvmArgs splits at a comma outside braces, and a comma inside braces would make it remove the braces of <passed arguments>".
An argument left out that holds a carriage return or a line feed is listed with each one printed as \r or \n, so it stays on one line.
cribro:pitest-diff lists an argument with an undefined @{property} as "PIT ran the tests without these JVM arguments of surefire's default-test, since they name an @{property} the project does not define:", with each argument on a line of its own below it.

Not changed:
An argument that starts with @ is still passed; PIT reads that argument file into the test JVM's own without its --add-modules lines.

Fixes cribro-dev#18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The counts line of pitestDiff added TIMED_OUT and MEMORY_ERROR mutants
to "killed" and named them nowhere else, so a reader learned that some
killed mutants had only timed out from pit.log:

    3 mutants: 2 killed, 0 survived, 0 not reached by any test, 1 NON_VIABLE

PIT counts both statuses as detected, so they stay in the killed count,
which now names how many of its mutants timed out or ran out of memory.

User-visible:
The killed count of the pitestDiff and cribro:pitest-diff summary names its timed-out and out-of-memory mutants, such as `2 killed (1 timed out)` or `4 killed (2 timed out, 1 out of memory)`; a status with none is left out.

Fixes cribro-dev#16

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pitestDiff summary counted mutants and said nothing about the
changed lines that got none. On apache/calcite#5419 it printed

    8 mutants: 8 killed, 0 survived, 0 not reached by any test

although the 8 mutants sat on 7 of the 24 changed lines with bytecode,
and two of the other 17 were lines the coverage report of the same run
listed as not executed. "0 not reached by any test" counts PIT's
NO_COVERAGE mutants, so it cannot show a line with no mutant at all.

The build learns which changed lines have bytecode only from JaCoCo,
which pitestDiff does not read. The PIT interceptor that drops the
mutants off the changed lines now also records them: PIT hands every
interceptor the classes it may mutate once per scan, through
MutationInterceptor.initialise, and the interceptor writes the changed
lines that a method of those classes records in its line table to
changed-lines-with-bytecode.txt in the report directory. It skips
bridge methods and synthetic methods other than lambda bodies, as
JaCoCo does in a Java class. The two counts can still differ: JaCoCo
keeps some synthetic code of a Kotlin class, such as a $default
method, and leaves out some code counted here, such as a private empty
constructor. Counting the lines
of the classes PIT calls begin() for would miss a class with no mutant
at all, since PIT calls it only for a class with at least one.

User-visible:
The first line of the pitestDiff and cribro:pitest-diff summary counts the changed lines with bytecode and how many carry a mutant: `8 mutants on 7 of 24 changed lines: 8 killed, 0 survived, 0 not reached by any test`.
A run with no mutant says `no mutant: PIT generated none on the 24 changed lines`, or `no mutant: no changed line has bytecode PIT may mutate` where no changed line has any.
The note `PIT generates no mutant on a line that calls a logging library.` is printed where a changed line with bytecode has no mutant, and no longer under a report whose every such line has one.
Under a PIT before 1.11, set through cribro.pitestVersion, which never calls initialise, the summary counts only the lines with a mutant: `8 mutants on 7 changed lines: ...`.

Fixes cribro-dev#19

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A live mutant names the tests that reached its line, and a
parameterized test was named without its invocation, as
shortTestName collapsed every invocation into one name. On
apache/calcite#5419 a reader saw

    reached by 2 tests:
      CoreQuidemTest.test
      SqlValidatorTest.testJoinUsingThreeWayCommonColumn

and had to open mutants.tsv to learn that invocation 33, the script
sql/join.iq, was the one that reached the line.

A test is now kept as its short name and the index of its invocation:
the number of each JUnit Platform segment whose value is # and an index,
a number of at most nine digits with no leading zero, the index of each
segment after the method whose value is an index alone, such as Spock's
iteration, or the bracketed index of a JUnit 4 parameterized test. After
the class, the last other segment names the method, whatever its type,
so Spock's feature reads like Jupiter's method, and a plain number
before the method, such as a Kotest test named 404, names it too. The
invocations of one test still share one row and count as one test, both
in "reached by N tests" and in the tally that picks which tests a line
names first, and the row lists them in numeric order with consecutive
runs as ranges.

User-visible:
A parameterized or dynamic test that reached a live mutant is named with its invocations, such as `CoreQuidemTest.test[1-3, 33]`; a dynamic test in a dynamic container has one index per level, such as `FooTest.cases[2/5]`.
A JUnit 4 parameterized test with the default name, such as `FooTest.bar[3]`, shares one row with the other invocations of its method, where each invocation had a row of its own.
A JUnit 4 parameterized test run through JUnit Vintage is named as PIT's own JUnit 4 runner names it, such as `FooTest.bar[0-1]`, and shares one row, where each invocation had a row of its own named `FooTest.%5B0%5D`.
A method of a @ParameterizedClass class template, or of a class nested in one, is named by its class and method with the class invocation as its index, such as `FooTest.bar[2-3]`, where its whole unique id was its name.
A Spock feature that reached a live mutant is named by its spec and the method name Spock generates for it, with the iteration of a data-driven feature as its index, such as `FooSpec.$spock_feature_0_1[2]`, where every feature of the spec was named `FooSpec`.
A Kotest test is named by its spec and its innermost test, such as `HttpSpec.works` for the test works in the context a, so two nested tests with the same innermost name share one row, where the outermost test named it, such as `HttpSpec.a`. A Kotest name is free text and is read by the same shapes, so a test named `5` under another test, or `cribro-dev#1` anywhere, reads as an invocation, and one named `cribro-dev#7` adds nothing to the name.

Fixes cribro-dev#20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The diff coverage report listed a changed line that holds only braces
as an unexecuted row of its own, and counted it in "X/Y changed lines
executed" and in "Uncovered changed code". On apache/calcite#5419:

      783: not executed: } else {
      796: not executed: }

javac puts on such a line an instruction of the statement it closes:
the jump over an else block, the jump back to a loop's condition, a
method's implicit return. Whether it ran is already reported by the
lines and branches of that statement, so the row repeats a row above
it and gives the reader nothing to test.

A changed line now counts towards no total and is not a row when its
text, with comments removed, is only "{", "}", ")", ";", ",",
whitespace, and the keyword else, such as "}", "} else {", "});", or
") {". Two kinds of such line are still measured. A line that carries a
branch keeps its decision in the branch totals. The closing brace of a
method or a lambda with an empty body holds the body's only
instruction, so "void noop() {}" written over two lines would otherwise
vanish from the report; JaCoCo reports that brace as the method's first
line, and JacocoLines now reads it from <method line> in the XML report
and from IMethodCoverage in the Maven extension.

CodeLines.holdsCode makes this decision for the diff coverage block,
the exposed-code block, and the PIT interceptor that records the
changed lines with bytecode, so the three leave out the same lines,
except that the mutation summary counts a line that carries a mutant
and the coverage blocks count a line that carries a branch. The
interceptor reads a method's first line from its line table, and the
line text from the changed file under the repository, which cribro
passes to the PIT JVM as -Dcribro.pitest.repository beside the
changed-lines file. Both sides read the text through SourceLines with
the bytes that are not UTF-8 replaced, so the braces of a Latin-1 file
are recognized as well; the quote of an uncovered line in such a file
stays empty.

User-visible:
A changed line holding only braces, `)`, `;`, `,`, and else is not listed under "uncovered changed code" and is left out of "X/Y changed lines executed" and "Uncovered changed code: N lines", unless it carries a branch or is the closing brace of a method or lambda with an empty body.
A file whose changed lines are all such lines is listed under "Changed files with no executable changed lines".
The block of unchanged code a change routes new inputs to leaves out the same lines, and the pitestDiff and cribro:pitest-diff summary leaves such a line out of "of N changed lines" unless a mutant is on it or it is the closing brace of a method or lambda with an empty body.
A source file in another charset that encodes ASCII as single bytes, such as a Latin-1 file with a © in a comment, has its brace-only lines left out of the diff coverage block and the mutation summary as a UTF-8 file does.
A direct caller of cribro-core's PitestRun.systemProperties(), or a PIT launch that sets -Dcribro.pitest.changedLines by hand, must also set PitestRun.repository(root) or -Dcribro.pitest.repository=<root>; otherwise it fails with IllegalStateException: repository is not set, or, in the PIT JVM, System property cribro.pitest.repository is not set. The Gradle plugin and the Maven extension set it.

Not changed:
"} else if (...) {", "} catch (...) {", "} finally {", and "} while (...);" hold code and are measured as before.

Fixes cribro-dev#21

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Uncovered changed code: N lines" added up lines no test executed and
lines that ran with a branch outcome untaken. On a NullAway branch it
said 17 lines while only two changed lines were not executed; the
reader took "uncovered" for "not executed" and could not match the
number to the rows.

The summary now gives the two groups, and they split the total: a line
nothing ran counts as not executed even where it has branches, since
nothing took them either, and a line that ran counts in the second
group. The not-executed group therefore equals the executable lines
less the executed ones in the "Total:" line above it. Acknowledged
lines stay in their group, and the clause after the groups says how
many of the total they are. Both groups are printed even at zero, so
the line keeps one shape between runs.

User-visible:
The diff coverage summary reads, for example,
"Uncovered changed code: 3 lines (2 not executed, 1 with an untaken
branch)", and "Uncovered changed code: 2 lines (2 not executed, 0 with
an untaken branch), 1 of them acknowledged" where a comment
acknowledges a line; it was "3 lines" and "2 lines (1 acknowledged)".
Not changed:
"Uncovered changed code: 0 lines" has no groups.

Fixes cribro-dev#13

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…accept

SourceFileKey.declaredPackage returned null, and the file was keyed by
its path below the source root, for several texts that compile. A file
whose directory does not follow its package, as Kotlin allows, was then
measured under a key JaCoCo and PIT never record: its changed lines were
listed among the files no report mentions, and none of its mutants ran.
The texts it misread:

- a qualified annotation name with whitespace or a comment around a dot,
  such as `@file:kotlin . jvm.JvmName("U")` or `@java.lang . Deprecated`;
- a backticked Kotlin annotation name, or a name with a supplementary
  letter such as U+1D465;
- a Kotlin annotation with type arguments, `@file:Foo<String, (Int) -> Unit>("x")`;
- an escaped quote run in a Java text block argument, `"""\n a\"""b"""`,
  which the scan ended at the escaped quotes;
- a Kotlin string template holding a string or a character, such as
  `"${")"}"` or `"${'"'}"`, which the scan ended at the inner quote, and
  `$$"..."` strings, whose templates need as many dollar signs as the
  prefix has;
- a backticked Kotlin identifier in annotation arguments holding a `)`
  or a quote;
- a Java Unicode escape, such as `\u0040Deprecated` or a `*\u002F` that
  ends a block comment.

The scan now reads a qualified name segment by segment, skipping
whitespace and comments around each dot, by code point, and skips the
type arguments of a Kotlin annotation. A literal ends by the rules of its
language: backslash escapes in Java text blocks and Kotlin strings but
not in Kotlin raw strings, and a Kotlin template skipped to its matching
brace with the literals, comments, and backticked identifiers inside it.
A Java text is read after its Unicode escapes are replaced, as javac
does before it splits the source into tokens.

User-visible:
A Kotlin or Java file whose package declaration follows one of the
forms listed above, and whose directory does not follow its package, is
matched to JaCoCo and PIT by its declared package: its changed lines are
measured instead of listed under "No report read here covers these
files", and its mutants run.

Fixes cribro-dev#10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The block on unchanged code the change routes new inputs to named each
method by its simple name. A call matches every overload of its name, so
two overloads of helper called from one line printed the same row twice:

    helper, whole body, called from line 9

and a reader had to try each overload in the file to find the one a row
counted.

A row now names the method by its parameter types as the source spells
them, without annotations and type arguments: helper(int),
helper(String...). A method of a nested class, or of another top-level
class of the file, is prefixed with its classes, as in Builder.build(),
a method of an anonymous class with its supertype, as in
(anonymous Runnable).run(), and a constructor is new and its class, as
in new Builder(int). Where two methods of a file still get one name,
such as overloads that differ only in the bound of a type variable, or
methods of two local classes, each name ends with the line its
declaration starts on: f(T) at line 12. Two such methods declared on one
line still share a name.

A control-flow region separates its line range with a comma, as a called
region already did, so the line suffix of a name does not run into it.

User-visible:
The exposed-code block prints `run(int, int), lines 8-11, reached through ...` and `helper(int), whole body, called from ...` where it printed `run lines 8-11, ...` and `helper, whole body, ...`.

Fixes cribro-dev#15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vlsi
vlsi force-pushed the cribro-release-batch branch from 095f1d2 to 6dea6e0 Compare November 28, 2026 21:33
@vlsi
vlsi merged commit 0998f13 into cribro-dev:main Nov 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Changes behavior that existing builds rely on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant