Skip to content

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

fix(ci): drop inapplicable nextest overrides for standalone workspaces

Steven Enamakel0f27fc19be22
diff --git a/scripts/__tests__/rust-coverage-status.test.mjs b/scripts/__tests__/rust-coverage-status.test.mjs
index 66decd5eff..8ae0457ef4 100644
--- a/scripts/__tests__/rust-coverage-status.test.mjs
+++ b/scripts/__tests__/rust-coverage-status.test.mjs
@@ -251,6 +251,7 @@ case "$*" in *"-p openhuman --lib --bins"*) [ "${exitCode}" = 0 ] || exit "${exi
node - "$@" <<'JS'
const fs = require('node:fs');
const args = process.argv.slice(2);
+if (args[0] === 'metadata') console.log(JSON.stringify({ packages: [] }));
if (args[0] === 'nextest' && args[1] === 'list') {
console.log(JSON.stringify({ 'rust-suites': { active: { 'binary-name': 'active', testcases: { active: { ignored: false, 'filter-match': { status: 'matches' } } } } } }));
}
diff --git a/scripts/__tests__/self-hosted-lanes.test.mjs b/scripts/__tests__/self-hosted-lanes.test.mjs
index 907c9496d6..f7f408de63 100644
--- a/scripts/__tests__/self-hosted-lanes.test.mjs
+++ b/scripts/__tests__/self-hosted-lanes.test.mjs
@@ -432,7 +432,7 @@ test("private auxiliary coverage reports after failed tests and preserves the fa
const calls = path.join(dir, "calls");
fs.writeFileSync(
cargo,
- '#!/bin/sh\necho "$*" >> "$CARGO_CALLS"\nif [ "$2" = nextest ]; then exit 17; fi\nexit 0\n',
+ '#!/bin/sh\necho "$*" >> "$CARGO_CALLS"\nif [ "$1" = metadata ]; then echo \"{\\\"packages\\\":[]}\"; fi\nif [ "$2" = nextest ]; then exit 17; fi\nexit 0\n',
{ mode: 0o755 },
);
const plan = buildPlan({ profile: "ex63", areas: ALL, env: EX63_ENV });
@@ -448,9 +448,10 @@ test("private auxiliary coverage reports after failed tests and preserves the fa
});
assert.equal(result.status, 17);
const commands = fs.readFileSync(calls, "utf8").trim().split("\n");
- assert.equal(commands.length, 2);
- assert.match(commands[0], /^llvm-cov nextest /);
- assert.match(commands[1], /^llvm-cov report /);
+ assert.equal(commands.length, 3);
+ assert.match(commands[0], /^metadata /);
+ assert.match(commands[1], /^llvm-cov nextest /);
+ assert.match(commands[2], /^llvm-cov report /);
const tauri = plan.lanes.find((l) => l.name === "tauri");
assert.match(
tauri.checks.find((c) => c.name === "build-tauri").run,
diff --git a/scripts/ci/nextest-coverage.sh b/scripts/ci/nextest-coverage.sh
index 9b3a42d365..19aacab10c 100644
--- a/scripts/ci/nextest-coverage.sh
+++ b/scripts/ci/nextest-coverage.sh
@@ -11,10 +11,24 @@ config="${report_dir}/${suite}.toml"
report="${report_dir}/${suite}.xml"
# Absolute paths keep reports out of the compiler target tree and survive its
# cleanup. A fresh config retains the repository's timeouts/resource groups.
-node - "$config" "$report" <<'JS'
+node - "$config" "$report" "$@" <<'JS'
const fs = require('node:fs');
-const [config, report] = process.argv.slice(2);
-fs.writeFileSync(config, fs.readFileSync('.config/nextest.toml', 'utf8') + '\n[profile.ci.junit]\npath = ' + JSON.stringify(report) + '\n');
+const { execFileSync } = require('node:child_process');
+const [config, report, ...command] = process.argv.slice(2);
+const manifest = command.indexOf('--manifest-path');
+const metadataArgs = ['metadata', '--no-deps', '--format-version', '1'];
+if (manifest >= 0) metadataArgs.push('--manifest-path', command[manifest + 1]);
+const metadata = JSON.parse(execFileSync('cargo', metadataArgs, { encoding: 'utf8' }));
+const targets = new Set(metadata.packages.flatMap(pkg => pkg.targets.map(target => target.name)));
+// Nextest validates binary predicates against the selected workspace, even
+// regex predicates. A standalone Tauri workspace has none of the root CLI's
+// resource-sensitive binaries, so omit only those inapplicable overrides.
+const source = fs.readFileSync('.config/nextest.toml', 'utf8');
+const configText = source.replace(/\n\[\[profile\.ci\.overrides\]\]\n[\s\S]*?(?=\n\[|$)/g, block => {
+ const binary = block.match(/binary\(\/\^([a-zA-Z0-9_-]+)\$\/\)/) ?? block.match(/binary\(=([a-zA-Z0-9_-]+)\)/);
+ return binary && !targets.has(binary[1]) ? '' : block;
+});
+fs.writeFileSync(config, configText + '\n[profile.ci.junit]\npath = ' + JSON.stringify(report) + '\n');
JS
rm -f "$report" "${report_dir}/${suite}.json"
args=()