Skip to content

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

fix(ci): skip coverage expectations for intentionally empty targets

Steven Enamakelaa8929f08b1f
diff --git a/scripts/__tests__/rust-coverage-status.test.mjs b/scripts/__tests__/rust-coverage-status.test.mjs
index 8338605a2a..981fb71629 100644
--- a/scripts/__tests__/rust-coverage-status.test.mjs
+++ b/scripts/__tests__/rust-coverage-status.test.mjs
@@ -394,5 +394,6 @@ test("coverage inventory exceptions match the source gates and remain required a
const windows = fs.readFileSync(path.join(repoRoot, "tests/windows_sandbox_env_e2e.rs"), "utf8");
const functions = [...windows.matchAll(/#\[cfg\(windows\)\]\s*#\[(?:tokio::)?test(?:\([^\n]*\))?\]/g)];
assert.ok(functions.length > 0, "Windows-only fixture must retain gated tests");
+ assert.equal(functions.length, [...windows.matchAll(/#\[(?:tokio::)?test(?:\([^\n]*\))?\]/g)].length, "every Windows fixture test must remain gated");
assert.match(fs.readFileSync(runner, "utf8"), /target_features_satisfied "\$\{target\}" && target_expected_in_coverage "\$\{target\}"/);
});
diff --git a/scripts/ci/rust-coverage.sh b/scripts/ci/rust-coverage.sh
index b64ee13e65..663f8f6ce5 100755
--- a/scripts/ci/rust-coverage.sh
+++ b/scripts/ci/rust-coverage.sh
@@ -116,6 +116,30 @@ target_features_satisfied() {
done
}
+# These target-level cfgs intentionally produce empty binaries in this build.
+# Keep exceptions named and narrow: every other expected target must report
+# tests, including newly added targets. The Composio stress case runs once in
+# the private uninstrumented lane; existing Windows checks remain separate.
+target_expected_in_coverage() {
+ local target="$1" platform="${2:-$(uname -s)}"
+ case "$target" in
+ composio_list_tools_stack_overflow_regression)
+ log "not expecting ${target} in coverage: #![cfg(not(coverage))]; tested uninstrumented"
+ return 1
+ ;;
+ windows_sandbox_env_e2e)
+ case "$platform" in
+ MINGW* | MSYS* | CYGWIN* | Windows_NT) ;;
+ *)
+ log "not expecting ${target} on ${platform}: all tests are #[cfg(windows)]"
+ return 1
+ ;;
+ esac
+ ;;
+ esac
+ return 0
+}
+
# Every suite runs even when an earlier one fails, so one red crate never
# hides the results of the crates and targets after it. Failures are
# collected and reported together at the end, after the lcov report is still
@@ -261,7 +285,7 @@ if [ "${OH_COV_RUNNER:-cargo}" = "nextest" ]; then
: >"${expected_targets}"
while IFS= read -r target; do
[ -n "${target}" ] || continue
- if target_features_satisfied "${target}"; then
+ if target_features_satisfied "${target}" && target_expected_in_coverage "${target}"; then
printf '%s\n' "${target}" >>"${expected_targets}"
fi
done < <(integration_test_targets)