Skip to content

Pass --locked to the cargo-mutants install fallback (#364) - #377

Open
leynos wants to merge 1 commit into
mainfrom
fix/mutation-cargo-binstall-locked
Open

Pass --locked to the cargo-mutants install fallback (#364)#377
leynos wants to merge 1 commit into
mainfrom
fix/mutation-cargo-binstall-locked

Conversation

@leynos

@leynos leynos commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

cargo binstall falls back to a source build when no prebuilt binary matches
the runner. The Install cargo-mutants step ran binstall without --locked,
so that fallback resolved cargo-mutants' dependency tree to the newest
permitted versions and pulled in a transitive crate whose MSRV exceeded the
pinned nightly toolchain — cargo-platform 0.3.3 requiring rustc 1.91 broke a
scheduled run against nightly-2025-06-26, failing the install before any
mutant ran.

This adds --locked to both binstall invocations. cargo-binstall forwards
--locked to the source-build fallback, which then resolves against
cargo-mutants' committed Cargo.lock and stays reproducible on the pinned
toolchain. This mirrors the existing cargo-nextest install in the
generate-coverage action, which already passes --locked.

Design note

Two options were considered: (a) add --locked, or (b) disable the compile
strategy (--disable-strategies compile) and fail fast when no prebuilt binary
exists. Option (a) is chosen: it keeps the resilient source-build fallback
working (so a runner without a matching prebuilt binary still installs) while
removing the MSRV-drift failure mode, and it matches the established pattern in
this repo. Failing fast would trade a latent fragility for a hard outage
whenever a prebuilt binary is briefly unavailable.

Closes #364.

Review walkthrough

  • .github/workflows/mutation-cargo.ymlcargo binstall --no-confirm --locked
    in both branches of Install cargo-mutants, with an explanatory comment.
  • workflow_scripts/tests/test_mutation_workflow_shape.py — new invariant
    test_cargo_mutants_install_is_locked.

Validation

  • pytest workflow_scripts/tests/test_mutation_workflow_shape.py — 5 passed.
  • ruff format --check / ruff check — clean.

Note for maintainers

The axinite sweep noted a cargo-nextest fallback missing --locked. In
shared-actions the nextest install (generate-coverage/scripts/install_cargo_nextest.py)
already passes --locked, so any remaining gap is in a caller repository, not
here.

…pinned (#364)

cargo binstall falls back to a source build when no prebuilt binary matches
the runner. Without --locked that build resolves cargo-mutants' dependency
tree to the newest permitted versions and can pull in a transitive crate
whose MSRV exceeds the pinned nightly toolchain (cargo-platform 0.3.3 needing
rustc 1.91 broke a run against nightly-2025-06-26), failing the install
before any mutant runs.

Add --locked to both binstall invocations; it is forwarded to the source
build, which then honours cargo-mutants' committed Cargo.lock. This mirrors
the cargo-nextest install in the generate-coverage action. Pin a shape-test
invariant that the install passes --locked.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

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

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: aa42c71e-6987-4948-a298-7c382a711d5e

📥 Commits

Reviewing files that changed from the base of the PR and between 074f7d8 and da40201.

📒 Files selected for processing (2)
  • .github/workflows/mutation-cargo.yml
  • workflow_scripts/tests/test_mutation_workflow_shape.py
🔗 Linked repositories identified

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

  • leynos/polythene (auto-detected)

Summary

  • Added --locked to both cargo binstall cargo-mutants commands, ensuring source-build fallbacks use the committed lockfile and remain compatible with the pinned nightly toolchain.
  • Added explanatory workflow comments and a shape test enforcing the locked installation behaviour.
  • Addresses issue #364 while retaining the source-build fallback.

Validation

  • 5 workflow-shape tests passed.
  • Ruff formatting and lint checks passed.

Walkthrough

Update the mutation workflow to pass --locked through both cargo binstall paths, document the fallback behaviour, and add a test that enforces the flag for every matching installation step.

Changes

Mutation tool installation

Layer / File(s) Summary
Lock installation and validate workflow
.github/workflows/mutation-cargo.yml, workflow_scripts/tests/test_mutation_workflow_shape.py
Pass --locked to both cargo-mutants installation paths and assert that every matching cargo binstall invocation includes the flag.

Possibly related issues

  • leynos/axinite#288 — Addresses similar cargo-binstall source-build fallback behaviour requiring locked dependency resolution.

Possibly related PRs

  • leynos/corbusier#141 — Updates GitHub Actions cargo binstall commands to use --locked and adds a locked installation fallback.

Suggested labels: Issue

Poem

Lock the crates, the night stays bright,
No drifting versions sneak from sight.
Binstall builds with anchors tight,
Tests guard the workflow’s flight.
Rusty gears now turn just right.

🚥 Pre-merge checks | ✅ 19 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Developer Documentation ⚠️ Warning The workflow now depends on a locked cargo-binstall source-build fallback, but docs/developers-guide.md and the execplan never mention this tooling requirement. Document the cargo-mutants install contract in docs/developers-guide.md and record the --locked decision in the mutation-workflows execplan or an ADR.
✅ Passed checks (19 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the change and includes the linked issue reference (#364).
Description check ✅ Passed The description is clearly about locking the cargo-mutants install fallback and matches the workflow and test changes.
Linked Issues check ✅ Passed The PR passes --locked to cargo-binstall in both paths, preserving source-build fallback and addressing the MSRV drift in #364.
Out of Scope Changes check ✅ Passed The changes stay within scope: workflow hardening and a shape test for the same install behaviour.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Testing (Overall) ✅ Passed PASS: the new workflow-shape test parses mutation-cargo.yml and asserts each cargo-binstall invocation contains --locked, so it fails on the intended regression.
User-Facing Documentation ✅ Passed Keep this as an internal workflow fix; no user-facing API or usage changed, and the existing mutation workflow guide already covers the reusable workflow.
Module-Level Documentation ✅ Passed Keep the touched Python module docstring: it states the workflow shape-test purpose and ties it to .github/workflows.
Testing (Unit And Behavioural) ✅ Passed The new shape test parses the workflow YAML and asserts both cargo-binstall branches include --locked, so it verifies the workflow boundary and a real invariant.
Testing (Property / Proof) ✅ Passed Treat this as a fixed workflow-shape invariant: the test asserts two concrete cargo-binstall calls in one YAML file, not a range of inputs or transitions.
Testing (Compile-Time / Ui) ✅ Passed Treat the rule as not applicable: only workflow YAML and a Python shape test changed; no Rust/TypeScript compile-time or UI surface is introduced.
Unit Architecture ✅ Passed The change keeps the side-effecting install in the workflow command step and adds a read-only shape test, so boundaries and dependencies remain clear.
Domain Architecture ✅ Passed PASS: the patch stays in CI workflow and workflow-shape tests; it adds no domain models, repositories, or transport/persistence logic.
Observability ✅ Passed Treat this as PASS: the PR only hardens an install step and adds a shape test; it adds no new operational path needing extra observability.
Security And Privacy ✅ Passed The patch only adds --locked to an existing install command and a shape test; it introduces no secrets, permission changes, or unsafe input handling.
Performance And Resource Use ✅ Passed PASS: The new test does one bounded parse of a single workflow file and scans small job/step lists; the workflow tweak only adds --locked, with no hot-path work.
Concurrency And State ✅ Passed No shared state, async work, locks, ordering, or cancellation paths were introduced; the PR only adds a workflow flag and a shape test.
Architectural Complexity And Maintainability ✅ Passed PASS: The patch is a small workflow flag change plus one focused shape test; it adds no new layers, registries, or dependencies, and reuses the existing workflow-test module.
Rust Compiler Lint Integrity ✅ Passed PASS: the PR touches only a YAML workflow and a Python shape test, so it introduces no Rust lint suppressions or clone churn.
✨ 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 fix/mutation-cargo-binstall-locked

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

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 26, 2026 22:46

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

@pandalump

Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
✅ 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 added the Issue label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo binstall cargo-mutants falls back to a source build that fails against the pinned nightly toolchain

2 participants