Skip to content

Document mutation-testing workflow contract tests - #297

Open
leynos wants to merge 2 commits into
mainfrom
docs/mutation-contract-tests
Open

Document mutation-testing workflow contract tests#297
leynos wants to merge 2 commits into
mainfrom
docs/mutation-contract-tests

Conversation

@leynos

@leynos leynos commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a "Mutation-testing workflow contract tests" section to
    docs/developers-guide.md, inserted between "Running Tests" and "Proof
    workflows" (the guide has no existing mutation-testing section and no
    table of contents/index to cross-link, so this is a new top-level ##
    section with no TOC entry to add).
  • Documents the actual caller,
    .github/workflows/mutation-testing.yml,
    which delegates to leynos/shared-actions/.github/workflows/mutation-cargo.yml
    pinned at 927edd45ae77be4251a8a18ca9eb5613a2e32cbd, its real with:
    inputs (paths, exclude-globs, extra-args: --all-features), and the
    contract test at
    tests/workflow_contracts/mutation_testing_test.py.
  • Documents the pin-only adoption rationale specific to this repository:
    the mutation caller's exclude-globs does not (and cannot) fully mirror
    make test's TEST_EXCLUDES, because the excluded crates
    (whitaker, function_attrs_follow_docs, module_max_lines,
    no_expect_outside_tests) use feature(rustc_private) under the
    dylint-driver feature and need the dynamic-linking RUSTFLAGS
    (-C prefer-dynamic -Z force-unstable-if-unmarked) injected only by the
    test/typecheck Makefile targets — see the note in
    .cargo/config.toml. The shared mutation workflow has no equivalent
    per-crate RUSTFLAGS step, so this repository does not (and cannot) run a
    full --test-workspace mutation baseline matching the CI test scope
    wholesale. The section states this honestly rather than claiming parity.

Details

  • Contract-test style: shape-only (USES_RE regex asserting a full
    40-hex commit SHA pin, not a hard-coded value), so Dependabot bumps the
    pin without an accompanying test edit. No pytestmark/skipif guard is
    present or needed — this is a Rust workspace, not a Python package whose
    tests run inside a mutmut sandbox.
  • Local run command documented: make test-workflow-contracts, which wraps
    uv run --with 'pytest>=8' --with 'pyyaml>=6' pytest tests/workflow_contracts -q.
  • Roadmap/execplan tracking: checked docs/roadmap.md and
    docs/execplans/* — no task references mutation testing or this doc
    work, so no roadmap/execplan tracking applies and none was
    annotated.
  • Docs lint: ran make markdownlint (spelling via typos, then
    markdownlint-cli2 across all 69 Markdown files in the repository).
    Both passed with zero errors after fixing two -ise/-ize spelling
    issues (summarisingsummarizing, serialisesserializes) that
    the new section introduced.

Deviations from the template

  • The template's Permutation B assumed extra-args would carry a
    --test-workspace/--workspace flag; whitaker's caller instead uses
    extra-args: --all-features (matching the Makefile's CARGO_FLAGS
    feature baseline), with workspace-wide coverage coming from the paths
    input rather than a mutants flag. The section documents the real value
    and explains the pin-only reasoning instead.

Edited files: docs/developers-guide.md, docs/contents.md, and
docs/adr-004-pin-only-mutation-testing-contract.md.

References

Add a "Mutation-testing workflow contract tests" section to the
developer's guide describing the thin caller workflow, its
configuration, the pin-only adoption rationale (dylint crates needing
per-target RUSTFLAGS that the shared workflow cannot reproduce), and
the local command for running the contract test suite.
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Documented the mutation-testing workflow’s scheduled and manual modes, configuration inputs, pinned reusable-workflow reference, pin-only limitation, ADR, and contract-test coverage.

Changes

Mutation-testing workflow documentation

Layer / File(s) Summary
Document workflow contract
docs/developers-guide.md, docs/adr-004-pin-only-mutation-testing-contract.md, docs/contents.md
Describe workflow delegation, execution modes, mutation-scope inputs, pin-only limitations, the accepted ADR decision, and its documentation index entry.
Document contract-test coverage
docs/developers-guide.md
Document the test suite, make test-workflow-contracts, and validation of pin shape, inputs, permissions, concurrency, and triggers.

Possibly related PRs

Poem

Pin the workflow, clear and bright,
Test each trigger, scope, and right.
Daily checks and manual flights
Record their contract through the nights.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Developer Documentation ⚠️ Warning The docs update exists, but the ADR still uses future-dated 2026-07-23 and its options section is prose-only, not the required comparison table with caption. Set the ADR date to the actual acceptance date and replace the options prose with a comparison table plus caption, then re-run the docs review.
Testing (Overall) ❓ Inconclusive Placeholder to satisfy tool schema if needed. Need to inspect the changed test files and their assertions before deciding.
✅ Passed checks (18 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
User-Facing Documentation ✅ Passed Treat this as PASS: the PR only adds maintainer documentation in docs/developers-guide.md/ADR, and docs/users-guide.md remains focused on install, config, and use.
Module-Level Documentation ✅ Passed PASS: The PR changes only Markdown docs; no Rust/Python modules or module docstrings are introduced or modified.
Testing (Unit And Behavioural) ✅ Passed The new Python contract tests exercise the real GitHub Actions workflow boundary, checking the actual YAML contract rather than internal helpers or mocks.
Testing (Property / Proof) ✅ Passed No new range-based invariant or proof obligation is introduced; the PR only documents a workflow contract and existing shape-only tests.
Testing (Compile-Time / Ui) ✅ Passed Docs-only PR; no new Rust/TypeScript compile-time path or UI/text snapshot surface was introduced, so trybuild/snapshot machinery is not applicable.
Unit Architecture ✅ Passed The PR only adds and links documentation; no runtime code, dependencies, or architectural units changed, so the unit-architecture rules are not implicated.
Domain Architecture ✅ Passed Only documentation and workflow-contract files changed; no domain, adapter, or persistence code was touched, so the domain boundary remains unaffected.
Observability ✅ Passed PASS: The commit only adds documentation/ADR content; no operational code, logging, metrics, tracing, or alerts changed.
Security And Privacy ✅ Passed Approve this change: it adds docs only, with no secrets or credentials, and the cited workflow keeps least-privilege token scopes.
Performance And Resource Use ✅ Passed PASS: The PR only changes Markdown docs and ADR text; no executable code, loops, I/O, or resource-sensitive paths were added.
Concurrency And State ✅ Passed Per-ref workflow concurrency is explicit and contract-tested; no new mutable shared state, async tasks, locks, or interleaving-prone code was added.
Architectural Complexity And Maintainability ✅ Passed PASS: The PR only adds documentation and a contents link; it introduces no new runtime abstractions, layers, dependencies, or extension points.
Rust Compiler Lint Integrity ✅ Passed PR only changes docs; no Rust source, lint suppressions, or ownership code were added, so the lint-integrity check is not applicable.
Title check ✅ Passed The title accurately reflects the documentation of mutation-testing workflow contract tests.
Description check ✅ Passed The description is directly related and describes the documented workflow contract tests and pin-only rationale.
✨ 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 docs/mutation-contract-tests

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

@sourcery-ai sourcery-ai 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.

Sorry @leynos, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

codescene-access[bot]

This comment was marked as outdated.

codescene-access[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review July 21, 2026 22:27

@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: 087be29a97

ℹ️ 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/developers-guide.md Outdated
Comment on lines +315 to +319
adoption is **pin-only**: the caller declares the best approximation of the CI
scope it safely can, rather than a `--test-workspace` run that mirrors
`make test` crate-for-crate, and the contract test asserts only that this
declared configuration holds — not that a full workspace mutation baseline
passes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Record the pin-only decision in a design document

This establishes a substantive architecture decision—accepting a mutation scope that cannot reproduce the CI baseline and deliberately testing only its declared configuration—but records the rationale solely in the developer operating guide. Move the decision and its consequences into the relevant design document or an ADR, then link to it here, so the repository's normative design record preserves this constraint as required.

AGENTS.md reference: AGENTS.md:L48-L51

Useful? React with 👍 / 👎.

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/developers-guide.md`:
- Line 279: Update the documentation text near “job summary” to use the required
British spelling “artefacts” instead of “artifacts,” preserving the surrounding
wording.
🪄 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 Plus

Run ID: df12017f-a585-422e-935a-6f503314fad3

📥 Commits

Reviewing files that changed from the base of the PR and between 2b78531 and 087be29.

📒 Files selected for processing (1)
  • docs/developers-guide.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Comment thread docs/developers-guide.md
lifting — running `cargo-mutants`, sharding, and summarizing survivors — lives
in `shared-actions`; this repository carries only declarative configuration.
The run is **informational only**: it never gates a pull request. Survivors
are reported through the job summary and downloadable artefacts so they can be

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use the required British spelling.

Change artifacts to artefacts.

Triage: [type:spelling]

As per path instructions, Markdown uses en-GB-oxendist spelling.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/developers-guide.md` at line 279, Update the documentation text near
“job summary” to use the required British spelling “artefacts” instead of
“artifacts,” preserving the surrounding wording.

Source: Path instructions

@leynos

leynos commented Jul 22, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

Preserve the architectural constraint that the shared mutation workflow
cannot reproduce Whitaker's per-crate test flags. Document the accepted
declared-configuration contract and link it from the maintainer guide.
codescene-access[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/adr-004-pin-only-mutation-testing-contract.md`:
- Around line 5-11: Update the acceptance date in the ADR heading and the
corresponding Date section to the actual non-future acceptance date, replacing
both occurrences of 2026-07-23 consistently.
- Around line 38-56: Replace the prose-only “Options considered” list in the ADR
with a comparison table covering Options A, B, and C across feasibility,
mutation coverage, operational risk, and other relevant dimensions. Preserve
each option’s existing rationale, and add a caption directly below the table.
🪄 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 Plus

Run ID: eb1e1c64-d562-48c7-af27-e5c3c8a5ff0e

📥 Commits

Reviewing files that changed from the base of the PR and between 2b78531 and 1454b33.

📒 Files selected for processing (3)
  • docs/adr-004-pin-only-mutation-testing-contract.md
  • docs/contents.md
  • docs/developers-guide.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Comment on lines +5 to +11
Accepted (2026-07-23): Keep Whitaker's mutation-testing adoption pin-only and
contract-test its declared configuration rather than claiming parity with the
continuous integration (CI) test baseline.

## Date

2026-07-23.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use a non-future ADR date.

Align Line [5] and Line [11] with the actual acceptance date. 2026-07-23 is tomorrow relative to the review date, Wednesday, July 22, 2026, so the ADR currently records a decision before it occurred.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adr-004-pin-only-mutation-testing-contract.md` around lines 5 - 11,
Update the acceptance date in the ADR heading and the corresponding Date section
to the actual non-future acceptance date, replacing both occurrences of
2026-07-23 consistently.

Comment on lines +38 to +56
## Options considered

### Option A: require full CI-baseline parity

Pass a workspace-testing argument and treat the mutation run as equivalent to
`make test`. This is not implementable through the current shared workflow
because it cannot inject the required flags per crate.

### Option B: exclude every crate that needs dynamic-linking flags

Remove the affected crates from mutation scope. This would make the workflow
run reliably, but would deliberately omit important production code and make
the reported scope less useful.

### Option C: adopt a pin-only declared-configuration contract

Run the closest safe approximation supported by the shared workflow and test
the caller's security and configuration shape without asserting that a full
workspace mutation baseline passes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the required options comparison table.

Replace the prose-only options list with a table comparing the alternatives across multiple dimensions, such as feasibility, mutation coverage, and operational risk. Add a caption below the table.

Triage: [type:docstyle]

As per coding guidelines, every ADR must compare options across multiple dimensions using a table with a caption below it.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/adr-004-pin-only-mutation-testing-contract.md` around lines 38 - 56,
Replace the prose-only “Options considered” list in the ADR with a comparison
table covering Options A, B, and C across feasibility, mutation coverage,
operational risk, and other relevant dimensions. Preserve each option’s existing
rationale, and add a caption directly below the table.

Source: Coding guidelines

@codescene-access codescene-access 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.

No quality gates enabled for this code.

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