Skip to content

test(devtools): mutation campaign coverage discipline (#1304) - #1413

Merged
Sinity merged 1 commit into
masterfrom
feature/test/mutation-campaign-discipline-1304
May 20, 2026
Merged

Sinity merged 1 commit into
masterfrom
feature/test/mutation-campaign-discipline-1304

Conversation

@Sinity

@Sinity Sinity commented May 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #1304. Adds freshness accountability around the existing
mutation-campaign catalog so registered campaigns can be tracked
without depending on agents remembering to run them.

Problem

  • .local/mutation-campaigns/ does not exist on master (no committed
    campaign artifacts).
  • MEMORY.md noted the last full mutmut run was 2026-03-08 — months stale.
  • The existing docs/plans/campaign-coverage.yaml registers 19
    campaigns but nothing detects when a registered campaign has not
    been run in N days.
  • A module added today gets zero mutation coverage and no one notices.

The infrastructure exists; the accountability surface was missing.

Solution

  • devtools verify-mutation-freshness (devtools/verify_mutation_freshness.py):
    Reads docs/plans/campaign-coverage.yaml, walks each active mutation
    campaign, and reports campaigns whose newest artifact at
    .local/mutation-campaigns/<name>/*.json is older than the
    campaign's freshness_days budget (default 60). Three states:
    fresh, stale, missing. Also surfaces orphan artifact directories
    whose name no longer appears in the manifest, so the local tree and
    registry can't silently drift apart. Soft by default (always exit 0)
    so the standard devtools verify baseline can include it without
    gating on local mutation-run cadence; --strict turns
    missing/stale into a hard fail and is intended for nightly jobs and
    devtools verify --lab.
  • devtools mutmut-campaign status (devtools/mutmut_campaign.py):
    New subcommand renders the per-campaign state/age/budget/kill-rate
    table by reusing the same freshness assess_campaign helper.
  • Default artifact paths: devtools mutmut-campaign run now writes
    to .local/mutation-campaigns/<name>/<timestamp>.{json,md} when
    --json-out / --markdown-out are unset. Explicit flags still
    override. This guarantees the freshness lint and the status command
    always have something to discover.
  • verify-manifests now defines a default artifact_glob for
    mutation_campaigns matching the new layout, mirroring the existing
    default for benchmark_campaigns. Declared freshness_days no
    longer requires an explicit artifact_glob.
  • Wired into devtools verify as a soft step (between
    verify-test-clock-hygiene and verification-impact check) and into
    devtools verify --lab as a hard --strict step.
  • 11 unit tests cover assess_campaign for the four states, orphan
    detection, soft vs strict main(), the committed manifest, the
    initial-registry coverage AC from test(devtools): mutation campaign coverage discipline — track per-module mutmut campaigns #1304, and the default artifact
    layout.

Acceptance criteria mapping:

  • Per-module registry with freshness budget: existing
    docs/plans/campaign-coverage.yaml is the registry; freshness_days
    schema field already declared in CampaignCoverageManifest
    (default 60 applied by the lint when entries omit it).
  • verify-mutation-freshness lint that fails if not run in N days:
    --strict mode does this; soft mode reports as warnings.
  • mutmut-campaign run writes structured artifact: existing
    runner already emits a complete CampaignResult JSON; new default
    artifact path locates it under .local/mutation-campaigns/<name>/.
  • mutmut-campaign status shows per-module last-run + kill rate
    + threshold check
    : new subcommand.
  • Initial registry covers ≥10 modules: existing catalog covers
    19; test asserts the 10 named seed modules are present.
  • CI nightly rotating-subset job: deferred. The scaffolding
    this PR lands is the prerequisite; a follow-up PR can add the
    GitHub Actions workflow that runs devtools mutmut-campaign run
    on a rotating campaign and pushes the artifact. Tracked under
    test(devtools): mutation campaign coverage discipline — track per-module mutmut campaigns #1304 follow-up; not a hidden TODO.

Verification

$ nix develop -c pytest tests/unit/devtools/test_verify_mutation_freshness.py -q
11 passed in 9.29s

$ nix develop -c devtools verify-mutation-freshness
registered active mutation campaigns: 19
  fresh:   0
  stale:   0 (older than freshness_days)
  missing: 19 (no run artifact)
... [19 warn lines] ...
blocking=False (strict=False)
$ echo $?
0

$ nix develop -c devtools verify-mutation-freshness --strict
... blocking=True (strict=True)
$ echo $?
1

$ nix develop -c devtools verify-manifests
manifest consistency checks passed

$ nix develop -c mypy devtools/verify_mutation_freshness.py devtools/mutmut_campaign.py tests/unit/devtools/test_verify_mutation_freshness.py
Success: no issues found in 3 source files

$ nix develop -c devtools verify --quick
... exit_code: 0 (verify-mutation-freshness step: ok 0.27s)

Summary by CodeRabbit

  • New Features

    • Added a new verify-mutation-freshness developer command that checks mutation campaign artifact freshness against a coverage manifest with soft (warnings) and strict (error) modes, supporting JSON or human-readable output.
  • Documentation

    • Updated campaign coverage documentation with expanded metadata fields and freshness budget guidance.
  • Tests

    • Added comprehensive test coverage for mutation freshness verification scenarios.

Review Change Stack

Closes #1304.

Wire freshness accountability around the existing mutation-campaign
catalog so registered campaigns can be tracked without depending on
agents remembering to run them.

- New devtools verify-mutation-freshness lint reads
  docs/plans/campaign-coverage.yaml and reports campaigns whose newest
  artifact under .local/mutation-campaigns/<name>/*.json is older than
  freshness_days (default 60) or missing entirely. Soft by default so
  the standard devtools verify baseline can include it without gating
  on local mutation-run cadence; --strict turns missing/stale into a
  hard fail and is wired into devtools verify --lab plus is intended
  for nightly jobs.
- Surfaces orphan artifact directories whose name no longer appears
  in the manifest so the .local/ tree and registry can't silently
  drift apart.
- devtools mutmut-campaign run now defaults the JSON/Markdown output
  to the timestamped per-campaign layout when --json-out/--markdown-out
  are unset, so freshness lint and status readouts always have
  something to discover. Explicit flags still override.
- New devtools mutmut-campaign status subcommand renders the per-
  campaign state/age/freshness budget/kill rate table by reusing the
  freshness assess helper.
- verify-manifests gains a default artifact_glob for mutation_campaigns
  matching the new layout, so declared freshness_days no longer
  requires an explicit artifact_glob.

Verification:
- nix develop -c pytest tests/unit/devtools/test_verify_mutation_freshness.py
  -> 11 passed
- nix develop -c devtools verify-mutation-freshness -> 19 missing, exit 0
- nix develop -c devtools verify-mutation-freshness --strict -> exit 1
- nix develop -c devtools verify-manifests -> manifest checks passed
- nix develop -c mypy devtools/verify_mutation_freshness.py
  devtools/mutmut_campaign.py tests/unit/devtools/test_verify_mutation_freshness.py
  -> no issues

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@Sinity
Sinity merged commit 1d9aad8 into master May 20, 2026
3 of 4 checks passed
@Sinity
Sinity deleted the feature/test/mutation-campaign-discipline-1304 branch May 20, 2026 04:08
@coderabbitai

coderabbitai Bot commented May 20, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 64f90a85-e4ca-4377-a4f9-192ff4ba95cf

📥 Commits

Reviewing files that changed from the base of the PR and between 4f4d677 and 90381f3.

📒 Files selected for processing (9)
  • AGENTS.md
  • devtools/command_catalog.py
  • devtools/mutmut_campaign.py
  • devtools/verify.py
  • devtools/verify_manifests.py
  • devtools/verify_mutation_freshness.py
  • docs/devtools.md
  • docs/plans/campaign-coverage.yaml
  • tests/unit/devtools/test_verify_mutation_freshness.py

📝 Walkthrough

Walkthrough

This PR implements mutation campaign freshness verification infrastructure that enforces mutation kill threshold accountability. It adds a verify-mutation-freshness command to assess campaign artifacts against a registry manifest, tracks per-module mutation run status, standardizes artifact paths, and integrates freshness checks into the verification baseline.

Changes

Mutation campaign freshness verification

Layer / File(s) Summary
Core mutation freshness verification command
devtools/verify_mutation_freshness.py
New main() CLI entrypoint that loads the campaign registry manifest, assesses each campaign's artifact freshness (fresh/stale/missing/inactive), detects orphan artifacts not in the registry, and emits human-readable or JSON output. Supports soft mode (always exits 0, warnings prefixed [warn]) and --strict mode (exits 1 when campaigns are missing or stale, prefixed [BLOCK]).
Campaign artifact standardization and status command
devtools/mutmut_campaign.py
Adds default_artifact_paths() to standardize per-campaign artifact naming under .local/mutation-campaigns/<campaign>/<timestamp>.{json,md}. Updates cmd_run() to use defaults when no explicit output paths are provided. Adds new status subcommand that loads the freshness manifest, assesses each campaign, and prints either a formatted table or JSON summary including age, freshness budget, and kill rate.
Freshness manifest support for mutation campaigns
devtools/verify_manifests.py
Extends default artifact glob support to mutation campaigns when freshness_days is declared without an explicit artifact_glob, mirroring the prior benchmark-only behavior. Error messages updated to reflect that both mutation and benchmark campaigns now support defaults.
Verification baseline integration
devtools/verify.py
Integrates verify-mutation-freshness (non-strict) into the default verification step sequence as a recommended gate. In --lab mode, appends an additional verify-mutation-freshness --strict step for stricter validation.
Command catalog and documentation
devtools/command_catalog.py, AGENTS.md, docs/devtools.md, docs/plans/campaign-coverage.yaml
Register the new verify-mutation-freshness command in the shared devtools catalog with description and CLI examples. Update generated documentation and campaign-coverage manifest schema with field documentation for freshness_days and artifact_glob optional entries.
Comprehensive test coverage
tests/unit/devtools/test_verify_mutation_freshness.py
Unit tests for default artifact path naming, campaign freshness assessment (fresh/stale/missing/inactive scenarios), orphan artifact detection, and CLI behavior validation (soft vs --strict exit codes). Integration tests that lint the committed manifest and validate registry coverage against issue #1304 acceptance criteria (≥10 required module names).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Sinity/polylogue#1279: Both extend devtools verification by adding new command specs in command_catalog.py and wiring new verification gates in devtools/verify.py.
  • Sinity/polylogue#450: Both modify verification baseline step integration in devtools/verify.py by appending new verification commands.
  • Sinity/polylogue#1073: Both change the default verification steps wiring in devtools/verify.py.

🐰 Freshness checks now guard the garden,
Campaign artifacts in the light,
Mutations tracked with care and pardon,
Registry keeps the vigil bright!
✨📊

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/test/mutation-campaign-discipline-1304

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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

Copy link
Copy Markdown

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: 90381f3863

ℹ️ 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 devtools/verify_mutation_freshness.py Resolved
@Sinity

Sinity commented Sep 30, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

Only the rows listed above are dispositioned. Held findings remain open.

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.

test(devtools): mutation campaign coverage discipline — track per-module mutmut campaigns

1 participant