From c3a8e4ebbe36efb9f441211f9a34bd91dd4e0970 Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 00:33:42 -0300 Subject: [PATCH 1/2] fix(codec): narrow vitest coverage include to src/**/*.ts Eliminates "Failed to parse *.rs" warnings from @vitest/coverage-v8 when scanning src/ for uncovered files. Rust sources were never real TS coverage targets; narrowing the glob has no effect on coverage %. Adds reporter: ['text', 'lcov'] so lcov.info is emitted for codecov upload (change 3 of A5 task). --- packages/codec/vitest.config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/codec/vitest.config.ts b/packages/codec/vitest.config.ts index 0cb1996..bf4a462 100644 --- a/packages/codec/vitest.config.ts +++ b/packages/codec/vitest.config.ts @@ -16,7 +16,8 @@ export default defineConfig({ // enabled: true → `vitest run` always collects + gates coverage, so the // 80% threshold (Constitution X) is enforced by plain `pnpm -r test` in CI. enabled: true, - include: ['src/**'], + include: ['src/**/*.ts'], + reporter: ['text', 'lcov'], exclude: [ 'target/**', 'pkg/**', From 34ffeabb66a15506d0a52521dee2170516605ec4 Mon Sep 17 00:00:00 2001 From: Ignat Date: Thu, 4 Jun 2026 00:33:52 -0300 Subject: [PATCH 2/2] ci: Rust coverage gate (cargo-llvm-cov 80%) + codecov upload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add llvm-tools-preview component to setup-rust-toolchain in lint-and-build job so cargo-llvm-cov instrumentation is available. - Install cargo-llvm-cov via taiki-e/install-action (pinned SHA v2.81.3). - Replace plain `cargo test` in lint-and-build with `cargo llvm-cov --fail-under-lines 80` (Constitution X gate). Other jobs (macos-sanity, vector-parity) keep plain cargo test. - Add codecov/codecov-action upload (pinned SHA v6.0.1) for both rust-lcov.info (flag: rust) and packages/codec/coverage/lcov.info (flag: ts). fail_ci_if_error: false — codecov hiccup must not break CI. - Add minimal codecov.yml: rust flag is informational (advisory), ts flag is default (blocking on threshold regression). Measured Rust line coverage: 91.95% (gate: 80%). --- .github/workflows/ci.yml | 14 ++++++++++++-- codecov.yml | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3edaa2a..7e04996 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,17 +14,27 @@ jobs: - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: { node-version: 24, cache: pnpm } - uses: actions-rust-lang/setup-rust-toolchain@46268bd060767258de96ed93c1251119784f2ab6 # v1 - with: { rustflags: "" } + with: { rustflags: "", components: "llvm-tools-preview" } - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 - run: rustup target add wasm32-unknown-unknown - name: Install wasm-pack 0.14.0 run: cargo install wasm-pack --version 0.14.0 --locked + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@25435dc8dd3baed7417e0c96d3fe89013a5b2e09 # v2.81.3 + with: { tool: cargo-llvm-cov } - run: pnpm install --frozen-lockfile - run: pnpm -r build - run: pnpm -r lint - run: pnpm -r test - run: cargo build --manifest-path packages/codec/Cargo.toml --release - - run: cargo test --manifest-path packages/codec/Cargo.toml + - name: Rust coverage gate (Constitution X — 80% line coverage) + run: cargo llvm-cov --manifest-path packages/codec/Cargo.toml --all-features --fail-under-lines 80 --lcov --output-path rust-lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1 + with: + files: rust-lcov.info,packages/codec/coverage/lcov.info + flags: rust,ts + fail_ci_if_error: false - name: Assert size budgets run: bash scripts/assert-size.sh working-directory: packages/codec diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..d5def11 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,16 @@ +coverage: + status: + patch: + rust: + informational: true + project: + rust: + informational: true + +flags: + rust: + paths: + - packages/codec/src/ + ts: + paths: + - packages/codec/src/