Skip to content

test: speed make coverage-rust via profile align and parallel acceptance - #391

Merged
DecisionNerd merged 1 commit into
mainfrom
test/388-coverage-rust-speed
Aug 4, 2026
Merged

DecisionNerd merged 1 commit into
mainfrom
test/388-coverage-rust-speed

Conversation

@DecisionNerd

@DecisionNerd DecisionNerd commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Align core cargo llvm-cov with instrumented release profile.
  • Parallelize Python ‖ Node acceptance and binding tests/*.py after hash checks.
  • HTML opt-in (COVERAGE_RUST_HTML=1); fail-closed resume stamps (COVERAGE_RUST_RESUME=1).
  • Add coverage-rust script policy sentinel; do not put full coverage into PR CI.

Closes #388.

Test plan

  • make pre-push-fast
  • bash scripts/ci/test-coverage-rust.sh
  • uv run --no-sync python scripts/ci/test-rust-coverage-ledger.py
  • CI Gate green
  • Wall-clock evidence when a full local run is feasible (isolated target vanished mid-compile in one attempt; floors unchanged)

BDD evidence

  • Profile align: core llvm-cov uses --release; ledger floors still enforced by existing ledger tests.
  • Parallel acceptance: Python/Node and binding *.py parallelized in scripts/coverage-rust.sh.

Made with Cursor


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Note

Speed up Rust coverage via parallel acceptance, resume stamps, and profile alignment

  • scripts/coverage-rust.sh now runs Python and Node acceptance phases in parallel, with per-phase stamp files enabling resume (COVERAGE_RUST_RESUME=1) to skip already-completed phases when outputs match.
  • Core coverage runs with --release by default; the HTML report is opt-in via COVERAGE_RUST_HTML=1 to avoid unnecessary output.
  • Per-phase timing is recorded to build/coverage-rust/timing.log; Python binding tests run per-file in parallel via xargs -P with a configurable PYTHON_BINDING_WORKERS count, and the phase fails fast if no binding tests are found.
  • A new CI policy script scripts/ci/test-coverage-rust.sh is added and wired into the pre-push Makefile target; it validates that coverage-rust.sh contains required commands and that GitHub workflows do not invoke Rust coverage directly.

Macroscope summarized 32654a9.

Summary by CodeRabbit

  • New Features

    • Added resumable Rust coverage runs with configurable HTML reporting, release mode, worker count, and timing options.
    • Improved coverage artifact validation and phase progress reporting.
    • Added concurrent Python and Node acceptance-test coverage.
  • Bug Fixes

    • Improved failure handling when acceptance tests or coverage steps fail.
  • Tests

    • Added automated validation for Rust coverage workflow policies.
    • Rust coverage checks now run during pre-push validation.
  • Documentation

    • Documented Rust coverage resume and HTML-report configuration options.

Align core llvm-cov with the release adapter profile and run independent acceptance lanes concurrently while retaining verified artifact and coverage evidence. Add fail-closed resume stamps and opt-in HTML so repeat local runs preserve floor and ledger integrity without adding full coverage to PR CI.

The runner records same-SHA per-phase timings in build/coverage-rust/timing.log; an A/B full-run ledger was not captured in this change because the prior run can exceed the local execution window.

Closes #388

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The Rust coverage runner now supports resumable stamped phases, optional HTML output, release-mode coverage, parallel Python and Node acceptance tests, and timing records. A strict validator runs during pre-push and checks the runner and CI wiring.

Changes

Rust coverage workflow

Layer / File(s) Summary
Runner configuration and resumable phases
scripts/coverage-rust.sh
The runner validates configuration flags, manages stamped outputs and timings, uses release-mode core coverage, and supports resumable native builds.
Parallel acceptance execution
scripts/coverage-rust.sh
Python and Node acceptance phases run concurrently with separate profiles and resume stamps.
Coverage validation and pre-push wiring
Makefile, scripts/ci/test-coverage-rust.sh
The Makefile documents coverage options and runs the strict validator during pre-push. The validator checks required runner commands and CI restrictions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant coverage_rust.sh
  participant cargo_llvm_cov
  participant native_adapters
  participant Python_acceptance
  participant Node_acceptance
  coverage_rust.sh->>cargo_llvm_cov: run release-mode core coverage
  cargo_llvm_cov-->>coverage_rust.sh: produce coverage outputs
  coverage_rust.sh->>native_adapters: build or resume stamped artifacts
  native_adapters-->>coverage_rust.sh: return validated artifacts
  coverage_rust.sh->>Python_acceptance: start instrumented acceptance phase
  coverage_rust.sh->>Node_acceptance: start instrumented acceptance phase
  Python_acceptance-->>coverage_rust.sh: return phase status
  Node_acceptance-->>coverage_rust.sh: return phase status
Loading

Possibly related issues

Possibly related PRs

Suggested labels: ci-cd, tooling, core

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes implement the linked issue's coding objectives for profile alignment, parallel coverage phases, opt-in HTML, resume stamps, and PR CI scope.
Out of Scope Changes check ✅ Passed The Makefile, coverage script, and policy test changes are directly related to the linked issue's coverage performance and validation objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly identifies the main change: speeding up Rust coverage through profile alignment and parallel acceptance tests.
Description check ✅ Passed The description clearly states the scope, testing, issue reference, evidence, and pending checks, although it omits several template sections.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/388-coverage-rust-speed

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

@github-actions github-actions Bot added the tooling Developer tooling and automation label Aug 4, 2026
@DecisionNerd
DecisionNerd merged commit ba4181d into main Aug 4, 2026
17 of 18 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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 `@scripts/ci/test-coverage-rust.sh`:
- Around line 20-23: Update the ripgrep pattern in the CI coverage check to
match “make pre-push” only when it is a complete command, requiring a command
boundary after `pre-push`; continue rejecting coverage and exact `make pre-push`
references while allowing `make pre-push-fast`.

In `@scripts/coverage-rust.sh`:
- Around line 134-143: Update the native-artifacts stamp handling around
stamp_matches and write_stamp to include the generated Python and Node native
artifact paths. Ensure stamp_matches validates that both artifacts exist and
their hashes match the recorded values before resuming; otherwise rerun both
build commands and record the artifacts with write_stamp.
- Around line 214-232: Update the unmatched resume branches around the Python
and Node acceptance phases to remove that phase’s existing raw profiles and
merged profile before launching its rerun. Ensure the Python branch cleans only
Python artifacts and the Node branch cleans only Node artifacts, while leaving
the matching-stamp resume paths unchanged.
🪄 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

Run ID: 83910e59-65bb-455b-81e4-ac78467b3d6a

📥 Commits

Reviewing files that changed from the base of the PR and between c1e814b and 32654a9.

📒 Files selected for processing (3)
  • Makefile
  • scripts/ci/test-coverage-rust.sh
  • scripts/coverage-rust.sh

Comment on lines +20 to +23
if rg -n --glob '*.{yml,yaml}' 'coverage-rust|make coverage|make pre-push' "$ROOT/.github"; then
echo "Rust coverage must remain outside PR CI" >&2
exit 1
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not reject make pre-push-fast.

The make pre-push alternative also matches make pre-push-fast. That target explicitly excludes coverage, so it is valid for PR CI.

Require a command boundary after pre-push.

Proposed fix
-if rg -n --glob '*.{yml,yaml}' 'coverage-rust|make coverage|make pre-push' "$ROOT/.github"; then
+if rg -n --glob '*.{yml,yaml}' \
+  'coverage-rust|make coverage([[:space:]]|$)|make pre-push([[:space:]]|$)' \
+  "$ROOT/.github"; then
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if rg -n --glob '*.{yml,yaml}' 'coverage-rust|make coverage|make pre-push' "$ROOT/.github"; then
echo "Rust coverage must remain outside PR CI" >&2
exit 1
fi
if rg -n --glob '*.{yml,yaml}' \
'coverage-rust|make coverage([[:space:]]|$)|make pre-push([[:space:]]|$)' \
"$ROOT/.github"; then
echo "Rust coverage must remain outside PR CI" >&2
exit 1
fi
🤖 Prompt for 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.

In `@scripts/ci/test-coverage-rust.sh` around lines 20 - 23, Update the ripgrep
pattern in the CI coverage check to match “make pre-push” only when it is a
complete command, requiring a command boundary after `pre-push`; continue
rejecting coverage and exact `make pre-push` references while allowing `make
pre-push-fast`.

Comment thread scripts/coverage-rust.sh
Comment on lines +134 to +143
native_input="$(printf '%s\n' "$CORE_COVERAGE_ARGS" "$COVERAGE_ENV" | shasum -a 256)"
if stamp_matches native-artifacts "$native_input"; then
echo "Resuming verified native artifact build"
else
phase_started=$SECONDS
uv run maturin develop --release -m crates/graphforge-bindings-py/Cargo.toml
pnpm --filter @curatelabs/graphforge exec napi build --platform --release
write_stamp native-artifacts "$native_input"
record_timing native-artifacts "$phase_started"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Validate native artifacts before resuming the phase.

stamp_matches receives no output paths for native-artifacts. The stamp therefore remains valid when the built artifacts are missing or replaced.

Record the Python and Node artifacts in this stamp. Require both files to exist and match their recorded hashes before the runner skips the builds.

🤖 Prompt for 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.

In `@scripts/coverage-rust.sh` around lines 134 - 143, Update the native-artifacts
stamp handling around stamp_matches and write_stamp to include the generated
Python and Node native artifact paths. Ensure stamp_matches validates that both
artifacts exist and their hashes match the recorded values before resuming;
otherwise rerun both build commands and record the artifacts with write_stamp.

Comment thread scripts/coverage-rust.sh
Comment on lines +214 to +232
if stamp_matches python-acceptance "$python_input" "${PROFILE_DIR}"/python-*.profraw; then
echo "Resuming verified Python native acceptance"
else
(
phase_started=$SECONDS
run_python_acceptance
write_stamp python-acceptance "$python_input" "${PROFILE_DIR}"/python-*.profraw
record_timing python-acceptance "$phase_started"
) &
python_pid=$!
fi
if stamp_matches node-acceptance "$node_input" "${PROFILE_DIR}"/node-*.profraw; then
echo "Resuming verified Node native acceptance"
else
(
phase_started=$SECONDS
run_node_acceptance
write_stamp node-acceptance "$node_input" "${PROFILE_DIR}"/node-*.profraw
record_timing node-acceptance "$phase_started"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Remove invalid phase profiles before an acceptance rerun.

When a resume stamp does not match, the runner keeps existing python-*.profraw or node-*.profraw files. The new processes create different filenames. The ledger can then reject stale profiles that predate the current artifact.

Remove only the affected phase profiles and merged profile before starting that phase.

Proposed fix
 else
   (
     phase_started=$SECONDS
+    rm -f "$PROFILE_DIR"/python-*.profraw "$OUT_DIR/python.profdata"
     run_python_acceptance
     write_stamp python-acceptance "$python_input" "${PROFILE_DIR}"/python-*.profraw
     record_timing python-acceptance "$phase_started"
@@
 else
   (
     phase_started=$SECONDS
+    rm -f "$PROFILE_DIR"/node-*.profraw "$OUT_DIR/node.profdata"
     run_node_acceptance
     write_stamp node-acceptance "$node_input" "${PROFILE_DIR}"/node-*.profraw
     record_timing node-acceptance "$phase_started"
🤖 Prompt for 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.

In `@scripts/coverage-rust.sh` around lines 214 - 232, Update the unmatched resume
branches around the Python and Node acceptance phases to remove that phase’s
existing raw profiles and merged profile before launching its rerun. Ensure the
Python branch cleans only Python artifacts and the Node branch cleans only Node
artifacts, while leaving the matching-stamp resume paths unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tooling Developer tooling and automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: speed make coverage-rust via profile align and parallel acceptance

1 participant