Skip to content

ci(affected): update cache-strategy comment to match post-#9 behavior - #2520

Merged
max-sixty merged 5 commits into
mainfrom
ci-cargo-affected-cache-comment
May 2, 2026
Merged

max-sixty merged 5 commits into
mainfrom
ci-cargo-affected-cache-comment

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Comment-only follow-up to #2517 and the cargo-affected sibling-reachable change (max-sixty/cargo-affected#9). The cache-strategy comment in the workflow still described the old "fallback widens to all tests" semantics; it now describes the current behavior — sibling collect_shas drive normal selection, full-suite widening fires only when no cache exists at all.

🤖 Generated with Claude Code

max-sixty and others added 2 commits April 30, 2026 20:24
cargo-affected leaves per-collect profraw bundles in
`target/affected/profraw-<PID>/` (~5 GB on this repo). Caching the
parent dir ships those into the GitHub Actions cache, where a single
collect saturates the 10 GB repo cap and evicts every other cache —
so PRs miss both the exact-match and prefix-fallback restore keys and
fall back to running the full suite.

Narrow both save and restore to `target/affected/coverage.db` (~225 MB).
Cleaning up the profraw bundles themselves is a separate follow-up in
cargo-affected; until then this keeps the cached payload small enough
for multiple collects to coexist.

Co-Authored-By: Claude <[email protected]>
cargo-affected #9 (treat sibling shas as reachable) and #8 (drop
profraw dir post-collect) changed both halves of the contract this
comment described. Refresh the comment so the next reader sees the
current behavior: cache only the DB, fallback restores never widen
to "run everything" unless the cache is missing entirely.

Co-Authored-By: Claude <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The top-level cache-strategy block now matches post-#9 behavior, but the inline comment on the restore step still asserts "cargo-affected runs all tests when collect_sha isn't an ancestor of HEAD" — that's the same pre-#9 wording the new block is correcting. See inline note for a proposed update.

Comment thread .github/workflows/ci.yaml Resolved
max-sixty and others added 3 commits May 1, 2026 18:04
Swatinem/rust-cache@v2's restore step calls `cleanTargetDir` on the
workspace's `target/` whenever its own cache hit is a prefix-only match
(common — its key is partly content-hashed, so non-trivial PR diffs
miss the exact key). `cleanTargetDir` recursively cleans every directory
under `target/`, deleting file children — including a `coverage.db` we
just dropped at `target/affected/coverage.db` from the actions/cache
restore that ran moments earlier.

Net effect: cargo-affected's DB was being wiped between restore and
read on every prefix-match rust-cache hit. End-to-end this looks like
"cache restored successfully" followed by "no coverage data yet —
running all tests" — selection silently disabled.

Move the actions/cache restore to AFTER `./.github/actions/test-setup`
(which is where rust-cache lives). rust-cache populates target/ first,
we drop the DB on top, nothing else touches `target/affected/` after
that point.

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit d93a65a into main May 2, 2026
27 checks passed
@max-sixty
max-sixty deleted the ci-cargo-affected-cache-comment branch May 2, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants