From a1f0208956370c2422e599e60390b325846097e8 Mon Sep 17 00:00:00 2001 From: Illia Polosukhin Date: Thu, 5 Mar 2026 01:44:03 +0000 Subject: [PATCH] fix(ci): persist all cargo-llvm-cov env vars for E2E coverage (#559) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ci): persist all cargo-llvm-cov env vars for E2E coverage Newer cargo-llvm-cov versions output CARGO_ENCODED_RUSTFLAGS instead of RUSTFLAGS from show-env. The workflow was cherry-picking specific vars (RUSTFLAGS, LLVM_PROFILE_FILE, etc.) to persist to $GITHUB_ENV, so CARGO_ENCODED_RUSTFLAGS was never set during the build step, producing a non-instrumented binary and zero .profraw files. Replace the manual echo lines with `cargo llvm-cov show-env >> $GITHUB_ENV` to forward all vars (including CARGO_ENCODED_RUSTFLAGS, CARGO_INCREMENTAL, etc.) regardless of cargo-llvm-cov version. Also forward CARGO_ENCODED_RUSTFLAGS in the E2E conftest subprocess env. [skip-regression-check] Co-Authored-By: Claude Opus 4.6 * fix(ci): address PR review — prefix-based env forwarding, split clean step - conftest.py: replace explicit env var list with prefix-based matching (CARGO_LLVM_COV*, LLVM_*) plus specific vars (CARGO_ENCODED_RUSTFLAGS, CARGO_INCREMENTAL) to stay resilient to cargo-llvm-cov changes. - coverage.yml: move `cargo llvm-cov clean` to its own step so the env vars from show-env (persisted via $GITHUB_ENV) are active when clean runs. [skip-regression-check] Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- .github/workflows/coverage.yml | 15 +++++++-------- tests/e2e/conftest.py | 11 ++++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 87080d72..7bacd26e 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -102,14 +102,13 @@ jobs: - name: Set up coverage instrumentation run: | - source <(cargo llvm-cov show-env --export-prefix) - # Persist env vars for subsequent steps - echo "RUSTFLAGS=${RUSTFLAGS}" >> "$GITHUB_ENV" - echo "LLVM_PROFILE_FILE=${LLVM_PROFILE_FILE}" >> "$GITHUB_ENV" - echo "CARGO_LLVM_COV=1" >> "$GITHUB_ENV" - echo "CARGO_LLVM_COV_SHOW_ENV=1" >> "$GITHUB_ENV" - echo "CARGO_LLVM_COV_TARGET_DIR=${CARGO_LLVM_COV_TARGET_DIR}" >> "$GITHUB_ENV" - cargo llvm-cov clean --workspace + # Append ALL env vars from show-env (including CARGO_ENCODED_RUSTFLAGS, + # CARGO_INCREMENTAL, LLVM_PROFILE_FILE, etc.) so the build step + # compiles an instrumented binary regardless of cargo-llvm-cov version. + cargo llvm-cov show-env >> "$GITHUB_ENV" + + - name: Clean coverage workspace + run: cargo llvm-cov clean --workspace - name: Build instrumented binary run: cargo build --no-default-features --features libsql diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py index 23a16657..41a9fd29 100644 --- a/tests/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -99,11 +99,12 @@ async def ironclaw_server(ironclaw_binary, mock_llm_server): "ONBOARD_COMPLETED": "true", } # Forward LLVM coverage instrumentation env vars when present - # (allows cargo-llvm-cov to collect profraw data from E2E runs) - for key in ("LLVM_PROFILE_FILE", "CARGO_LLVM_COV", "CARGO_LLVM_COV_SHOW_ENV", - "CARGO_LLVM_COV_TARGET_DIR"): - val = os.environ.get(key) - if val is not None: + # (allows cargo-llvm-cov to collect profraw data from E2E runs). + # Use prefix matching to stay resilient to cargo-llvm-cov changes. + COV_ENV_PREFIXES = ("CARGO_LLVM_COV", "LLVM_") + COV_ENV_EXTRAS = ("CARGO_ENCODED_RUSTFLAGS", "CARGO_INCREMENTAL") + for key, val in os.environ.items(): + if key.startswith(COV_ENV_PREFIXES) or key in COV_ENV_EXTRAS: env[key] = val proc = await asyncio.create_subprocess_exec( ironclaw_binary, "--no-onboard",