test(cargo-gamma): keep runtime fixtures offline - #171
Conversation
Use a dependency-free local runtime stub for feature-preservation tests so metadata resolution does not contact crates.io under network isolation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The changes are localized to test fixtures and directly address the stated offline-CI failure mode without introducing apparent behavioral risk outside the affected tests.
Pull request overview
This PR fixes cargo-gamma CLI integration tests failing under network-isolated CI by ensuring the runtime dependency used in test fixtures does not trigger registry access before cargo-gamma performs its dependency redirection.
Changes:
- Added a local, dependency-free
cargo-gamma-rt“runtime-stub” fixture generator for CLI tests. - Updated the two affected tests to depend on the local stub runtime instead of the repository’s real runtime crate path, preventing
cargo metadatafrom touching crates.io before redirection.
File summaries
| File | Description |
|---|---|
| crates/cargo-gamma-lib/tests/cli.rs | Introduces a local runtime stub and rewires two CLI tests to use it, keeping fixtures offline until cargo-gamma redirects dependencies. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (93.1%) 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 #171 +/- ##
========================================
- Coverage 97.5% 93.1% -4.5%
========================================
Files 300 154 -146
Lines 68538 44178 -24360
========================================
- Hits 66876 41155 -25721
- Misses 1662 3023 +1361
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:
|
Problem
Build 40731154 introduced two cargo-gamma CLI tests that create temporary workspaces pointing at the repository's real
cargo-gamma-rtmanifest. Before cargo-gamma can redirect that dependency,cargo metadataresolves its workspace-inheritedloomdependency and contactsindex.crates.io. The official pipeline enforces network isolation, so both tests fail; the missing clippy SARIF and Rust evidence directories are downstream symptoms.Fix
Use a dependency-free local
cargo-gamma-rtstub as the fixture's pre-redirect dependency. The stub declaresembeddingbut deliberately omitsgamma_rt::embedded, preserving the test's proof: it succeeds only if cargo-gamma redirects to the real vendored runtime and retains the feature.Verification
CARGO_NET_OFFLINE=trueCARGO_NET_OFFLINE=truecargo-gamma-libnextest suite passes (1,948 tests)