Skip to content

Add mutation testing ADR and execplan#512

Merged
leynos merged 2 commits intomainfrom
mutation-testing
Mar 24, 2026
Merged

Add mutation testing ADR and execplan#512
leynos merged 2 commits intomainfrom
mutation-testing

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Mar 23, 2026

Summary by Sourcery

Documentation:

  • Document the rationale, design, and workflow sketch for introducing mutation testing with cargo-mutants via a scheduled GitHub Actions workflow.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Mar 23, 2026

Reviewer's Guide

Documents the planned mutation testing setup by adding a detailed execution plan for a new scheduled GitHub Actions workflow using cargo-mutants and an ADR capturing the architectural decision, workflow sketch, and rationale.

Sequence diagram for mutation testing workflow execution and summary generation

sequenceDiagram
  actor Developer
  participant GithubUI
  participant Workflow as MutationTestingWorkflow
  participant Runner as GitHubRunner
  participant Repo as WireframeRepo
  participant SetupRust as SetupRustAction
  participant CargoMutants as CargoMutantsTool
  participant JQ as JQSummaryScript

  Developer->>GithubUI: Trigger workflow_dispatch (select branch)
  GithubUI->>Workflow: Start workflow with branch input
  Workflow->>Runner: Create job mutants (ubuntu-latest)

  Runner->>Repo: actions/checkout@v5 (ref=branch)
  Repo-->>Runner: Source code

  Runner->>SetupRust: Run shared setup-rust action
  SetupRust-->>Runner: Rust toolchain configured

  Runner->>CargoMutants: cargo mutants --timeout-multiplier 3 --output mutants.out
  CargoMutants-->>Runner: mutants.out/ with outcomes.json

  Runner->>Runner: actions/upload-artifact@v4 (mutation-report)

  alt outcomes.json exists
    Runner->>JQ: Run jq filters on mutants.out/outcomes.json
    JQ-->>Runner: caught, missed, timeout counts and survivor table
    Runner->>GithubUI: Append Markdown to $GITHUB_STEP_SUMMARY
  else no outcomes.json
    Runner->>GithubUI: Skip summary content
  end

  GithubUI-->>Developer: Show job summary and downloadable artifact
Loading

File-Level Changes

Change Details Files
Add an execution plan documenting how a scheduled mutation-testing workflow with cargo-mutants should be implemented and validated.
  • Describe purpose and expected behaviour of a weekly GitHub Actions workflow that runs cargo-mutants and publishes artefacts plus a Markdown summary
  • Define constraints, tolerances, risks, and progress stages for introducing the workflow
  • Document the correct cargo-mutants outcomes.json schema and jq filters for counting and listing surviving mutants
  • Lay out staged implementation, validation steps, and quality criteria for the workflow
docs/execplans/mutation-testing.md
Introduce an ADR specifying the decision to use cargo-mutants with a scheduled GitHub Actions workflow and summarised mutation results.
  • Capture problem context, decision drivers, and options considered for mutation testing in the project
  • Select cargo-mutants as the chosen approach and describe a non-blocking scheduled workflow and its artefacts
  • Provide a concrete GitHub Actions workflow sketch including triggers, steps, and summary generation using jq over outcomes.json
  • List known risks, limitations, and outstanding decisions around scope, thresholds, and timeouts
docs/adr-007-mutation-testing-with-cargo-mutants.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 748f4f22-3305-4cdf-b38d-625ed3fc3001

📥 Commits

Reviewing files that changed from the base of the PR and between c363f0c and 270da56.

📒 Files selected for processing (2)
  • docs/adr-007-mutation-testing-with-cargo-mutants.md
  • docs/execplans/mutation-testing.md

Summary by CodeRabbit

  • Documentation
    • Added an architectural decision record proposing mutation testing to enhance test fault detection and outline risks/limitations and outstanding decisions.
    • Added an execution-plan describing a scheduled/manual mutation-testing workflow, observable job summary behaviour, artifact generation and validation steps.

Walkthrough

Add two documentation artefacts: an ADR proposing cargo-mutants for mutation testing with a scheduled/manual GitHub Actions workflow, and an execution plan detailing workflow steps, jq outcome parsing, artifact handling, risks, and validation steps.

Changes

Cohort / File(s) Summary
Mutation Testing ADR & Plan
docs/adr-007-mutation-testing-with-cargo-mutants.md, docs/execplans/mutation-testing.md
Add ADR and execution plan describing a GitHub Actions workflow that installs cargo-mutants, runs mutation testing with timeouts, uploads mutants.out/ as an artifact, and posts parsed outcome summaries (caught/missed/timeout) and a survivors table to the GitHub job summary; document risks, tolerances and outstanding decisions.

Sequence Diagram(s)

sequenceDiagram
    participant Scheduler as Scheduler / Manual trigger
    participant GH_Actions as GitHub Actions (workflow)
    participant Runner as Runner (job)
    participant CargoMutants as cargo-mutants
    participant ArtifactStore as Artifacts / Outcomes
    participant StepSummary as $GITHUB_STEP_SUMMARY

    rect rgba(135,206,235,0.5)
      Scheduler->>GH_Actions: schedule / workflow_dispatch (branch input)
      GH_Actions->>Runner: start job (setup)
    end

    rect rgba(144,238,144,0.5)
      Runner->>Runner: setup Rust (pinned action)
      Runner->>CargoMutants: install cargo-mutants
      Runner->>CargoMutants: run `cargo mutants` (timeout multiplier, output dir)
      CargoMutants-->>Runner: write `mutants.out/outcomes.json`
      Runner->>ArtifactStore: upload `mutants.out/` artifact
    end

    rect rgba(255,228,181,0.5)
      Runner->>Runner: parse outcomes.json with jq
      Runner->>StepSummary: post counts and survivors table (if any)
      StepSummary-->>GH_Actions: visible job summary + artifact link
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🧬 Mutants prowled where tests once trod,
Weekly hunts now scan each pod,
cargo-mutants rings the bell,
Survivors shown where secrets dwell. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely summarises the main change: adding two documentation files (an ADR and execution plan) for mutation testing.
Description check ✅ Passed The description is related to the changeset, explaining the purpose of documenting mutation testing rationale, design, and workflow introduction.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mutation-testing

Comment @coderabbitai help to get the list of available commands and usage tips.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos leynos marked this pull request as ready for review March 23, 2026 17:39
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The ExecPlan’s risk mitigation recommends pinning the cargo-mutants version, but the later "Interfaces and dependencies" section explicitly calls out having no version pin for the initial rollout; consider clarifying this as a phased plan so it’s obvious whether pinning is expected from day one or after the first run.
  • The ADR’s workflow sketch still uses the older jq assumptions (.[], .scenario == "Mutant", .mutant.source_file, etc.) that the ExecPlan later corrects; it may be worth either updating the sketch now or adding a short note that the jq is illustrative and will be aligned with the outcomes.json structure during implementation to avoid confusion.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The ExecPlan’s risk mitigation recommends pinning the `cargo-mutants` version, but the later "Interfaces and dependencies" section explicitly calls out having no version pin for the initial rollout; consider clarifying this as a phased plan so it’s obvious whether pinning is expected from day one or after the first run.
- The ADR’s workflow sketch still uses the older jq assumptions (`.[]`, `.scenario == "Mutant"`, `.mutant.source_file`, etc.) that the ExecPlan later corrects; it may be worth either updating the sketch now or adding a short note that the jq is illustrative and will be aligned with the `outcomes.json` structure during implementation to avoid confusion.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c363f0c2e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/adr-007-mutation-testing-with-cargo-mutants.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/adr-007-mutation-testing-with-cargo-mutants.md`:
- Line 36: Update the spelling in the ADR sentence that currently reads
"Minimise maintenance burden: prefer a single-binary tool that understands" to
use the -ize suffix; replace "Minimise" with "Minimize" in the
docs/adr-007-mutation-testing-with-cargo-mutants.md sentence so it reads
"Minimize maintenance burden: prefer a single-binary tool that understands".

In `@docs/execplans/mutation-testing.md`:
- Around line 193-196: Remove the developer-specific absolute path
'/data/leynos/Projects/wireframe.worktrees/mutation-testing' from the "Concrete
steps" section and either delete the line or replace it with a generic reference
such as "repository root" or "<repo-root>"; update the sentence so it simply
states that all commands are run from the repository root without including any
local filesystem paths.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6e2e4541-713e-4c80-8e70-f03fba462c3e

📥 Commits

Reviewing files that changed from the base of the PR and between bb1e2e1 and c363f0c.

📒 Files selected for processing (2)
  • docs/adr-007-mutation-testing-with-cargo-mutants.md
  • docs/execplans/mutation-testing.md

Comment thread docs/adr-007-mutation-testing-with-cargo-mutants.md Outdated
Comment thread docs/execplans/mutation-testing.md Outdated
Correct the jq filters in ADR-007's workflow sketch to match the actual
`cargo-mutants` `outcomes.json` structure:

- Use `.outcomes[]` instead of `.[]` for array iteration
- Use `.scenario != "Baseline"` instead of `.scenario == "Mutant"` to
  identify mutant outcomes
- Update field paths: `.scenario.Mutant.file`,
  `.scenario.Mutant.span.start.line`, and `.scenario.Mutant.name`

Also fix spelling: "Minimise" → "Minimize" on line 36.

In the execplan, remove the developer-specific absolute path from the
"Concrete steps" section.

These changes ensure the workflow example produces accurate mutation
summaries and correctly extracts surviving mutants.
@leynos leynos merged commit 9f88f53 into main Mar 24, 2026
6 checks passed
@leynos leynos deleted the mutation-testing branch March 24, 2026 01:44
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