fix(anvil): avoid implicit installer auth and cache impact tools - #178
Evgenii (Vaiz) wants to merge 3 commits into
Conversation
Use source-first CI setup for ordinary Rust tools, retain anonymous binary installation for native tools, and strip inherited installer credentials. Cache impact's cargo-delta installation before setup saves and validate warm binary presence. Keep explicit local installers and checked source fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Moderate issues remain in bootstrap replacement and cache-key handling.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This pull request reduces credential exposure in Anvil installations through source-first, cache-aware tool setup.
Changes:
- Adds credential-isolated
ciinstallation and repair logic. - Updates GitHub setup, impact handling, caching, and bootstrapping.
- Refreshes generated artifacts, tests, snapshots, documentation, and lock checksums.
File summaries
| File | Reviewed change |
|---|---|
justfiles/anvil/tools.just |
Generated installer logic |
crates/cargo-anvil/tests/snapshots/snapshots__local_only.snap |
Updated local output snapshot |
crates/cargo-anvil/tests/snapshots/snapshots__github_backend.snap |
Updated GitHub output snapshot |
crates/cargo-anvil/tests/snapshots/snapshots__ado_backend.snap |
Updated ADO output snapshot |
crates/cargo-anvil/tests/recipe_contracts.rs |
Installer and credential-isolation tests |
crates/cargo-anvil/templates/justfiles/anvil/tools.just |
Installer template changes |
crates/cargo-anvil/templates/github/setup-action.yml |
Setup and cache behavior |
crates/cargo-anvil/templates/github/impact-action.yml |
Impact setup integration |
crates/cargo-anvil/src/anvil/artifacts/justfile.rs |
Justfile artifact assertions |
crates/cargo-anvil/src/anvil/artifacts/github.rs |
GitHub artifact assertions |
crates/cargo-anvil/docs/design/README.md |
Installer security documentation |
crates/cargo-anvil/docs/design/local.md |
Local installer documentation |
crates/cargo-anvil/docs/design/github.md |
GitHub setup and cache documentation |
.github/actions/anvil-setup/action.yml |
Generated setup action |
.github/actions/anvil-impact/action.yml |
Generated impact action |
.anvil.lock |
Generated artifact checksums |
Review details
Suppressed comments (2)
crates/cargo-anvil/templates/github/setup-action.yml:94
- This key still omits the group/check/tier recipe files that determine which catalog tools are installed. For example, adding an existing pinned tool to a group without changing
tools.justleaves an exact cache hit; setup installs the missing tool, butif: ... cache-hit != 'true'then prevents saving the repaired cache, so the tool is rebuilt on every run. Hash the generatedjustfiles/anvilrecipe tree in both expressions; the repository already documents that routing determines the installed set (crates/cargo-anvil/src/anvil/artifacts/container.rs:798-803).
key: anvil-v3-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.cargo/config.toml', 'rust-toolchain', 'rust-toolchain.toml', 'justfiles/anvil/versions.just', 'justfiles/anvil/tools.just', '.github/actions/anvil-setup/action.yml') }}-${{ github.job }}
restore-keys: |
anvil-v3-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.cargo/config.toml', 'rust-toolchain', 'rust-toolchain.toml', 'justfiles/anvil/versions.just', 'justfiles/anvil/tools.just', '.github/actions/anvil-setup/action.yml') }}-
crates/cargo-anvil/templates/justfiles/anvil/tools.just:497
- The repair decision is based only on whether a ledger entry was found. If the pinned executable is already on
PATHbut its ledger entry is missing or stale, the early-skip is rejected yet this source install still omits--force, leaving the existing destination to block repair. Include executable presence in the force condition (and cover this stale-ledger case in the fixture).
if ($installed) { $installArgs += '--force' }
- Files reviewed: 15/16 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Remove broad credential cleanup, source-first mode, cache invalidation and save-policy changes, and stale-binary repair. Keep the targeted cargo-delta source install inside impact setup, disable implicit binstall credential discovery, and use pinned binary bootstrap downloads. Make installer fixtures independent of host cargo-binstall availability and retain focused cold, warm, binary-hit and source-fallback coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Address the impact cache persistence issue and correct the documentation step numbering.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (1)
crates/cargo-anvil/templates/github/setup-action.yml:173
- This new branch installs
cargo-deltaafter restoring the cache, but the save step below is skipped wheneversteps.cargo-cache.outputs.cache-hit == 'true'(setup-action.yml:193-195). The previousgroup: noneflow also installed delta only after setup returned, so existing exact impact caches do not contain delta; on those caches this branch recompiles it but never persists the result, causing every impact run to pay the source-install cost. Please invalidate/migrate the old impact cache or arrange a writable cache key for the first source install so the advertised warm reuse can occur.
impact) just anvil-tool-cargo-delta-install install ;;
- Files reviewed: 13/14 changed files
- Comments generated: 1
- Review effort level: Lite
The impact steps were merged from four to three when setup took over the cargo-delta install, but the upload step kept its old ordinal, leaving the list running 1, 2, 4. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
On the suppressed comment about The setup cache key is I am not applying either remedy in this PR. Both candidates — altering the cache key, and changing the save condition from Flagging it for the owner to decide: accept the transitional cost, bump the generation prefix, or keep binstall for delta in the impact group. |
There was a problem hiding this comment.
🔵 Needs a closer look
The impact cache namespace must change so existing caches do not prevent saving the newly installed cargo-delta.
Review details
Suppressed comments (1)
crates/cargo-anvil/templates/github/setup-action.yml:173
- This moves cargo-delta installation before the cache-save step without changing the cache namespace. An exact impact cache created by the previous
group: noneflow can contain no delta because that flow installed delta only after setup's save; on that exact restore, the unchangedcache-hit != 'true'guard skips saving, so the newly installed binary and.crates*metadata are never persisted and each warm impact job rebuilds delta. Bump or otherwise namespace the impact cache key for this migration so the first run can publish the populated cache.
impact) just anvil-tool-cargo-delta-install install ;;
- Files reviewed: 13/14 changed files
- Comments generated: 0 new
- Review effort level: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (97.5%) 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 #178 +/- ##
======================================
Coverage 97.5% 97.5%
======================================
Files 300 300
Lines 69048 69314 +266
======================================
+ Hits 67387 67648 +261
- Misses 1661 1666 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🤖 Clawpilot here! Posted automatically by Clawpilot (an AI agent), not by a human. Please verify before acting.
What this changes
This is the installation alternative to #174, without adding installer token forwarding. Impact setup installs cargo-delta from source before saving the existing Cargo cache.
Details
group: impactselects the existing pinned, locked source installer for cargo-delta. Other groups retain binary-first installation.--no-discover-github-token. They no longer obtain credentials from GitHub CLI or Git configuration.Effects
Validation
Hosted cold installation and warm reuse for the revised head remain unconfirmed.