Skip to content

ci(backend): run mutation testing monthly in shards - #399

Merged
simonvanlierde merged 5 commits into
mainfrom
ci/scheduled-mutation-testing
Oct 8, 2026
Merged

simonvanlierde merged 5 commits into
mainfrom
ci/scheduled-mutation-testing

Conversation

@simonvanlierde

@simonvanlierde simonvanlierde commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Runs mutmut over the backend app monthly in the Ops workflow (or on demand with operation: mutation), split into eight shards by package so each stays inside the job time limit, and uploads each shard's survivor list. It reports functions whose survivor count is above a committed baseline and never fails on survivors. Run it locally with just mutation, narrowed with mutant globs; it runs at low priority on half the cores.

  • The test suite can now use an already-running Postgres, so forked mutant runs share one server, each with its own database.
  • The baseline is seeded from a full run of all shards: 4351 survivors across 583 functions.
  • mutmut skips decorated functions, so route handlers are not mutated; the tests README says so.
  • Log calls are not mutated on their first line only; the argument lines of multi-line calls still are.

Refs #169.

- add `just mutation`: mutmut over app/ against one shared throwaway Postgres,
  listing functions whose survivor count exceeds a committed baseline
- add `just mutation-baseline` to accept triaged survivors
- let the test suite use an already-running Postgres (TEST_POSTGRES_HOST/PORT)
  and give each forked mutant run its own database
- schedule the run in the Ops workflow and upload the survivor lists
- run local mutation testing at low priority on half the cores; the Ops job
  uses all of them
- fail after 60s if the throwaway Postgres never accepts connections
- document cached verdicts and full-run-only rebaselining
- reuse the Postgres coordinates helper for xdist workers
- relock with the pinned uv version
@codecov

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

- split the Ops mutation job into six matrix shards by mutant name, so each
  stays well inside the job time limit
- move it to its own monthly schedule; the other Ops jobs stay weekly
- pass mutant globs through to mutmut without shell expansion
- document rebaselining from the shards' survivor lists
@simonvanlierde simonvanlierde changed the title ci(backend): run mutation testing weekly ci(backend): run mutation testing monthly in shards Oct 2, 2026
Nearly every API test passes through the middleware and runtime, so their mutants are slow and one app.core shard outran the job limit. The common shard now also catches any new app.api package.
Baseline of 4351 survivors across 583 functions, taken from all eight Ops shards. Also documents that route handlers are not mutated because mutmut skips decorated functions.
@simonvanlierde
simonvanlierde merged commit dede7cc into main Oct 8, 2026
23 checks passed
@simonvanlierde
simonvanlierde deleted the ci/scheduled-mutation-testing branch October 8, 2026 04:11
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.

1 participant