Repository navigation
fix(cargo-gamma): support binary-only package selections - #241
chinayangxiaowei wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The rollback regression test does not verify that installation reaches the intended second-package failure.
1 open finding
What changed in this PR
Fixes schema convergence for binary-only and mixed Cargo workspaces.
Changes:
- Selects convergence targets based on library availability.
- Adds and restores temporary library targets for mixed workspaces.
- Adds regression tests and updates design documentation.
| File | Description |
|---|---|
crates/cargo-gamma/README.md |
Documents binary-only workspace support. |
crates/cargo-gamma/docs/DESIGN.md |
Describes mixed-workspace convergence. |
crates/cargo-gamma-lib/tests/session.rs |
Adds end-to-end workspace tests. |
crates/cargo-gamma-lib/src/exec/measure.rs |
Passes library metadata to convergence. |
crates/cargo-gamma-lib/src/exec/build/tests.rs |
Tests temporary-library behavior. |
crates/cargo-gamma-lib/src/exec/build/temporary_libraries.rs |
Implements temporary targets and restoration. |
crates/cargo-gamma-lib/src/exec/build.rs |
Selects commands and temporary targets. |
crates/cargo-gamma-lib/src/discover/survey.rs |
Records packages with libraries. |
crates/cargo-gamma-lib/docs/IMPLEMENTATION.md |
Documents implementation details. |
crates/cargo-gamma-lib/docs/DESIGN.md |
Updates the convergence contract. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
a47f1e8 to
2ffd814
Compare
2ffd814 to
8072038
Compare
8072038 to
2ba4e63
Compare
2ba4e63 to
648e9cc
Compare
648e9cc to
5758b27
Compare
Martin Taillefer (geeknoid)
left a comment
There was a problem hiding this comment.
No additional findings in the current selector-only fix. Library presence comes from Cargo target metadata rather than test-harness availability, and the check examines the selected package set. All-binary selections omit --lib; mixed selections keep the existing combined selectors. The synthetic-library/manifests mechanism discussed earlier is gone.
The fixtures cover a binary-only crate, a mixed workspace with a test-enabled dependency feature, a library without a harness, and selecting only the binary member. These are appropriately documented as real-toolchain system acceptance tests rather than assumed unit tests.
All five passes covered metadata collection, preflight-to-converger wiring, target selection, tests, and contracts. Generated README output was excluded as an independent review surface. No builds, tests, or mutation runs were executed.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #241 +/- ##
========================================
- Coverage 98.9% 97.8% -1.1%
========================================
Files 304 118 -186
Lines 44469 18965 -25504
========================================
- Hits 44008 18561 -25447
+ Misses 461 404 -57
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
cargo gamma runcannot complete when every selected package has only binary targets. Schema convergence always runscargo check --lib --bins --tests; Cargo rejects--libwithno library targets found in packagebefore any mutant can be measured. A mixed selection containing at least one library package already works with those selectors.Change
--libwhen every selected package is binary-only.--lib --bins --testscommand for mixed selections. No manifest or source rewrite is needed.Validation
cargo fmt --all -- --checkpassed.--lib --bins --tests --workspacesucceeds, while selecting only its binary package fails withno library targets found.TMPDIR=/private/tmpto avoid the host/varto/private/varpath alias in the existing scratch-directory check.crates/cargo-gamma-lib/docs/design/system-tests.mddesignates the existingtests/session.rscases as real-toolchain acceptance tests. The two new session cases intentionally exercise Cargo's target-selector acceptance and feature unification; scripted command responses cannot establish those properties.This PR contains only the binary-only selection fix and a mixed-workspace regression test. It does not include #240.