Skip to content

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

fix(ci): allow ignored-only nextest binaries to omit JUnit suites

Steven Enamakeld9250722cecc
diff --git a/.config/nextest.toml b/.config/nextest.toml
index f29d6191c6..cf22efc2d1 100644
--- a/.config/nextest.toml
+++ b/.config/nextest.toml
@@ -34,5 +34,5 @@ filter = 'binary(=json_rpc_e2e)'
test-group = 'json-rpc-e2e'
[[profile.ci.overrides]]
-filter = 'binary(=mcp_registry_multi_server)'
+filter = 'binary(/^mcp_registry_multi_server$/)'
test-group = 'mcp-registry'
diff --git a/scripts/__tests__/nextest-coverage.test.mjs b/scripts/__tests__/nextest-coverage.test.mjs
index 31896941ad..32b9407650 100644
--- a/scripts/__tests__/nextest-coverage.test.mjs
+++ b/scripts/__tests__/nextest-coverage.test.mjs
@@ -64,8 +64,8 @@ test("nextest serialization retains JSON-RPC and multi-server suites", () => {
path.join(root, ".config/nextest.toml"),
"utf8",
);
- assert.match(config, /binary\(=json_rpc_e2e\)/);
- assert.match(config, /binary\(=mcp_registry_multi_server\)/);
+ assert.match(config, /binary\(\/\^json_rpc_e2e\$\/\)/);
+ assert.match(config, /binary\(\/\^mcp_registry_multi_server\$\/\)/);
});
test("ignored-only binaries remain inventoried without requiring nonexistent JUnit suites", () => {
diff --git a/scripts/ci/nextest-coverage.sh b/scripts/ci/nextest-coverage.sh
index fd6fe62dad..9b3a42d365 100644
--- a/scripts/ci/nextest-coverage.sh
+++ b/scripts/ci/nextest-coverage.sh
@@ -26,7 +26,7 @@ started=$SECONDS
rc=0
bash scripts/ci-cancel-aware.sh "${args[@]}" || rc=$?
report_rc=0
-NEXTEST_ELAPSED_SECONDS="$((SECONDS - started))" node scripts/ci/nextest-report.mjs "$report" "${report_dir}/${suite}.json" ${NEXTEST_EXPECTED_TARGETS:+"${NEXTEST_EXPECTED_TARGETS}"} || report_rc=$?
+NEXTEST_ELAPSED_SECONDS="$((SECONDS - started))" node scripts/ci/nextest-report.mjs "$report" "${report_dir}/${suite}.json" ${NEXTEST_EXPECTED_TARGETS:+"${NEXTEST_EXPECTED_TARGETS}"} ${NEXTEST_EXPECTED_INVENTORY:+"${NEXTEST_EXPECTED_INVENTORY}"} || report_rc=$?
# A report/inventory failure must not hide the test runner's actual failure or
# cancellation. Successful executions must also produce nonempty reports.
[ "$rc" != 0 ] || rc="$report_rc"
diff --git a/scripts/ci/nextest-report.mjs b/scripts/ci/nextest-report.mjs
index 634ff804e0..70e5952658 100644
--- a/scripts/ci/nextest-report.mjs
+++ b/scripts/ci/nextest-report.mjs
@@ -2,7 +2,11 @@
// Consume nextest's JUnit vocabulary; retain counts before checking inventory.
import fs from "node:fs";
-const [report, output, expectedFile] = process.argv.slice(2);
+const [report, output, expectedFile, inventoryFile] = process.argv.slice(2);
+if (!fs.existsSync(report)) {
+ console.error(`[ci][nextest] JUnit report unavailable: ${report}`);
+ process.exit(1);
+}
const xml = fs.readFileSync(report, "utf8");
const decode = (value) =>
value
@@ -44,14 +48,20 @@ console.log(
const expected = expectedFile
? fs.readFileSync(expectedFile, "utf8").split(/\r?\n/).filter(Boolean)
: [];
-const missing = expected.filter(
- (target) =>
- !suites.some(
- (suite) =>
- (suite.name === target || suite.name?.endsWith(`::${target}`)) &&
- suite.tests > 0,
- ),
-);
+const inventory = inventoryFile
+ ? Object.values(JSON.parse(fs.readFileSync(inventoryFile, "utf8"))["rust-suites"] ?? {})
+ : null;
+const missing = expected.filter((target) => {
+ if (inventory) {
+ const binary = inventory.find((suite) => suite["binary-name"] === target);
+ // A missing compiled target still fails. Only a present binary whose
+ // complete selected inventory is ignored may omit its JUnit testsuite.
+ if (!binary) return true;
+ const selected = Object.values(binary.testcases ?? {});
+ if (selected.length > 0 && selected.every((test) => test.ignored === true)) return false;
+ }
+ return !suites.some((suite) => (suite.name === target || suite.name?.endsWith(`::${target}`)) && suite.tests > 0);
+});
if (counts.tests === 0 || missing.length > 0) {
console.error(
`[ci][nextest] expected nonempty suites; missing/empty: ${missing.join(", ") || "entire selection"}`,
diff --git a/scripts/ci/rust-coverage.sh b/scripts/ci/rust-coverage.sh
index 9a0b2ae899..46225c4b96 100755
--- a/scripts/ci/rust-coverage.sh
+++ b/scripts/ci/rust-coverage.sh
@@ -265,7 +265,20 @@ if [ "${OH_COV_RUNNER:-cargo}" = "nextest" ]; then
printf '%s\n' "${target}" >>"${expected_targets}"
fi
done < <(integration_test_targets)
+ expected_inventory=""
+ if [ -s "${expected_targets}" ]; then
+ expected_inventory="${PWD}/ci-out/nextest/cli-inventory.json"
+ # Listing executes no tests. cargo-llvm-cov supplies the same wrapper and
+ # instrumentation environment, so Cargo can reuse this CLI test build.
+ cli_inventory() (
+ eval "$(cargo llvm-cov show-env --sh --features "${CORE_PRODUCT_FEATURES}")"
+ cargo nextest list --message-format json --features "${CORE_PRODUCT_FEATURES}" \
+ -p openhuman-cli --tests -E 'kind(test)' >"${expected_inventory}"
+ )
+ suite "openhuman-cli test inventory" cli_inventory
+ fi
NEXTEST_EXPECTED_TARGETS="${expected_targets}" \
+ NEXTEST_EXPECTED_INVENTORY="${expected_inventory}" \
suite "openhuman-cli integration tests (nextest)" llvm_cov \
--no-report --no-fail-fast -p openhuman-cli --tests -E 'kind(test)'
else