Skip to content

Commit ff21a21

Browse files
dfa1claude
andcommitted
docs: document how to run mutation testing (pitest)
Add a "Mutation testing" section to CLAUDE.md Commands: the opt-in `-P pitest` profile in core/reader, the run commands, where reports land, the gotcha about not invoking the goal directly (loses the JUnit 5 engine and the profile), and the simplify-first reading of survivors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent fbbc54d commit ff21a21

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,27 @@ brew install flatbuffers # only for .fbs edits (any flatc version;
6161
is in-process via `proto-gen` (no `protoc`/`protobuf-java`): one record per message with static
6262
`decode(MemorySegment, long, long)` + `encode()` operating directly on a segment.
6363

64+
### Mutation testing
65+
66+
Opt-in [PIT](https://pitest.org) profile in `core` and `reader` (`-P pitest`), bound to the
67+
`verify` phase and scoped to the bounds/parse classes via `<targetClasses>` in each module POM.
68+
Used to harden the security-critical bounds guards (ADR 0003 Phase E).
69+
70+
```bash
71+
./mvnw -pl reader -am -P pitest verify -DskipITs # reader run (-am builds core; -DskipITs skips ITs)
72+
./mvnw -pl core -P pitest verify # core run (IoBounds)
73+
```
74+
75+
Report: `<module>/target/pit-reports/index.html` (+ `mutations.xml` for scripting). Widen a run by
76+
adding `<param>` entries under `<targetClasses>` in the module's `pitest` profile.
77+
78+
Do not invoke the goal directly (`org.pitest:pitest-maven:mutationCoverage`) — it resolves the
79+
latest plugin without the JUnit 5 engine and ignores the profile; always go through `-P pitest`.
80+
81+
Read survivors as a **simplify-first** signal, not only a test-gap signal: an equivalent mutant
82+
often marks a clause that can never change the outcome (dead code) — delete it rather than writing
83+
an unkillable test. Only add a test when the mutated bound is a genuine, independent edge.
84+
6485
### Releasing
6586

6687
```bash

0 commit comments

Comments
 (0)