Skip to content

Add mutation testing gate to pull request CI - #4

Merged
giacope merged 1 commit into
mainfrom
claude/compassionate-goldberg-4ndcn2
Sep 26, 2026
Merged

giacope merged 1 commit into
mainfrom
claude/compassionate-goldberg-4ndcn2

Conversation

@giacope

@giacope giacope commented Sep 26, 2026

Copy link
Copy Markdown
Owner

This PR adds a mutation testing step to the CI pipeline using kimera, which validates that code changes are adequately tested by mutating the modified lines and ensuring the test suite catches the mutations.

Key changes

  • CI workflow: Added a new mutation job that runs only on pull requests, checking that any mutants introduced in changed lines are killed by the test suite
  • Coverage configuration: Modified SimpleCov to skip the coverage floor check when KIMERA environment variable is set, since mutation testing on partial code changes would otherwise fail the coverage requirement
  • Documentation: Updated CONTRIBUTING.md with instructions on how to run mutation testing locally before pushing changes, including the command and explanation of how to triage surviving mutants

Implementation details

The mutation job:

  • Checks out with full history (fetch-depth: 0) to enable diffing against the base branch
  • Uses Ruby 3.4 for consistency
  • Runs kimera ci --since origin/${{ github.base_ref }} to mutate only lines changed in the PR
  • Sets KIMERA=1 to disable SimpleCov's coverage floor, which would be inappropriate for partial code coverage analysis
  • Fails the build if any mutants survive (aren't killed by tests)

https://claude.ai/code/session_01Y6Lnj5JfWu4bi6PCYQAc5s

A new CI job runs `kimera ci --since` against the PR's base branch, so
any surviving mutant on a changed line fails the build.

kimera 0.1.1 fixes the Linux boot crash (`require "english"`) and runs
its children with KIMERA=1. spec_helper now skips the coverage floor
under it: a partial run always trips the floor, which failed passing
runs with SimpleCov's exit 2. The CI step sets KIMERA=1 itself, since
0.1.1 sets it only for --isolated children and the warm run loads
spec_helper in-process.

The job passes --no-fail-on-no-coverage, as .kimera.yml already
chose: SimpleCov's 100% floor already fails untested lines, and kimera
reports cli/flag.rb's methods as uncovered because it cannot overlay a
Data.define block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y6Lnj5JfWu4bi6PCYQAc5s
@giacope
giacope merged commit 666354a into main Sep 26, 2026
4 checks passed
@giacope
giacope deleted the claude/compassionate-goldberg-4ndcn2 branch September 26, 2026 14:40
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.

2 participants