Files
werkregie/doc/prs/2026-10-15-PR#90-moved-only.md
claude-code 8930f5a755
werkator build succeeded after 00:49
werkator/deploy build succeeded after 00:23
werkator/vulnerability-data build succeeded after 01:55
werkator/mutation build failed after 15:53
A file that only moved is not mutated by a branch (#90)
Co-authored-by: claude-code <claude-code@javagil.de>
2026-10-15 08:59:13 +02:00

2.4 KiB

PR#90: A File That Only Moved Is Not Mutated by a Branch

Version: patch

WARNING: This document describes only the change applied in this PR. It may already be outdated once the next PR is merged. Historic PR documentation is not maintained along with new PRs; treat it as a snapshot.

  • werkregie PR#86, after which werkregie moves from de.hoennig to de.javagil.

Problem

pitestPartial mutates each class of each Kotlin file that a branch changes, and fails a method above a Mutation-CRAP of 15. The move of werkregie to de.javagil.werkregie changes the package line of each file. Each method of main above 15 would then fail the branch of the move, though no line of its code changed. The rule of the shared workflow allows a move PR nothing but the move, so this change goes first.

Non-Goals

  • No move of packages; that follows in a PR of its own.
  • No change of the nightly pitestFull and its ratchet.

Specification

Feature: a file that only moved counts as unchanged for the mutation tests of a branch

Scenario#90.01: a file that only moved to another package is not mutated

… so that a move of a package does not measure each of its methods against the limit of a branch.

  • Given a branch that moves a source file to another package and changes nothing else in its code
  • When the build of the branch runs its mutation tests
  • Then they do not mutate that file
Verified by

Scenario#90.02: a file that moved and changed its code is mutated

… so that a move does not hide a change of code.

  • Given a branch that moves a source file to another package and changes a line of its code
  • When the build of the branch runs its mutation tests
  • Then they mutate that file
Verified by

Solution

  • changedClasses asks git diff --name-status -M for the renames and compares each moved file with its old version.
  • movedOnly ignores package and import lines, blank lines and the indentation of a line; any other difference counts as a change.
  • checkMovedOnly checks movedOnly with examples, as checkRepositoryWebUrl does.

Open Questions

None.