From b737fa96c802b38c0aee284be8e4db59ea9a39f0 Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Fri, 4 Dec 2026 22:22:17 +0300 Subject: [PATCH 1/2] Update cribro to 1.4.0 cribro 1.3.0 added the `// mutant: equivalent -- ` marker, which acknowledges a mutant no caller can observe so that `pitestDiff` no longer lists it as live. AGENTS.md and CONTRIBUTING.md now say how to write it, and AGENTS.md asks agents to read `./gradlew -q cribro` before their first measurement in a task. 1.4.0 also lists live mutants on a `// diff-coverage: ignore` line separately, lists covered changed lines that still carry that marker, and skips diff coverage in a build outside a Git working tree, such as one built from a source archive. Assisted-by: Claude Code (claude-opus-5-5) --- AGENTS.md | 5 +++++ CONTRIBUTING.md | 2 +- settings.gradle | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 5a5d25602c..c7e7d78919 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,6 +36,11 @@ After you add or change tests for a change to `/src/main`, run part of `test`. PIT runs only the tests of the module whose code it mutates, so for a change to `nullaway/src/main` name test classes under `nullaway/src/test`. +If no caller can observe a live mutant, mark it on its line with `// mutant: equivalent -- `, where `` +is the text in brackets after the mutant in the `pitestDiff` report, such as `MathMutator#2`, and say so in the PR. On +a line that also carries `// diff-coverage: ignore -- `, put the mutant marker after it. Run +`./gradlew -q cribro` before your first measurement in a task: it explains both reports and the marker syntax. + # Third-party projects in CI When a `Build with snapshot` CI job fails, read `.github/third-party/README.md`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa1755ce16..f5e641bb55 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,7 @@ The build applies [cribro](https://github.com/cribro-dev/cribro) in `settings.gr `./gradlew ::test` prints which of the lines your branch changed the run did not execute, and which changed branches it took only one way. The report covers only the tests the run executed, so run the module's whole suite before you read an uncovered line as a missing test. For a stacked pull request, set `-Pcribro.diffBase` to the parent branch or commit so that only the current layer counts. To acknowledge a line you decided not to test, end it with `// diff-coverage: ignore -- `. `-Pcribro.diffCoverageEnabled=false` runs `test` without JaCoCo and skips the report. -`./gradlew ::pitestDiff -Pcribro.pitestTargetTests=` runs [PIT](https://pitest.org/) over the lines your branch changed in the module's main sources and prints each mutant no test detected. It is not part of `test` or `check`, and a surviving mutant never fails the build. PIT runs only the tests of the module whose code it mutates. The tests in `jdk-recent-unit-tests`, `guava-recent-unit-tests`, `jar-infer/nullaway-integration-test`, and `jdk-annotations/jdk-integration-test` exercise `nullaway/src/main`, and the tests of `jar-infer/jar-infer-lib` and `jdk-annotations/astubx-generator` exercise `StubxWriter` in `library-model/library-model-generator`; none of them runs under the `pitestDiff` of the module whose code they test. PIT mutates a line that calls `Verify` or `Preconditions` like any other, so a surviving mutant that removes such a call marks a check no test makes fail. +`./gradlew ::pitestDiff -Pcribro.pitestTargetTests=` runs [PIT](https://pitest.org/) over the lines your branch changed in the module's main sources and prints each mutant no test detected. It is not part of `test` or `check`, and a surviving mutant never fails the build. PIT runs only the tests of the module whose code it mutates. The tests in `jdk-recent-unit-tests`, `guava-recent-unit-tests`, `jar-infer/nullaway-integration-test`, and `jdk-annotations/jdk-integration-test` exercise `nullaway/src/main`, and the tests of `jar-infer/jar-infer-lib` and `jdk-annotations/astubx-generator` exercise `StubxWriter` in `library-model/library-model-generator`; none of them runs under the `pitestDiff` of the module whose code they test. PIT mutates a line that calls `Verify` or `Preconditions` like any other, so a surviving mutant that removes such a call marks a check no test makes fail. If no caller can observe a surviving mutant, mark it on its line with `// mutant: equivalent -- `, where `` is the text in brackets after the mutant in the report, such as `MathMutator#2`. `-PenableJacoco=true` also instruments the `Test` tasks other than `test`, such as `testJdk*`, for `./gradlew codeCoverageReport`; the report gets data from `test` only while diff coverage is on. On CI, the Linux job sets it and the macOS and Windows jobs set `-Pcribro.diffCoverageEnabled=false`, so their tests run without JaCoCo. diff --git a/settings.gradle b/settings.gradle index e4e952cada..7a5a0ae54a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,7 +10,7 @@ plugins { // to automatically pull in relevant JDK toolchains when not present on the local machine id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" // diff coverage after `test` and the pitestDiff task in every Java project; see AGENTS.md - id("io.github.cribro-dev.cribro") version "1.2.0" + id("io.github.cribro-dev.cribro") version "1.4.0" } include ':annotations' From 3ef22f01fb969aefe7089e25d3d4f0a555a6093b Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Fri, 4 Dec 2026 22:25:49 +0300 Subject: [PATCH 2/2] Say that a diff-coverage: ignore line needs no mutant marker cribro 1.4.0 lists the live mutants of a line marked diff-coverage: ignore apart from the live ones, so such a line needs no mutant: equivalent marker. The note on where to put both markers on one line answered a case that rarely comes up and that the cribro guide covers. Assisted-by: Claude Code (claude-opus-5-5) --- AGENTS.md | 4 ++-- CONTRIBUTING.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index c7e7d78919..3c0c058243 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,8 +37,8 @@ part of `test`. PIT runs only the tests of the module whose code it mutates, so name test classes under `nullaway/src/test`. If no caller can observe a live mutant, mark it on its line with `// mutant: equivalent -- `, where `` -is the text in brackets after the mutant in the `pitestDiff` report, such as `MathMutator#2`, and say so in the PR. On -a line that also carries `// diff-coverage: ignore -- `, put the mutant marker after it. Run +is the text in brackets after the mutant in the `pitestDiff` report, such as `MathMutator#2`, and say so in the PR. +A line marked `// diff-coverage: ignore` needs no such marker: `pitestDiff` lists its live mutants apart. Run `./gradlew -q cribro` before your first measurement in a task: it explains both reports and the marker syntax. # Third-party projects in CI diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f5e641bb55..a13f3ad24b 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -69,7 +69,7 @@ The build applies [cribro](https://github.com/cribro-dev/cribro) in `settings.gr `./gradlew ::test` prints which of the lines your branch changed the run did not execute, and which changed branches it took only one way. The report covers only the tests the run executed, so run the module's whole suite before you read an uncovered line as a missing test. For a stacked pull request, set `-Pcribro.diffBase` to the parent branch or commit so that only the current layer counts. To acknowledge a line you decided not to test, end it with `// diff-coverage: ignore -- `. `-Pcribro.diffCoverageEnabled=false` runs `test` without JaCoCo and skips the report. -`./gradlew ::pitestDiff -Pcribro.pitestTargetTests=` runs [PIT](https://pitest.org/) over the lines your branch changed in the module's main sources and prints each mutant no test detected. It is not part of `test` or `check`, and a surviving mutant never fails the build. PIT runs only the tests of the module whose code it mutates. The tests in `jdk-recent-unit-tests`, `guava-recent-unit-tests`, `jar-infer/nullaway-integration-test`, and `jdk-annotations/jdk-integration-test` exercise `nullaway/src/main`, and the tests of `jar-infer/jar-infer-lib` and `jdk-annotations/astubx-generator` exercise `StubxWriter` in `library-model/library-model-generator`; none of them runs under the `pitestDiff` of the module whose code they test. PIT mutates a line that calls `Verify` or `Preconditions` like any other, so a surviving mutant that removes such a call marks a check no test makes fail. If no caller can observe a surviving mutant, mark it on its line with `// mutant: equivalent -- `, where `` is the text in brackets after the mutant in the report, such as `MathMutator#2`. +`./gradlew ::pitestDiff -Pcribro.pitestTargetTests=` runs [PIT](https://pitest.org/) over the lines your branch changed in the module's main sources and prints each mutant no test detected. It is not part of `test` or `check`, and a surviving mutant never fails the build. PIT runs only the tests of the module whose code it mutates. The tests in `jdk-recent-unit-tests`, `guava-recent-unit-tests`, `jar-infer/nullaway-integration-test`, and `jdk-annotations/jdk-integration-test` exercise `nullaway/src/main`, and the tests of `jar-infer/jar-infer-lib` and `jdk-annotations/astubx-generator` exercise `StubxWriter` in `library-model/library-model-generator`; none of them runs under the `pitestDiff` of the module whose code they test. PIT mutates a line that calls `Verify` or `Preconditions` like any other, so a surviving mutant that removes such a call marks a check no test makes fail. If no caller can observe a surviving mutant, mark it on its line with `// mutant: equivalent -- `, where `` is the text in brackets after the mutant in the report, such as `MathMutator#2`. A line marked `// diff-coverage: ignore` needs no such marker: the report lists its surviving mutants apart. `-PenableJacoco=true` also instruments the `Test` tasks other than `test`, such as `testJdk*`, for `./gradlew codeCoverageReport`; the report gets data from `test` only while diff coverage is on. On CI, the Linux job sets it and the macOS and Windows jobs set `-Pcribro.diffCoverageEnabled=false`, so their tests run without JaCoCo.