Skip to content

ci: keep coverage-instrumented build between runs - #4296

Merged
QuantumExplorer merged 3 commits into
v4.2-devfrom
claude/keep-llvm-cov-target
Aug 5, 2026
Merged

ci: keep coverage-instrumented build between runs#4296
QuantumExplorer merged 3 commits into
v4.2-devfrom
claude/keep-llvm-cov-target

Conversation

@QuantumExplorer

@QuantumExplorerQuantumExplorer commented Aug 5, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Every Rust workspace test job cold-compiles ~700 crates (668 external dependencies from proc-macro2 up, plus 37 workspace crates) before running a single test — ~2.5 minutes of the ~4.5-minute test step. Analysis of a recent run showed why: the coverage-instrumented build lives in target/llvm-cov-target (10GB), and it was unconditionally deleted twice per run — by the end-of-job "Remove cargo-llvm-cov build artifacts" step and again by the stale-artifact loop at job start. The wallet fast-path job's loop could also wipe it from the shared runner workspace on wallet-only PRs.

These deletions date from when the runners were tight on disk (#3667). They're redundant now: the "Prune runner disk before tests" size guard already removes the whole target/ when it exceeds the caps, and current numbers are ~23GB total against a 120GB cap with 178GB free.

What was done?

  • Removed target/llvm-cov-target from the stale-artifact prune loops in both tests-rs-workspace.yml and tests-rs-wallet.yml, with comments explaining why it must be kept.
  • Replaced the end-of-job full-directory deletion with a profile-data-only cleanup (*.profraw/*.profdata — the per-run droppings, one profraw per test process, regenerated every run).
  • Added the same profile-data purge to the "Remove stale coverage data" step at the start of the test phase, so a cancelled run whose always() cleanup never executed cannot leak stale profraw into the next run's coverage report. (The old design was immune to this by wiping the whole directory at start; the new design is immune via the start-of-run purge.)

With the instrumented build retained, cargo's fingerprinting recompiles only the crates a PR actually touches, cutting ~2–2.5 minutes off every Rust workspace job. Combined with the shielded coverage cache (#4293), a typical unrelated Rust PR's job should drop from ~13 minutes to roughly 3.5–4 minutes.

How Has This Been Tested?

  • Measured the current cost from run 30988040607: 705 Compiling lines (668 external deps — a full cold build), ~2m27s compile before the first test executed, 117s of actual test execution.
  • Verified the disk math from the same run's logs: target/ 13GB + llvm-cov-target 10GB ≈ 23GB, against a 120GB cap and 178GB free on mac-runner-2.
  • Both workflows pass YAML validation and actionlint (only pre-existing style notes remain).
  • First run after merge is still cold (the cache doesn't exist yet); the speedup shows from the second run per runner onward.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved macOS wallet and workspace test workflow cleanup.
    • Preserved reusable coverage build artifacts during routine cleanup to streamline test runs.
    • Continued enforcing disk-space safeguards that remove build data when necessary.
    • Enhanced cleanup of temporary coverage files before and after tests.

Every Rust workspace job cold-compiled ~700 crates (~2.5 min) because
target/llvm-cov-target was unconditionally deleted twice per run: by
the end-of-job cleanup and by the stale-artifact loop at job start
(and the wallet job's loop could wipe it from the shared runner
workspace on wallet-only PRs). Those deletions predate the
size/free-disk guard, which already removes the whole target/ when it
exceeds the caps — currently ~23GB against a 120GB cap with 178GB
free, so unconditional pruning is redundant.
Keep the instrumented build and remove only per-run profile data
(profraw/profdata) at end of job, plus the same purge at the start of
the test phase so a cancelled run whose cleanup never executed cannot
leak stale profraw into the next run's coverage report.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actionsgithub-actionsBot added this to the v4.2.0 milestone Aug 5, 2026
@coderabbitai

coderabbitaiBot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@QuantumExplorer, you've reached your PR review limit, so we couldn't start this review.

Next review available in:21 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ceb4d16-59ea-465b-8f4b-ab92be1a595a

📥 Commits

Reviewing files that changed from the base of the PR and between c09678d and 104d85e.

📒 Files selected for processing (2)
  • .github/workflows/tests-rs-wallet.yml
  • .github/workflows/tests-rs-workspace.yml
📝 Walkthrough

Walkthrough

The workflows now preserve target/llvm-cov-target during routine cleanup. They remove stale .profraw and .profdata files and retain disk-pressure safeguards that can delete the full target/ directory.

Changes

Coverage cleanup workflows

Layer / File(s)Summary
Preserve the instrumented target
.github/workflows/tests-rs-wallet.yml, .github/workflows/tests-rs-workspace.yml
Routine cleanup no longer removes target/llvm-cov-target. Disk-pressure guards can still remove target/.
Clean coverage files
.github/workflows/tests-rs-workspace.yml
Coverage cleanup removes stale .profraw and .profdata files. Final cleanup retains the instrumented directory and reports its size.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers:vivekgsharma

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedThe title clearly and concisely describes retaining the coverage-instrumented build between CI runs.
Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes check✅ PassedCheck skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/keep-llvm-cov-target

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecovBot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.78%. Comparing base (347025f) to head (104d85e).

Additional details and impacted files
@@ Coverage Diff @@## v4.2-dev #4296 +/- ##
============================================
+ Coverage 87.60% 87.78% +0.17% 
============================================
Files 2703 2677 -26 Lines 344985 342371 -2614 ============================================
- Hits 302238 300548 -1690 + Misses 42747 41823 -924 
ComponentsCoverage Δ
dpp88.83% <ø> (+<0.01%)⬆️
drive86.25% <ø> (ø)
drive-abci89.66% <ø> (+<0.01%)⬆️
sdk∅ <ø> (∅)
dapi-client∅ <ø> (∅)
platform-version∅ <ø> (∅)
platform-value92.88% <ø> (ø)
platform-wallet∅ <ø> (∅)
drive-proof-verifier48.02% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitaicoderabbitaiBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/tests-rs-workspace.yml:
- Around line 236-245: Purge *.profraw and *.profdata files from
target/llvm-cov-target before either disk-prune guard, independently of the
coverage-cache reuse result. In
.github/workflows/tests-rs-workspace.yml#L236-L245, move the profile-only find
cleanup ahead of disk pruning and remove its reuse dependency; in
.github/workflows/tests-rs-wallet.yml#L54-L62, add the same cleanup before the
wallet disk-prune step.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 28b7b481-eacb-4a4f-9be8-acf329488f7f

📥 Commits

Reviewing files that changed from the base of the PR and between 347025f and c09678d.

📒 Files selected for processing (2)
  • .github/workflows/tests-rs-wallet.yml
  • .github/workflows/tests-rs-workspace.yml

Comment thread.github/workflows/tests-rs-workspace.yml Outdated
QuantumExplorerand others added 2 commits August 5, 2026 16:29
Review follow-up: stale profraw/profdata from a cancelled run were
purged only after the disk guard had already measured target/, so they
could inflate the size check and cost the whole instrumented build.
Move the purge into the prune step of both Rust workflows,
unconditionally and ahead of the du measurement, and drop the now
redundant reuse-gated purge from the stale-coverage step.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The install steps redirected stderr to /dev/null and swallowed the
exit code, so a failed nextest install on a freshly provisioned runner
passed silently and the job died later in the test step with "no such
command: nextest". Install only when the tool is missing and assert it
runs afterwards, so a provisioning problem fails at the step that owns
it with the real error visible.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@QuantumExplorer
QuantumExplorer merged commit 5bbd7c9 into v4.2-devAug 5, 2026
28 of 29 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/keep-llvm-cov-target branch August 5, 2026 10:06
Sign up for freeto 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.

1 participant

@QuantumExplorer