Repository navigation
Conversation
Adds two jobs: - `collect-affected` runs on push to main and refreshes `target/affected/coverage.db` via `cargo affected collect`. Caches it to actions/cache keyed on `runner.os` + the cargo-affected git rev (resolved at runtime — schema bumps invalidate stale DBs) + the main commit sha. - `affected-tests` runs on PRs as a `continue-on-error` advisory job. Restores the DB with the PR's merge-base as the primary key (tight diff when collect ran on that exact commit) and a prefix restore-keys fallback to the most recent main DB. cargo-affected's "fall back to all tests when selection can't be precise" behavior (max-sixty/cargo-affected@9afb870) means the fallback path always produces a useful run rather than bailing. Comments document the storage rationale and a TODO to gate the full test matrix on merges + labeled PRs once selection accuracy is calibrated. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Apr 29, 2026
`baptiste0928/cargo-install` with no `rev:`/`branch:`/`tag:` already resolves to the default branch's HEAD via `git ls-remote` and exposes the resolved sha as an output — the explicit resolve step was redundant. Drop the resolve step, omit `rev:` from the install (auto-tracks main), and replace the rev component of the DB cache key with a manual `db-v1-` marker. The marker is the hand-bumpable lever for handling on-disk schema changes in cargo-affected; routine upstream commits no longer invalidate the cache. Co-Authored-By: Claude <[email protected]>
cargo-affected now falls back to running all tests when it can't compute a precise selection (no DB, env-fingerprint mismatch, or collect_sha not reachable from HEAD). The skip-on-cache-miss step and the per-step `cache-matched-key != ''` gates were preventing exactly the fallback behavior we want — the cached DB is now an optimization, not a precondition. Removing the gates means an empty/divergent cache produces a useful "run all tests" advisory run instead of a silent skip. The cache restore stays so exact-match merge-base hits still get a tight diff. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Apr 29, 2026
1 of 2 tasks
max-sixty
added a commit
that referenced
this pull request
Apr 30, 2026
## Summary Both `collect-affected` and `affected-tests` (added in #2475) installed the same 7 setup steps — cargo-insta, cargo-nextest, cargo-affected, llvm-tools, rust-cache, apt shells, nushell. Lift them into `.github/actions/affected-setup/action.yaml` so each job replaces the block with one `uses:` line. Pinned tool versions now live in one place. No behavior change — same steps, same order. ## Test plan - [x] `pre-commit run` passes on changed files - [ ] `collect-affected` and `affected-tests` jobs still install the same toolchain in CI 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
This was referenced Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two CI jobs that exercise
cargo affectedagainst this repo as an advisory signal alongside the existing full test matrix.collect-affectedruns on push tomainand onworkflow_dispatch. It builds with coverage instrumentation, runs every test, and writestarget/affected/coverage.dbtoactions/cache.affected-testsruns on PRs ascontinue-on-error: true. It restores the cached DB and runscargo affected run --features shell-integration-tests. Failures don't block merges.Cache strategy
https://github.com/max-sixty/cargo-affectedwith no rev/branch/tag pin —baptiste0928/cargo-installresolves the latest default-branch sha at install time and caches the binary per-resolved-rev.cargo affected runruns all tests with a notice whenever it can't compute a precise selection — Cargo.lock change, divergentcollect_sha, or no DB at all. Soaffected-testsalways produces a useful run, even before the cache is seeded.db-v1-marker. Bump it if cargo-affected ships an on-disk schema change; the cache is otherwise version-agnostic.TODO
Once selection accuracy is calibrated against the full suite, gate the full
test (linux/macos/windows)matrix to run only on pushes to main and on PRs with afull-testslabel (or similar). PR pushes would default to affected-only. The full suite could fold into the existingnightlyworkflow.Periodic full runs remain essential — cargo-affected misses non-Rust inputs (
include_str!, templates, SQL), build-time inputs not in its fingerprint (build.rs,rust-toolchain.toml,.cargo/config.toml), and proc-macro source edits.Test plan
affected-testsrunscargo affected runwhich falls back to all tests via the upstream fix. ~6m28s on this PR vs. 5m31s fortest (linux)— the ~1m delta is install + cargo-affected setup.collect-affectedruns and seeds the cache.affected-testsrestores the cache, exact-match merge-base works, selection is non-empty.cargo affected runruns all tests via the fallback path.🤖 Generated with Claude Code