Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(ci): allow coverage presence check to skip crates not run in this suite

Steven Enamakelaab93754dab6
diff --git a/scripts/ci/assert-coverage-presence.sh b/scripts/ci/assert-coverage-presence.sh
index a217b5dfb8..3327a44429 100755
--- a/scripts/ci/assert-coverage-presence.sh
+++ b/scripts/ci/assert-coverage-presence.sh
@@ -188,6 +188,18 @@ has_fn() {
# category for which "no lcov rows" is the correct, expected outcome; a rule
# without them false-fails on 623 of 1,972 files (measured against the
# lcov-rust-core artifact of run 32108672413).
+# COVERAGE_PRESENCE_SKIP_PREFIXES: space-separated path prefixes of crates whose
+# suite this run deliberately did not run (rust-coverage.sh sets it, e.g. with
+# OH_COV_TUI=0, where CI Lite covers the crate on pushes to main instead). A
+# crate that was not run cannot have produced records; this is not an allowlist.
+skipped_suite() {
+ local f="$1" prefix
+ for prefix in ${COVERAGE_PRESENCE_SKIP_PREFIXES:-}; do
+ case "${f}" in "${prefix}"*) return 0 ;; esac
+ done
+ return 1
+}
+
eligible() {
local f="$1" base
base="$(basename "${f}")"
@@ -206,6 +218,7 @@ eligible() {
# Per-OS modules behind #[cfg(target_os)]; CI is Linux.
case "${base}" in macos.rs | windows.rs) return 1 ;; esac
echo "${f}" | grep -Eq "${UNCOVERED_BY_DESIGN}" && return 1
+ skipped_suite "${f}" && return 1
allowlisted "${f}" && return 1
# No instrumentable code: barrel `mod.rs`, pure type/const modules. 319 files
# have no `fn` at all and can never produce a coverage region.
diff --git a/scripts/ci/rust-coverage.sh b/scripts/ci/rust-coverage.sh
index 90c133aef0..ef0b0a1b1c 100755
--- a/scripts/ci/rust-coverage.sh
+++ b/scripts/ci/rust-coverage.sh
@@ -197,8 +197,13 @@ fi
log "merging coverage into ${OUT}"
suite "lcov report" llvm_cov report --lcov --output-path "${OUT}"
-# A full product build must produce records for every eligible source file.
-suite "coverage presence" bash scripts/ci/assert-coverage-presence.sh "${OUT}" --all
+# A full product build must produce records for every eligible source file,
+# except in the crates whose suites this run skipped (OH_COV_TUI=0).
+presence_skip=""
+[ "${OH_COV_TUI:-1}" = "1" ] || presence_skip="crates/openhuman-tui/src/"
+[ -z "${presence_skip}" ] || log "coverage presence: not checking ${presence_skip} (suite skipped)"
+suite "coverage presence" env COVERAGE_PRESENCE_SKIP_PREFIXES="${presence_skip}" \
+ bash scripts/ci/assert-coverage-presence.sh "${OUT}" --all
if [ "${#FAILED_SUITES[@]}" -gt 0 ]; then
log "${#FAILED_SUITES[@]} suite(s) failed:"