Skip to content

CIRCLECI-GWP/mutation-testing-chunk-loop

Repository files navigation

mutation-testing-chunk-loop

A self-healing test suite: CircleCI runs Stryker mutation testing on every push, and when mutants survive, the pipeline hands the surviving mutants to a CircleCI Chunk agent that writes the missing tests and opens a PR. A human reviews and merges; the next run is green.

The loop

push to main
   └─ install ─ unit-tests
            └─ mutation-tests        Stryker, JSON report -> score, prompt.txt, REMEDIATE
                  ├─ gate            re-scores; RED while mutants survive
                  └─ remediate       score < 70% -> triggers a Chunk agent task
                                        └─ Chunk agent writes killing tests, opens PR
                                              └─ PR gate must hit 100% -> human merges
                                                    └─ next main run: green
  • src/ — four small, pure modules (age, numbers, strings, validation). Every mutant Stryker generates for them is killable, so 100% is a fair bar.
  • test/ — starts deliberately weak: happy-path assertions only. Mutation score 46.97%.
  • scripts/survivors.mjs — turns Stryker's mutation.json into the loop artifacts: a score file, a prompt.txt task brief for the agent, and a REMEDIATE flag.
  • .circleci/config.yml — the four-job loop. mutation-tests is failure-safe (it can never strand the loop); gate is the tamper-resistant scoring authority (re-scores with CI-supplied arguments and rejects PRs that touch anything but test/).
  • agents.md — standing instructions for the Chunk agent.

Run it yourself

npm ci
npm test          # 15 green tests
npm run mutation  # score 46.97%, exit 1 — the weak suite caught red-handed

See RUNBOOK.md for the one-time CircleCI/Chunk wiring.

About

Mutation testing → CircleCI Chunk auto-remediation loop (demo)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages