Skip to content

fix(cargo-anvil): address validation follow-ups - #131

Open
martin-kolinek wants to merge 9 commits into
mainfrom
makolnek/anvil-review-followups
Open

fix(cargo-anvil): address validation follow-ups#131
martin-kolinek wants to merge 9 commits into
mainfrom
makolnek/anvil-review-followups

Conversation

@martin-kolinek

Copy link
Copy Markdown
Collaborator

🤖 Follow-up to #109.

Summary

  • keep MSRV and Cargo-tool prerequisite validation read-only by disabling rustup auto-install and preserving failed cargo install --list diagnostics
  • report the selected stable toolchain and actionable setup command when default-component probing cannot resolve a sysroot
  • replace the two conditional PR Job reusable-workflow callers with one event-aware caller, eliminating the permanently skipped duplicate check

Review follow-ups

Addresses the deferred Copilot findings from:

The single caller intentionally grants statuses: write and pull-requests: write to merge-group runs as well. All write operations remain guarded to same-repository pull_request events.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e
Copilot AI lite review requested due to automatic review settings September 1, 2026 18:13

Copilot AI 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.

Pull request overview

This PR is a follow-up to the stable/MSRV toolchain determinism work in cargo-anvil, tightening validation behavior (keep it read-only and preserve diagnostics) and simplifying the GitHub Actions PR root workflow so PR/merge-queue runs emit a single “PR Job” check context.

Changes:

  • Make MSRV/tool prerequisite validation read-only by disabling rustup auto-install, while preserving and surfacing cargo install --list failure diagnostics.
  • Improve error messaging when sysroot probing can’t resolve the selected stable toolchain (including actionable setup guidance).
  • Replace the duplicated conditional PR/merge-group root workflow callers with one event-aware caller (base SHA selection + conditional status publishing).

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
justfiles/anvil/tools.just Preserve cargo install --list stderr + exit code and emit actionable diagnostics; refine default-toolchain sysroot error.
justfiles/anvil/checks/msrv-test.just Disable RUSTUP_AUTO_INSTALL during MSRV prereq validation and preserve the real cargo exit code.
crates/cargo-anvil/tests/snapshots/snapshots__local_only.snap Update snapshots for the adjusted justfile validation behavior.
crates/cargo-anvil/tests/snapshots/snapshots__github_backend.snap Update snapshots for unified PR root caller and prereq validation changes.
crates/cargo-anvil/tests/snapshots/snapshots__ado_backend.snap Update snapshots for prereq validation and tool checks output.
crates/cargo-anvil/tests/recipe_contracts.rs Extend test harness to log RUSTUP_AUTO_INSTALL, simulate cargo install --list, and add coverage for the new diagnostics.
crates/cargo-anvil/templates/justfiles/anvil/tools.just Keep template in sync with updated tool validation and diagnostics behavior.
crates/cargo-anvil/templates/justfiles/anvil/checks/msrv-test.just Keep template in sync with updated MSRV prereq validation behavior.
crates/cargo-anvil/templates/github/pr-root-workflow.yml Update generated root workflow template to a single event-aware caller.
crates/cargo-anvil/templates/github/pr-impl-workflow.yml Comment updates to reflect root-caller responsibility for permission ceilings.
crates/cargo-anvil/src/anvil/artifacts/github.rs Update assertions validating the generated workflow shape (single caller, conditional status publishing).
crates/cargo-anvil/docs/design/github.md Update design documentation to match the new single-caller workflow model and its tradeoffs.
.github/workflows/anvil-pr.yml Apply the single event-aware caller pattern to the repo’s generated workflow.
.github/workflows/anvil-pr-impl.yml Comment updates consistent with the new caller model; behavior remains guarded by event/repo conditions.
.anvil.lock Refresh checksums to reflect regenerated workflow/justfile artifacts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.6%. Comparing base (cad5174) to head (c53698e).
⚠️ Report is 2 commits behind head on main.

❌ Your project status has failed because the head coverage (97.6%) is below the target coverage (100.0%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #131   +/-   ##
=====================================
  Coverage   97.6%   97.6%           
=====================================
  Files        298     298           
  Lines      67348   67348           
=====================================
+ Hits       65763   65766    +3     
+ Misses      1585    1582    -3     
Flag Coverage Δ
linux 97.6% <ø> (?)
linux-arm 97.6% <ø> (?)
windows 97.7% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e
Copilot AI review requested due to automatic review settings September 2, 2026 09:42
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e

Copilot AI 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.

🟢 Approval recommended

The changes are consistent across sources/templates/snapshots, add targeted regression tests for the validation behavior, and preserve the documented event-guarding for write operations.

Review details
  • Files reviewed: 14/15 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 2, 2026 09:46

Copilot AI 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.

🟢 Approval recommended

The changes are cohesive, covered by targeted regression tests, and the remaining feedback is limited to minor message/wording clarity.

Review details
  • Files reviewed: 14/15 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread crates/cargo-anvil/src/anvil/artifacts/github.rs
Comment thread crates/cargo-anvil/templates/justfiles/anvil/tools.just Outdated
Comment thread justfiles/anvil/tools.just Outdated
Comment thread crates/cargo-anvil/templates/justfiles/anvil/tools.just Outdated
Comment thread crates/cargo-anvil/docs/design/github.md Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e
Copilot AI review requested due to automatic review settings September 3, 2026 11:53
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e

Copilot AI 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.

🔵 Needs a closer look

The new “preserve diagnostics” logic uses Out-String, which can reformat/wrap output and should be adjusted to join lines directly to truly preserve Cargo’s diagnostics.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

crates/cargo-anvil/templates/justfiles/anvil/tools.just:503

  • $listOutput | Out-String can reformat/wrap long lines, which undermines the goal of preserving the original cargo install --list diagnostics. Prefer joining the captured lines directly so the diagnostic text matches what Cargo emitted.
    justfiles/anvil/tools.just:503
  • $listOutput | Out-String can reformat/wrap long lines, which undermines the goal of preserving the original cargo install --list diagnostics. Prefer joining the captured lines directly so the diagnostic text matches what Cargo emitted.
  • Files reviewed: 16/17 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 3, 2026 11:57

Copilot AI 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.

🟢 Approval recommended

The changes preserve the intended security/permission guards while improving validation determinism and diagnostics, and the updated tests/docs/snapshots align with the new behavior.

Review details
  • Files reviewed: 16/17 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Comment thread crates/cargo-anvil/tests/recipe_contracts.rs
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e
Copilot AI review requested due to automatic review settings September 3, 2026 15:47
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e

Copilot AI 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.

🟢 Approval recommended

The changes are consistent across templates/generated outputs, add targeted regression coverage, and keep write operations guarded while removing redundant workflow callers.

Review details
  • Files reviewed: 16/17 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 3, 2026 15:52

Copilot AI 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.

🟡 Changes recommended

The root workflow now grants write-capable GITHUB_TOKEN permissions on merge_group runs, which increases security risk for any repository-controlled commands executed during merge-queue validation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 16/17 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread .github/workflows/anvil-pr.yml
Comment thread crates/cargo-anvil/tests/recipe_contracts.rs Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e
Copilot AI review requested due to automatic review settings September 3, 2026 17:24

Copilot AI 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.

🟡 Changes recommended

The anvil-run-group composite action now withholds GITHUB_TOKEN on non-pull_request events, but it is also used by scheduled workflows where checks like anvil-aprz expect CI to inject a token (to avoid unauthenticated GitHub API rate limiting and potential long blocking).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 18/19 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread crates/cargo-anvil/templates/github/run-group-action.yml Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f7996e6f-5c20-4d7a-b2f7-690af95e557e
Copilot AI review requested due to automatic review settings September 3, 2026 17:45

Copilot AI 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.

🟢 Approval recommended

No correctness, security, or contract-drift issues were identified in the changed scripts/workflows, and the PR updates tests/docs/snapshots in lockstep with the behavior changes.

Review details
  • Files reviewed: 16/17 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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.

3 participants