# Remove redundant Rust compilation from CI Apply this task to one Cargo-based Rust repository at a time. Read its local agent instructions, inspect its CI and the scripts it invokes, preserve unrelated work, and follow its commit policy. Do not push unless explicitly requested. ## Required result Avoid compiling and running the same test suite repeatedly in one CI path, such as running `cargo test` followed by `cargo tarpaulin` when coverage already runs the required tests. Keep one invocation for equivalent work. Comment out redundant commands or stages using the file's native comment syntax, and add a short explanation identifying the retained command that replaces them. The goal is to remove duplicate work, not to force every job into a single Cargo invocation or disable checks with a distinct purpose. ## Implementation 1. Inventory Cargo commands across CI stages, matrix jobs, scripts, and task runners. Follow nested calls so a wrapper does not hide a second test run. Compare each command's purpose, packages, features, targets, toolchain, profile, test selection, environment, and required outputs. 2. Identify genuinely overlapping work. Only disable a command after confirming that the retained invocation covers its required behavior and propagates failures. Do not assume coverage includes every test: inspect unit, integration, documentation, and other project-specific test requirements. 3. Where coverage is only required on the default branch, use mutually exclusive dispatch based on the repository's actual default branch and CI event metadata. For example: ```text if this is a default-branch build (main or master, as configured): run cargo tarpaulin with the repository's required options else: run cargo test with equivalent required test selection ``` Adapt this to the existing coverage tool and branch policy. Do not hardcode both `main` and `master` as default branches. A pull request targeting the default branch is still a pull-request build. Handle detached checkouts, tags, and missing branch metadata explicitly; never silently skip tests. Preserve coverage on pull requests if existing policy requires it, using coverage as their test runner when equivalent. 4. Comment out the superseded unconditional commands or stages. Keep the active branch-specific commands in one clear dispatch or mutually exclusive CI conditions. Avoid empty or invalid stages and unnecessary wrapper layers. Preserve locked dependency resolution and existing test failure behavior; do not fall back to plain tests after a failed coverage run to make CI pass. 5. Review other compilation steps, such as `cargo build`, `cargo check`, and `cargo test --no-run`, for the same duplication. Keep separate steps when they provide required artifacts or distinct validation. Preserve linting, formatting, security, MSRV, feature/target matrices, documentation tests, packaging, and release builds unless their exact obligations are covered. Cache tuning, dependency changes, and coverage-tool migrations are outside this task's scope. 6. Update dependent stages, success summaries, reports, and documentation. Test success must come from the selected runner's successful completion. Preserve coverage thresholds and publication rules; branches that skip coverage must not upload stale reports or claim fresh coverage. Keep required CI status checks satisfied by the selected path. ## Verification - Review the resulting invocation paths, including nested scripts, and confirm each equivalent test suite runs once per selected configuration. - Validate CI/script syntax with the repository's available tooling. Exercise dispatch for default-branch, other-branch, pull-request, tag, and missing metadata cases using lightweight command stubs where practical. - Confirm exactly one intended runner is selected, its failures fail the job, and coverage reports and thresholds are required only on coverage paths. - Run each retained test/coverage path locally where supported, without triggering publication. Verify any separately retained tests and artifacts. Do not add an unconditional duplicate test run as a final verification step. - Inspect the final diff and report which commands were commented out, which retained invocations replace them, the branch policy, checks actually run, and any unavailable CI or platform verification.