From 22a20242519ae6b52fb637f43bc2d0f9226b3651 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Mon, 5 Oct 2026 00:58:12 +0200 Subject: [PATCH] Add Rust redundant compilation cleanup task --- README.md | 3 + ...rust-redundant-compilation-cleanup.task.md | 81 +++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 tasks/rust-redundant-compilation-cleanup.task.md diff --git a/README.md b/README.md index 8954446..c3a5dd8 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,9 @@ metadata, and commit conventions. a safe `rust_realease` wrapper. - [`readme-cleanup.task.md`](tasks/readme-cleanup.task.md) streamlines a README, links advanced documentation, and verifies CI-backed badges. +- [`rust-redundant-compilation-cleanup.task.md`](tasks/rust-redundant-compilation-cleanup.task.md) + comments out redundant Rust CI commands and selects test or coverage runs + by branch where appropriate. - [`semi-harden-ci.task.md`](tasks/semi-harden-ci.task.md) adds focused Rust dependency security and policy gates. diff --git a/tasks/rust-redundant-compilation-cleanup.task.md b/tasks/rust-redundant-compilation-cleanup.task.md new file mode 100644 index 0000000..740e811 --- /dev/null +++ b/tasks/rust-redundant-compilation-cleanup.task.md @@ -0,0 +1,81 @@ + + + +# 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.