Skip to content

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

ci: run complete test suites for changed areas

Steven Enamakel6c480b1ef7e8
diff --git a/.github/workflows/ci-full.yml b/.github/workflows/ci-full.yml
index e1e874297a..ca46711ac9 100644
--- a/.github/workflows/ci-full.yml
+++ b/.github/workflows/ci-full.yml
@@ -5,7 +5,7 @@
#
# Two-lane model:
# - ci-lite.yml (quick): pushes to main + PRs to main/release — quality
-# checks + unit tests scoped to the changed files only.
+# checks + complete unit-test suites for each changed area.
# - ci-full.yml (this file, slow): PRs targeting `release` (fix PRs opened
# while stabilising a cut — the "CI Full Gate" check gates their merge)
# and pushes to `release` (the maintainer-dispatched promotion merge from
diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.yml
index fab07199a7..3181823897 100644
--- a/.github/workflows/ci-lite.yml
+++ b/.github/workflows/ci-lite.yml
@@ -1,10 +1,9 @@
---
# CI Lite — the quick lane (pushes to main + PRs targeting main or release).
#
-# Runs quality checks per changed area and unit tests ONLY for the files the
-# PR changed (vitest related / domain-scoped cargo-llvm-cov), with diff-cover
-# enforcing >= 80% coverage on changed lines. Integration and E2E suites do
-# NOT run here — they run in full via ci-full.yml on PRs targeting `release`
+# Runs quality checks and complete unit-test suites per changed area, with
+# diff-cover enforcing >= 80% coverage on changed lines. Release-only mock-backend
+# and cross-platform E2E suites run via ci-full.yml on PRs targeting `release`
# and on every push to `release` (the maintainer-dispatched
# promote-main-to-release.yml merge and fix-PR merges). Fix PRs against
# release get this fast lane too, for quick lint/coverage feedback alongside
@@ -51,19 +50,9 @@ jobs:
timeout-minutes: 5
outputs:
frontend: ${{ steps.filter.outputs.frontend }}
- # "true" when the change touches config that invalidates test scoping
- # (lockfile, vitest/vite/ts config, test setup) → run the full suite.
- frontend-full: ${{ steps.filter.outputs['frontend-full'] }}
- # Shell-quoted list of changed app/src source files, consumed by
- # scripts/ci/vitest-changed-coverage.sh (vitest related).
- frontend-src-files: ${{ steps.filter.outputs['frontend-src_files'] }}
i18n: ${{ steps.filter.outputs.i18n }}
docs: ${{ steps.filter.outputs.docs }}
rust-core: ${{ steps.filter.outputs['rust-core'] }}
- rust-core-full: ${{ steps.filter.outputs['rust-core-full'] }}
- # Shell-quoted list of changed src/ + tests/ files, consumed by
- # scripts/ci/rust-coverage-changed.sh (domain-scoped llvm-cov).
- rust-core-src-files: ${{ steps.filter.outputs['rust-core-src_files'] }}
rust-tauri: ${{ steps.filter.outputs['rust-tauri'] }}
# Mock backend + shared scripts → run the scripts self-test suite.
scripts: ${{ steps.filter.outputs.scripts }}
@@ -86,13 +75,9 @@ jobs:
id: filter
uses: dorny/paths-filter@v4
with:
- list-files: shell
filters: |
frontend:
- '.github/workflows/ci-lite.yml'
- # The changed-files runner itself must trigger the lane that
- # runs it (it is also in frontend-full → full-suite mode).
- - 'scripts/ci/vitest-changed-coverage.sh'
- 'scripts/ci-cancel-aware.sh'
- 'package.json'
- 'pnpm-lock.yaml'
@@ -106,25 +91,6 @@ jobs:
- 'app/vite.config.*'
- 'app/tailwind.config.*'
- 'app/postcss.config.*'
- # Changes here invalidate per-file test scoping → full Vitest run.
- frontend-full:
- - '.github/workflows/ci-lite.yml'
- - 'scripts/ci/vitest-changed-coverage.sh'
- - 'package.json'
- - 'pnpm-lock.yaml'
- - 'app/package.json'
- - 'app/index.html'
- - 'app/public/**'
- - 'app/test/vitest.config.ts'
- - 'app/tsconfig*.json'
- - 'app/vite.config.*'
- - 'app/tailwind.config.*'
- - 'app/postcss.config.*'
- - 'app/scripts/**'
- - 'app/src/test/**'
- frontend-src:
- - 'app/src/**/*.ts'
- - 'app/src/**/*.tsx'
i18n:
- '.github/workflows/ci-lite.yml'
- 'app/src/**'
@@ -137,12 +103,10 @@ jobs:
- 'package.json'
rust-core:
- '.github/workflows/ci-lite.yml'
- # The changed-files runner itself must trigger the lane that
- # runs it (it is also in rust-core-full → full-suite mode).
- - 'scripts/ci/rust-coverage-changed.sh'
+ - 'scripts/ci/rust-coverage.sh'
# The product feature set decides what the Rust lanes below
# actually compile (clippy's `--features`, the test suite's, and
- # rust-coverage-changed.sh's). Changing it changes the code under
+ # rust-coverage.sh's). Changing it changes the code under
# test as surely as editing `Cargo.toml` does, so it has to arm
# this lane too — #5619 turned `hosting` on and, without this
# entry, resolved to `["rust-tauri"]` alone, skipping every lane
@@ -184,41 +148,6 @@ jobs:
# `--init --recursive`. Do not go back to a list.
- '.gitmodules'
- 'vendor/**'
- # Changes here invalidate per-module test scoping → full suite.
- rust-core-full:
- - '.github/workflows/ci-lite.yml'
- - 'scripts/ci/rust-coverage-changed.sh'
- # Same reason as in `rust-core` above: a feature-set change
- # changes what compiles, which invalidates per-module scoping
- # exactly as a `Cargo.toml` change does.
- - 'scripts/ci/product-features.*'
- - 'scripts/ci/assert-coverage-presence.sh'
- - 'scripts/ci/coverage-presence-allowlist.txt'
- - 'Cargo.toml'
- - 'crates/openhuman-core/Cargo.toml'
- - 'crates/openhuman-embed/Cargo.toml'
- - 'crates/openhuman-session/Cargo.toml'
- - 'crates/openhuman-tui/Cargo.toml'
- - 'Cargo.lock'
- - 'build.rs'
- - '.cargo/config.toml'
- - 'rust-toolchain.toml'
- - 'scripts/ci-cancel-aware.sh'
- - 'scripts/check-linux-tls-dependencies.sh'
- # A vendored-crate bump invalidates per-module test scoping for the
- # same reason a Cargo.lock change does: it moves the dependency
- # graph under every module. Full suite, not scoped.
- - '.gitmodules'
- - 'vendor/**'
- rust-core-src:
- - 'src/**'
- - 'crates/openhuman-core/src/**'
- - 'crates/openhuman-embed/src/**'
- - 'crates/openhuman-embed/tests/**'
- - 'crates/openhuman-session/src/**'
- - 'crates/openhuman-tui/src/**'
- - 'crates/openhuman-tui/tests/**'
- - 'tests/**'
rust-tauri:
- '.github/workflows/ci-lite.yml'
- 'Cargo.lock'
@@ -364,18 +293,11 @@ jobs:
if: needs.changes.outputs.docs == 'true'
run: pnpm docs:check
- - name: Run Vitest with coverage (changed files only)
+ - name: Run complete frontend unit suite with coverage
if: needs.changes.outputs.frontend == 'true'
- run: bash scripts/ci/vitest-changed-coverage.sh
+ run: bash scripts/ci-cancel-aware.sh pnpm --filter openhuman-app test:coverage
env:
NODE_ENV: test
- FULL: ${{ needs.changes.outputs['frontend-full'] }}
- # Same argument-limit guard as the rust-core lane below. The condition is
- # inverted so the file list sits on the `&&` (truthy) side: GitHub's
- # `a && b || c` ternary falls through to `c` whenever `b` is falsy, so
- # `... == 'true' && '' || <files>` would hand back the full list in
- # exactly the full-suite case this is meant to blank.
- CHANGED_FILES: ${{ needs.changes.outputs['frontend-full'] != 'true' && needs.changes.outputs['frontend-src-files'] || '' }}
- name: Normalize lcov source paths to repo root
if: needs.changes.outputs.frontend == 'true'
@@ -690,7 +612,7 @@ jobs:
# a domain feature must equal the allowlist below. When a new gate (or a new
# test in an existing gate's domain) adds a gated test file, this fails — the
# author then adds it here AND, if it can hold an ungated-assert regression of
- # the #5022 class, extends the scoped `cargo test` filter above. Prevents the
+ # the #5022 class, extends the gate-contract `cargo test` filters above. Prevents the
# smoke lane from silently under-covering as the gate surface grows.
run: |
set -euo pipefail
@@ -743,7 +665,7 @@ jobs:
)
ACTUAL=$(node scripts/ci/list-feature-gated-rust-tests.mjs | sort -u)
if ! diff <(echo "$EXPECTED" | sed 's/^ *//' | sort -u) <(echo "$ACTUAL"); then
- echo "::error::Gated-test file set changed. Update the EXPECTED allowlist in the rust-feature-gate-smoke lane, and extend the scoped 'cargo test' filter if the new module can carry an ungated-assert regression (see #5022)."
+ echo "::error::Gated-test file set changed. Update the EXPECTED allowlist in the rust-feature-gate-smoke lane, and extend the gate-contract 'cargo test' filters if the new module can carry an ungated-assert regression (see #5022)."
exit 1
fi
echo "gate-contract test coverage allowlist is current"
@@ -921,19 +843,10 @@ jobs:
env:
CARGO_BUILD_JOBS: "1"
- - name: Run cargo llvm-cov for openhuman core (changed modules only)
- run: bash scripts/ci/rust-coverage-changed.sh
+ - name: Run complete root Rust suite with cargo llvm-cov
+ run: bash scripts/ci/rust-coverage.sh
env:
CARGO_BUILD_JOBS: "1"
- FULL: ${{ needs.changes.outputs['rust-core-full'] }}
- # Suppressed in full-suite mode. The list is ignored when FULL=true, but a
- # large refactor can push it past the container job's argument/env limit,
- # and `docker exec` then fails to START the step —
- # "Argument list too long" — before the script can apply its own
- # MAX_CHANGED_FILES fallback. Blanking it here keeps the step launchable.
- # Condition inverted so the file list is on the `&&` side — `a && '' || b`
- # always falls through to `b` because `''` is falsy.
- CHANGED_FILES: ${{ needs.changes.outputs['rust-core-full'] != 'true' && needs.changes.outputs['rust-core-src-files'] || '' }}
OUT: lcov-core.info
# The tinyagents harness is the agent engine on every build now
# (issue #4249); the suite exercises it by default. The legacy engine
diff --git a/gitbooks/developing/e2e-testing.md b/gitbooks/developing/e2e-testing.md
index 34b7cdaf25..81dcc718b7 100644
--- a/gitbooks/developing/e2e-testing.md
+++ b/gitbooks/developing/e2e-testing.md
@@ -166,7 +166,7 @@ CEF cache preflight before Tauri's deep-link forwarding path is installed.
### Push / PR checks
-The default pull-request gate is `.github/workflows/ci-lite.yml` (quick lane: quality checks + unit tests scoped to the changed files). E2E suites do not run on PRs to `main` — the full E2E matrix (Rust mock-backend, Playwright web, desktop on Linux/macOS/Windows) runs in `.github/workflows/ci-full.yml` on PRs targeting the `release` branch and on every push to it.
+The default pull-request gate is `.github/workflows/ci-lite.yml` (quick lane: quality checks plus complete unit-test suites for each changed area). E2E suites do not run on PRs to `main` — the full E2E matrix (Rust mock-backend, Playwright web, desktop on Linux/macOS/Windows) runs in `.github/workflows/ci-full.yml` on PRs targeting the `release` branch and on every push to it.
macOS and Windows desktop E2E do not run on every PR. Use the manually dispatched E2E workflow (`.github/workflows/e2e.yml`) when cross-platform desktop signal is needed before promotion.
diff --git a/gitbooks/developing/release-policy.md b/gitbooks/developing/release-policy.md
index 2b1e7274c3..fadc44d1b1 100644
--- a/gitbooks/developing/release-policy.md
+++ b/gitbooks/developing/release-policy.md
@@ -43,7 +43,7 @@ Implementation: `app/src/utils/oauthAppVersionGate.ts`, `app/src/utils/desktopDe
Two long-lived branches, two CI lanes:
-- **`main`** — where all feature/fix PRs land. Every PR (and push to main) runs **CI Lite** ([`ci-lite.yml`](../../.github/workflows/ci-lite.yml)): quality checks per changed area plus unit tests scoped to the changed files, gated at ≥ 80% diff coverage by the `PR CI Gate` check.
+- **`main`** — where all feature/fix PRs land. Every PR (and push to main) runs **CI Lite** ([`ci-lite.yml`](../../.github/workflows/ci-lite.yml)): quality checks plus complete unit-test suites for each changed area, gated at ≥ 80% diff coverage by the `PR CI Gate` check.
- **`release`** — a maintainer-promoted snapshot of `main` that releases are cut from. PRs targeting `release` and every push to `release` run **CI Full** ([`ci-full.yml`](../../.github/workflows/ci-full.yml)): complete unit suites, Rust mock-backend E2E, Playwright web E2E, and the full desktop E2E matrix on Linux/macOS/Windows. The `CI Full Gate` check aggregates every lane **except the Playwright spec run**, which is non-blocking signal for now (`continue-on-error`, flaky under CI contention — #3615): a green gate does not prove Playwright specs passed, so check that lane's result in the run before cutting. Only the Playwright artifact _build_ is gated.
The cycle:
diff --git a/scripts/__tests__/ci-suite-scope.test.mjs b/scripts/__tests__/ci-suite-scope.test.mjs
new file mode 100644
index 0000000000..8fc438be1b
--- /dev/null
+++ b/scripts/__tests__/ci-suite-scope.test.mjs
@@ -0,0 +1,45 @@
+import assert from "node:assert/strict";
+import fs from "node:fs";
+import path from "node:path";
+import test from "node:test";
+import { fileURLToPath } from "node:url";
+
+const repoRoot = path.join(
+ path.dirname(fileURLToPath(import.meta.url)),
+ "..",
+ "..",
+);
+
+const workflow = fs.readFileSync(
+ path.join(repoRoot, ".github", "workflows", "ci-lite.yml"),
+ "utf8",
+);
+const rustCoverage = fs.readFileSync(
+ path.join(repoRoot, "scripts", "ci", "rust-coverage.sh"),
+ "utf8",
+);
+
+test("CI Lite runs the complete frontend suite for frontend changes", () => {
+ assert.match(workflow, /pnpm --filter openhuman-app test:coverage/);
+ assert.doesNotMatch(workflow, /vitest related|CHANGED_FILES|frontend-src/);
+});
+
+test("CI Lite runs the complete Rust suite for Rust-core changes", () => {
+ assert.match(workflow, /bash scripts\/ci\/rust-coverage\.sh/);
+ assert.doesNotMatch(workflow, /rust-core-src|rust-core-full/);
+ assert.doesNotMatch(rustCoverage, /CHANGED_FILES|MAX_CHANGED_FILES/);
+
+ for (const crate of [
+ "openhuman",
+ "openhuman-embed",
+ "openhuman-rpc",
+ "openhuman-session",
+ "openhuman-tui",
+ ]) {
+ assert.match(
+ rustCoverage,
+ new RegExp(`-p ${crate}(?: |\\n)`),
+ `${crate} must remain in the complete Rust suite`,
+ );
+ }
+});
diff --git a/scripts/__tests__/coverage-presence.test.mjs b/scripts/__tests__/coverage-presence.test.mjs
index 67c7dd1d05..d19094c16f 100644
--- a/scripts/__tests__/coverage-presence.test.mjs
+++ b/scripts/__tests__/coverage-presence.test.mjs
@@ -121,6 +121,20 @@ test("treats embedding facade sources as coverage-eligible", () => {
assert.match(res.output, /checked 1 eligible/);
});
+test("treats RPC and session crate sources as coverage-eligible", () => {
+ const sources = [
+ "crates/openhuman-rpc/src/client.rs",
+ "crates/openhuman-session/src/session.rs",
+ ];
+ const res = run(
+ Object.fromEntries(sources.map((source) => [source, WITH_FN])),
+ sources,
+ ["--files", ...sources],
+ );
+ assert.equal(res.status, 0);
+ assert.match(res.output, /checked 2 eligible/);
+});
+
test("skips barrel modules that declare no fn", () => {
const res = run({ "src/a/mod.rs": NO_FN }, [], ["--files", "src/a/mod.rs"]);
assert.equal(res.status, 0);
diff --git a/scripts/__tests__/coverage-runner-status.test.mjs b/scripts/__tests__/coverage-runner-status.test.mjs
deleted file mode 100644
index 0564ddf997..0000000000
--- a/scripts/__tests__/coverage-runner-status.test.mjs
+++ /dev/null
@@ -1,280 +0,0 @@
-// Regression tests for status propagation in scripts/ci/rust-coverage-changed.sh.
-//
-// `run_counted` runs its command inside a pipeline under `set +e` so it can tee
-// and count libtest output. That disables errexit for everything underneath,
-// which is exactly the condition under which a loop silently swallows a failed
-// iteration. These tests pin that a failing coverage module still fails the job.
-//
-// They evaluate the REAL function bodies, extracted from the script at test
-// time, rather than a transcription of them — a copy would keep passing after
-// the original regressed, which is the whole failure mode being guarded.
-
-import assert from "node:assert/strict";
-import { execFileSync } from "node:child_process";
-import fs from "node:fs";
-import path from "node:path";
-import test from "node:test";
-import { fileURLToPath } from "node:url";
-
-const repoRoot = path.join(
- path.dirname(fileURLToPath(import.meta.url)),
- "..",
- "..",
-);
-const runner = path.join(repoRoot, "scripts", "ci", "rust-coverage-changed.sh");
-
-/** Extract the runner's `TESTS_RUN` accumulator declaration, verbatim. */
-function extractTestsRunDecl() {
- const source = fs.readFileSync(runner, "utf8");
- const decl = source.split("\n").find((line) => /^TESTS_RUN=/.test(line));
- assert.ok(
- decl,
- `TESTS_RUN= not found in ${runner} — did the accumulator get renamed?`,
- );
- return decl;
-}
-
-/** Extract a top-level `name() { … }` block from the runner, verbatim. */
-function extractFunction(name) {
- const source = fs.readFileSync(runner, "utf8");
- const start = source.indexOf(`${name}() {`);
- assert.notEqual(
- start,
- -1,
- `${name}() not found in ${runner} — did it get renamed?`,
- );
- const end = source.indexOf("\n}\n", start);
- assert.notEqual(end, -1, `could not find the end of ${name}()`);
- return source.slice(start, end + 3);
-}
-
-/**
- * Run a bash snippet with the named runner functions spliced in and the heavy
- * dependencies stubbed.
- *
- * @param {string[]} functions names to lift out of the runner
- * @param {string} preamble stubs, defined before the real functions
- * @param {string} body the assertion driver
- */
-function withRunnerFunctions(functions, preamble, body) {
- const script = [
- "set -euo pipefail",
- // Merge stderr into stdout for the whole script, including the success
- // path. A `case`/`if !` guard around an undefined helper can turn bash's
- // status-127 "command not found" into a handled branch rather than a
- // thrown error, so execFileSync's success path — which otherwise only
- // returns stdout — would never see it and the guard below would miss a
- // real extraction drift.
- "exec 2>&1",
- extractTestsRunDecl(),
- preamble,
- ...functions.map(extractFunction),
- body,
- ].join("\n");
- let result;
- try {
- result = {
- status: 0,
- output: execFileSync("bash", ["-c", script], { encoding: "utf8" }),
- };
- } catch (err) {
- result = {
- status: err.status,
- output: `${err.stdout ?? ""}${err.stderr ?? ""}`,
- };
- }
- // A function that calls a helper this list did not lift out fails at runtime
- // with `command not found`, and bash's 127 then flows into whatever branch the
- // caller was testing — so the assertion fails for a reason that has nothing to
- // do with the behaviour under test. Surface it as itself instead.
- assert.doesNotMatch(
- result.output,
- /command not found/,
- `the extracted functions call a helper that was not lifted out of the runner; ` +
- `add it to the \`functions\` list:\n${result.output}`,
- );
- return result;
-}
-
-test("a failed raw coverage module fails the run even when a later module succeeds", () => {
- // The exact shape CodeRabbit flagged: module `first` fails, `second` passes.
- // The loop's status is its last iteration's, so without an explicit `return`
- // the failure is discarded and CI goes green on a red suite.
- const res = withRunnerFunctions(
- // `target_features_satisfied` is not decoration: `run_integration_target`
- // consults it on entry, so omitting it makes every target look unsatisfiable
- // and the function returns early without running anything.
- ["run_counted", "target_features_satisfied", "run_integration_target"],
- [
- // Inputs to `target_features_satisfied`. Empty reqs means "no target
- // declares required-features", i.e. nothing is skipped — the condition
- // this test needs in order to reach the loop it is actually about.
- 'TEST_TARGET_REQS=""',
- 'PRODUCT_FEATURES=""',
- "log() { printf '%s\\n' \"$*\"; }",
- "raw_coverage_modules() { printf 'first\\nsecond\\n'; }",
- // Neutralise the product-feature gate. Without this the runner skips
- // `raw_coverage_all` before reaching the loop, and the test passes
- // vacuously — asserting failure propagation while never producing a
- // failure. What is under test here is the `|| return`, not the gate.
- "target_features_satisfied() { return 0; }",
- // Fails for `first::`, succeeds otherwise.
- "llvm_cov() { for a in \"$@\"; do case \"$a\" in first::) echo 'module first FAILED'; return 7 ;; esac; done; echo 'module ok'; return 0; }",
- ].join("\n"),
- [
- "if run_counted run_integration_target raw_coverage_all; then",
- " echo 'WRAPPER-SAID-SUCCESS'; exit 0",
- "else",
- ' echo "WRAPPER-SAID-FAILURE rc=$?"; exit 3',
- "fi",
- ].join("\n"),
- );
-
- assert.equal(
- res.status,
- 3,
- `expected the wrapper to report failure, got:\n${res.output}`,
- );
- assert.match(res.output, /WRAPPER-SAID-FAILURE/);
- // Fail-fast: nothing after the failing module may run.
- assert.doesNotMatch(res.output, /running raw coverage module: second/);
-});
-
-test("run_counted propagates the command status, not tee's", () => {
- // `${PIPESTATUS[0]}` rather than `$?`. Reading `$?` after the pipe reports
- // tee, which always succeeds, turning every failing suite green.
- const res = withRunnerFunctions(
- ["run_counted"],
- "boom() { echo 'running 3 tests'; return 9; }",
- "run_counted boom || { echo \"rc=$?\"; exit 0; }; echo 'NO-FAILURE-SEEN'; exit 1",
- );
- assert.equal(res.status, 0, res.output);
- assert.match(res.output, /rc=9/);
-});
-
-test("run_counted sums libtest counts across calls and passes success through", () => {
- const res = withRunnerFunctions(
- ["run_counted"],
- "some() { echo 'running 12 tests'; }\nmore() { echo 'running 1 test'; }\nnone() { echo 'running 0 tests'; }",
- 'run_counted some; run_counted more; run_counted none; echo "TOTAL=${TESTS_RUN}"',
- );
- assert.equal(res.status, 0, res.output);
- // 12 + 1 + 0 — and "1 test" singular must parse, or a one-test domain looks
- // like a zero-test run and needlessly escalates to the full suite.
- assert.match(res.output, /TOTAL=13/);
-});
-
-test("run_counted counts zero for a run that executed no tests", () => {
- const res = withRunnerFunctions(
- ["run_counted"],
- "nothing() { echo 'running 0 tests'; echo 'test result: ok. 0 passed; 12202 filtered out'; }",
- 'run_counted nothing; [ "${TESTS_RUN}" -eq 0 ] && echo \'ZERO\' || echo "NONZERO=${TESTS_RUN}"',
- );
- assert.equal(res.status, 0, res.output);
- assert.match(res.output, /ZERO/);
-});
-
-// The `required-features` skip that `run_integration_target` performs on entry
-// had no test of its own, which is how the extraction above drifted out of sync
-// with it unnoticed. These pin both directions.
-
-test("an integration target whose required-features are not in the product set is skipped", () => {
- const res = withRunnerFunctions(
- ["run_counted", "target_features_satisfied", "run_integration_target"],
- [
- // `memory_artifacts_e2e` needs `memory-git`, which the product set below
- // does not enable — the exact shape that took this lane down when a gate
- // was dropped from the product set.
- 'TEST_TARGET_REQS="$(printf \'memory_artifacts_e2e\\tmemory-git\')"',
- 'PRODUCT_FEATURES="channels,flows"',
- "log() { printf '%s\\n' \"$*\"; }",
- // Fails loudly if the skip does not happen, so a regression cannot pass
- // by quietly doing the work.
- "llvm_cov() { echo 'RAN-THE-TARGET'; return 0; }",
- ].join("\n"),
- [
- "run_integration_target memory_artifacts_e2e",
- 'echo "rc=$?"',
- ].join("\n"),
- );
-
- assert.match(res.output, /skipping memory_artifacts_e2e/, res.output);
- assert.doesNotMatch(res.output, /RAN-THE-TARGET/, res.output);
- // Skipping is success: one unsatisfiable target must not fail the lane.
- assert.match(res.output, /rc=0/, res.output);
-});
-
-test("an integration target whose required-features are all present still runs", () => {
- const res = withRunnerFunctions(
- ["run_counted", "target_features_satisfied", "run_integration_target"],
- [
- 'TEST_TARGET_REQS="$(printf \'memory_artifacts_e2e\\tmemory-git\')"',
- // Same target, now satisfied. Substring matching would be a real hazard
- // here, so the product set deliberately contains a feature that has
- // `memory-git` as a prefix-adjacent neighbour.
- 'PRODUCT_FEATURES="memory-github,memory-git,flows"',
- "log() { printf '%s\\n' \"$*\"; }",
- "llvm_cov() { echo 'RAN-THE-TARGET'; return 0; }",
- ].join("\n"),
- ["run_integration_target memory_artifacts_e2e", 'echo "rc=$?"'].join("\n"),
- );
-
- assert.match(res.output, /RAN-THE-TARGET/, res.output);
- assert.doesNotMatch(res.output, /skipping/, res.output);
- assert.match(res.output, /rc=0/, res.output);
-});
-
-test("required-features matching is exact, not substring — a superset name does not satisfy it", () => {
- const res = withRunnerFunctions(
- ["run_counted", "target_features_satisfied", "run_integration_target"],
- [
- 'TEST_TARGET_REQS="$(printf \'memory_artifacts_e2e\\tmemory-git\')"',
- // `memory-git` is required, but the product set below only has
- // `memory-github` — which contains `memory-git` as a substring — and
- // `flows`. An implementation that matched by substring rather than by
- // exact comma-delimited entry would wrongly consider this satisfied and
- // run the target; a correct one must still skip it.
- 'PRODUCT_FEATURES="memory-github,flows"',
- "log() { printf '%s\\n' \"$*\"; }",
- "llvm_cov() { echo 'RAN-THE-TARGET'; return 0; }",
- ].join("\n"),
- ["run_integration_target memory_artifacts_e2e", 'echo "rc=$?"'].join("\n"),
- );
-
- assert.match(res.output, /skipping memory_artifacts_e2e/, res.output);
- assert.doesNotMatch(res.output, /RAN-THE-TARGET/, res.output);
- assert.match(res.output, /rc=0/, res.output);
-});
-
-test("source changes compile the aggregate raw coverage target", () => {
- const res = withRunnerFunctions(
- ["compile_raw_coverage_target"],
- [
- "PRODUCT_FEATURES='voice web3'",
- "log() { printf '%s\\n' \"$*\"; }",
- "bash() { printf 'BASH_ARGS'; printf ' <%s>' \"$@\"; printf '\\n'; }",
- ].join("\n"),
- "compile_raw_coverage_target",
- );
-
- assert.equal(res.status, 0, res.output);
- assert.match(
- res.output,
- /BASH_ARGS <scripts\/ci-cancel-aware\.sh> <cargo> <test> <--features> <voice web3> <--test> <raw_coverage_all> <--no-run>/,
- );
-});
-
-test("raw coverage compile failures fail the source-change guard", () => {
- const res = withRunnerFunctions(
- ["compile_raw_coverage_target"],
- [
- "PRODUCT_FEATURES='voice web3'",
- "log() { :; }",
- "bash() { return 17; }",
- ].join("\n"),
- "compile_raw_coverage_target && exit 1; rc=$?; echo \"rc=${rc}\"",
- );
-
- assert.equal(res.status, 0, res.output);
- assert.match(res.output, /rc=17/);
-});
diff --git a/scripts/__tests__/rust-coverage-status.test.mjs b/scripts/__tests__/rust-coverage-status.test.mjs
new file mode 100644
index 0000000000..55c875b5d3
--- /dev/null
+++ b/scripts/__tests__/rust-coverage-status.test.mjs
@@ -0,0 +1,94 @@
+import assert from "node:assert/strict";
+import { execFileSync } from "node:child_process";
+import fs from "node:fs";
+import path from "node:path";
+import test from "node:test";
+import { fileURLToPath } from "node:url";
+
+const repoRoot = path.join(
+ path.dirname(fileURLToPath(import.meta.url)),
+ "..",
+ "..",
+);
+const runner = path.join(repoRoot, "scripts", "ci", "rust-coverage.sh");
+
+function extractFunction(name) {
+ const source = fs.readFileSync(runner, "utf8");
+ const start = source.indexOf(`${name}() {`);
+ assert.notEqual(start, -1, `${name}() not found in ${runner}`);
+ const end = source.indexOf("\n}\n", start);
+ assert.notEqual(end, -1, `could not find the end of ${name}()`);
+ return source.slice(start, end + 3);
+}
+
+function withRunnerFunctions(functions, preamble, body) {
+ const script = [
+ "set -euo pipefail",
+ "exec 2>&1",
+ preamble,
+ ...functions.map(extractFunction),
+ body,
+ ].join("\n");
+ try {
+ return {
+ status: 0,
+ output: execFileSync("bash", ["-c", script], { encoding: "utf8" }),
+ };
+ } catch (error) {
+ return {
+ status: error.status,
+ output: `${error.stdout ?? ""}${error.stderr ?? ""}`,
+ };
+ }
+}
+
+test("a failed raw coverage module fails before later modules run", () => {
+ const result = withRunnerFunctions(
+ ["target_features_satisfied", "run_integration_target"],
+ [
+ 'TEST_TARGET_REQS=""',
+ 'PRODUCT_FEATURES=""',
+ "log() { printf '%s\\n' \"$*\"; }",
+ "raw_coverage_modules() { printf 'first\\nsecond\\n'; }",
+ 'llvm_cov() { for arg in "$@"; do case "$arg" in first::) return 7 ;; esac; done; echo RAN-LATER; }',
+ ].join("\n"),
+ "run_integration_target raw_coverage_all",
+ );
+
+ assert.equal(result.status, 7, result.output);
+ assert.doesNotMatch(result.output, /running raw coverage module: second/);
+ assert.doesNotMatch(result.output, /RAN-LATER/);
+});
+
+test("an integration target missing a required product feature is skipped", () => {
+ const result = withRunnerFunctions(
+ ["target_features_satisfied", "run_integration_target"],
+ [
+ "TEST_TARGET_REQS=$'memory_artifacts_e2e\\tmemory-git'",
+ 'PRODUCT_FEATURES="channels,flows"',
+ "log() { printf '%s\\n' \"$*\"; }",
+ "llvm_cov() { echo RAN-TARGET; }",
+ ].join("\n"),
+ "run_integration_target memory_artifacts_e2e",
+ );
+
+ assert.equal(result.status, 0, result.output);
+ assert.match(result.output, /skipping memory_artifacts_e2e/);
+ assert.doesNotMatch(result.output, /RAN-TARGET/);
+});
+
+test("an integration target with all required product features runs", () => {
+ const result = withRunnerFunctions(
+ ["target_features_satisfied", "run_integration_target"],
+ [
+ "TEST_TARGET_REQS=$'memory_artifacts_e2e\\tmemory-git'",
+ 'PRODUCT_FEATURES="memory-github,memory-git,flows"',
+ "log() { printf '%s\\n' \"$*\"; }",
+ "llvm_cov() { echo RAN-TARGET; }",
+ ].join("\n"),
+ "run_integration_target memory_artifacts_e2e",
+ );
+
+ assert.equal(result.status, 0, result.output);
+ assert.match(result.output, /RAN-TARGET/);
+});
diff --git a/scripts/ci/README.md b/scripts/ci/README.md
index bd2ab9f399..b01ae93a8d 100644
--- a/scripts/ci/README.md
+++ b/scripts/ci/README.md
@@ -12,14 +12,13 @@ authoritative spec; this is an index so a CI failure log points somewhere.
| `check-module-pins.mjs` + `module-pin-exemptions.json` | A loadable module's registry pin (`crates/openhuman-core/src/modules/registry.rs`) and its `vendor/*` submodule pin must describe the same release (openhuman#5727). The exemptions file records known, expected drift — not a way to silence the gate. Logic lives in `scripts/lib/module-pins.mjs`. |
| `check-submodule-monotonic.mjs` | A `vendor/*` submodule pin may never move backwards onto a commit that is an ancestor of what the base branch already has. |
| `check-toolchain-image.mjs` | The CI image's toolchain, the version-pinned `dtolnay/rust-toolchain@<version>` workflow steps, and `.github/Dockerfile` all match the channel pinned in `rust-toolchain.toml`. |
-| `rust-coverage-changed.sh` | PR fast-lane: runs `cargo-llvm-cov` scoped to only the domains/tests a PR touched instead of the full suite, and escalates to the full suite when scoping selects zero tests. |
-| `vitest-changed-coverage.sh` | Frontend counterpart — runs `vitest related` against changed files instead of the full unit suite. |
-| `assert-coverage-presence.sh` + `coverage-presence-allowlist.txt` | Fails when a changed Rust file produced no lcov records at all, meaning no lane even compiled it (openhuman#5593). Allowlist entries must document, inline, which gate excludes the file and why that's intended. |
-| `list-feature-gated-rust-tests.mjs` | Prints every file under `crates/openhuman-core/src` that carries tests behind a product feature gate (`voice`, `media`, `web3`, `meet`, `mcp`, `skills`, `flows`, `channels`, `contacts`). `ci-lite.yml`'s `rust-feature-gate-smoke` job diffs the output against a checked-in EXPECTED list so a new gated test file forces the scoped `cargo test` filter to be extended (#5022). |
+| `rust-coverage.sh` | Runs the complete product-feature Rust suite under `cargo-llvm-cov`, including every core integration target and the root Rust support crates. |
+| `assert-coverage-presence.sh` + `coverage-presence-allowlist.txt` | Fails when an eligible Rust source file produced no lcov records at all, meaning the full product suite never compiled it (openhuman#5593). Allowlist entries must document, inline, which gate excludes the file and why that's intended. |
+| `list-feature-gated-rust-tests.mjs` | Prints every file under `crates/openhuman-core/src` that carries tests behind a product feature gate (`voice`, `media`, `web3`, `meet`, `mcp`, `skills`, `flows`, `channels`, `contacts`). `ci-lite.yml`'s `rust-feature-gate-smoke` job diffs the output against a checked-in EXPECTED list so a new gated test file forces the gate-contract test filters to be reviewed (#5022). |
| `orch-ip-gate.sh` | Blocks the server-side orchestration "brain" (reasoning/wake graph, its prompts, per-agent model-selection metadata) from re-entering this open client repo. |
-`rust-coverage-changed.sh` and `vitest-changed-coverage.sh` both feed the PR
-CI Gate's changed-line diff-cover check (>= 80%) in `ci-lite.yml`.
+The complete Rust and frontend coverage suites feed the PR CI Gate's
+changed-line diff-cover check (>= 80%) in `ci-lite.yml`.
## Running locally
@@ -30,8 +29,7 @@ Only `check-openhuman-rust-layout.mjs` is wired to a pnpm script
gate here runs from `.github/workflows/ci-lite.yml`; `ci-full.yml` does not
call any of them, and only reaches `product-features.sh` indirectly through
`test-reusable.yml`. Grep `ci-lite.yml` for a script's name to see its exact
-invocation and any required environment (the coverage scripts read `FULL` and
-`CHANGED_FILES` from the workflow's paths-filter step).
+invocation and any required environment.
Long-running CI commands (the coverage lanes) go through
`scripts/ci-cancel-aware.sh`, which lives directly under `scripts/`, not here.
diff --git a/scripts/ci/assert-coverage-presence.sh b/scripts/ci/assert-coverage-presence.sh
index 471b4ea876..dd320c8013 100755
--- a/scripts/ci/assert-coverage-presence.sh
+++ b/scripts/ci/assert-coverage-presence.sh
@@ -1,12 +1,11 @@
#!/usr/bin/env bash
-# Coverage-presence gate: fail when a changed Rust source file produced NO
-# coverage records at all — i.e. the lane never compiled it, so neither the
-# scoped test run nor diff-cover could possibly have verified it.
+# Coverage-presence gate: fail when a Rust source file that should be measured
+# produced no coverage records, so diff-cover could not possibly verify it.
#
# WHY THIS EXISTS (PR #5593). `crates/openhuman-core/src/hosting/**` is gated behind a Cargo
# feature that is in neither `[features] default` nor
# `scripts/ci/product-features.txt`, so the coverage lane compiled none of it.
-# The scoped libtest filter matched nothing (`running 0 tests … ok`) and
+# The former scoped libtest filter matched nothing (`running 0 tests … ok`) and
# diff-cover reported "No lines with coverage information in this diff". Both
# read the ABSENCE of data as "nothing to check" rather than "we checked
# nothing", and 1,643 lines — including a 511-line test file — merged green.
@@ -133,6 +132,12 @@ for line in sys.stdin:
if marker != -1:
print(path[marker + 1 :])
marker = path.rfind("/crates/openhuman-embed/src/")
+ if marker != -1:
+ print(path[marker + 1 :])
+ marker = path.rfind("/crates/openhuman-rpc/src/")
+ if marker != -1:
+ print(path[marker + 1 :])
+ marker = path.rfind("/crates/openhuman-session/src/")
if marker != -1:
print(path[marker + 1 :])
marker = path.rfind("/crates/openhuman-tui/src/")
@@ -188,7 +193,7 @@ eligible() {
base="$(basename "${f}")"
case "${f}" in *.rs) ;; *) return 1 ;; esac # non-Rust: assets, .md, fixtures
- case "${f}" in src/* | crates/openhuman-core/src/* | crates/openhuman-embed/src/* | crates/openhuman-tui/src/*) ;; *) return 1 ;; esac
+ case "${f}" in src/* | crates/openhuman-core/src/* | crates/openhuman-embed/src/* | crates/openhuman-rpc/src/* | crates/openhuman-session/src/* | crates/openhuman-tui/src/*) ;; *) return 1 ;; esac
[ -f "${f}" ] || return 1 # deleted / renamed-away
case "${f}" in src/lib.rs | src/main.rs | src/bin/* | crates/openhuman-core/src/lib.rs | crates/openhuman-core/src/main.rs | crates/openhuman-core/src/bin/* | crates/openhuman-tui/src/lib.rs | crates/openhuman-tui/src/main.rs) return 1 ;; esac
# Test-only sources. We do not demand coverage OF test code, and a test file
@@ -229,11 +234,11 @@ if [ "${MODE}" = all ]; then
# working tree would also be checked, which is harmless (it is a real file
# that either compiled or did not).
listing=""
- if listing="$(git ls-files 'src/*.rs' 'src/**/*.rs' 'crates/openhuman-core/src/*.rs' 'crates/openhuman-core/src/**/*.rs' 'crates/openhuman-embed/src/*.rs' 'crates/openhuman-embed/src/**/*.rs' 'crates/openhuman-tui/src/*.rs' 'crates/openhuman-tui/src/**/*.rs' 2>/dev/null)" && [ -n "${listing}" ]; then
+ if listing="$(git ls-files 'src/*.rs' 'src/**/*.rs' 'crates/openhuman-core/src/*.rs' 'crates/openhuman-core/src/**/*.rs' 'crates/openhuman-embed/src/*.rs' 'crates/openhuman-embed/src/**/*.rs' 'crates/openhuman-rpc/src/*.rs' 'crates/openhuman-rpc/src/**/*.rs' 'crates/openhuman-session/src/*.rs' 'crates/openhuman-session/src/**/*.rs' 'crates/openhuman-tui/src/*.rs' 'crates/openhuman-tui/src/**/*.rs' 2>/dev/null)" && [ -n "${listing}" ]; then
log "enumerating tracked sources with git ls-files"
else
log "git ls-files unavailable or empty — falling back to a filesystem walk"
- listing="$(find src crates/openhuman-core/src crates/openhuman-embed/src crates/openhuman-tui/src -type f -name '*.rs' 2>/dev/null || true)"
+ listing="$(find src crates/openhuman-core/src crates/openhuman-embed/src crates/openhuman-rpc/src crates/openhuman-session/src crates/openhuman-tui/src -type f -name '*.rs' 2>/dev/null || true)"
fi
while IFS= read -r f; do
[ -n "${f}" ] && candidates+=("${f}")
@@ -262,11 +267,11 @@ if [ "${MODE}" = all ] && [ "${checked}" -eq 0 ]; then
fi
if [ "${#unverified[@]}" -eq 0 ]; then
- log "clean — every eligible changed source file produced coverage records"
+ log "clean — every eligible source file produced coverage records"
exit 0
fi
-echo "::error::Coverage lane produced NO records for ${#unverified[@]} changed source file(s) — they were never compiled, so nothing verified them."
+echo "::error::Coverage lane produced NO records for ${#unverified[@]} source file(s) — they were never compiled, so nothing verified them."
for f in "${unverified[@]}"; do
echo "::error file=${f}::${f} produced no coverage records. The coverage lane compiles 'default + scripts/ci/product-features.txt'; if this file sits behind a Cargo feature in neither list it was never built. Fix by adding the gate to product-features.txt (and the shell forwarding list), or record it in scripts/ci/coverage-presence-allowlist.txt with a reason."
done
diff --git a/scripts/ci/rust-coverage-changed.sh b/scripts/ci/rust-coverage-changed.sh
deleted file mode 100755
index 2cbe3543df..0000000000
--- a/scripts/ci/rust-coverage-changed.sh
+++ /dev/null
@@ -1,509 +0,0 @@
-#!/usr/bin/env bash
-# PR CI Rust core coverage lane — changed-files-only cargo-llvm-cov.
-#
-# Fast-lane policy (PRs targeting main): instead of the full ~13k-test
-# instrumented suite, run only the unit tests for the modules the PR touched:
-# - src/<a>/<b>/... .rs → libtest filter "<a>::<b>" (domain-level scope, so
-# sibling-module tests like store_tests.rs / ops.rs still run)
-# - tests/<name>.rs → that integration-test target only (--test <name>)
-# On top of that, a small table (`domain_integration_targets`) drags in the
-# integration targets that GUARD a domain but live outside `--lib`, so a PR
-# touching only that domain's src/ still runs its gate.
-# Coverage from all scoped runs is merged (--no-report + report) into a single
-# lcov file; the PR CI Gate's diff-cover step enforces >= 80% on changed lines.
-#
-# NOTE: this means changed lines must be covered by tests in their own domain
-# (or a changed integration test) — coverage contributed by unrelated suites
-# no longer counts on the fast lane. The full suite still runs on main→release
-# PRs (Release CI).
-#
-# TWO GATES GUARD THE "WE VERIFIED NOTHING" CASE (PR #5593):
-# 1. scripts/ci/assert-coverage-presence.sh — hard failure when a changed
-# source file produced no lcov records at all, i.e. the lane never
-# compiled it. This is the precise one; it names the files.
-# 2. A zero-executed-tests scoped run ESCALATES to the full suite rather than
-# failing. Scoping that selects no tests is unsafe scoping, and this
-# script's standing policy for unsafe scoping is to widen, not to redden —
-# a domain that legitimately owns no unit tests (there are five today,
-# e.g. core::shutdown) must not turn every PR touching it red.
-#
-# Inputs (env):
-# FULL "true" → run the full suite (build-config / lib.rs / script
-# changes, detected by paths-filter)
-# CHANGED_FILES shell-quoted, space-separated repo-relative paths from
-# dorny/paths-filter (list-files: shell)
-# OUT lcov output path (default lcov-core.info)
-#
-# Falls back to the FULL suite whenever scoping is not clearly safe.
-set -euo pipefail
-
-FULL="${FULL:-false}"
-CHANGED_FILES="${CHANGED_FILES:-}"
-OUT="${OUT:-lcov-core.info}"
-MAX_CHANGED_FILES="${MAX_CHANGED_FILES:-200}"
-
-log() { echo "[ci][rust-cov-changed] $*"; }
-
-# The desktop product's gates. `[features] default` is the CONTRIBUTOR set now
-# and deliberately omits voice, web3, documents, meet, contacts, inference and
-# crash-reporting — so a coverage run on default features would silently stop
-# measuring code that ships, and the diff-coverage gate would pass a PR whose
-# changed lines were never compiled. Source of truth:
-# scripts/ci/product-features.txt.
-PRODUCT_FEATURES="$(bash scripts/ci/product-features.sh)"
-
-# The CI job normally supplies a linker-only RUSTFLAGS value. cargo-llvm-cov
-# owns this variable while it compiles coverage-instrumented crates; preserving
-# the outer value suppresses its `-C instrument-coverage` flag and leaves an
-# otherwise successful test run with no .profraw data to report.
-unset RUSTFLAGS
-
-llvm_cov() {
- # `clean` and `report` are cargo-llvm-cov subcommands that take no feature
- # selection; passing --features to them is an error.
- case "${1:-}" in
- clean | report)
- bash scripts/ci-cancel-aware.sh cargo llvm-cov "$@"
- return
- ;;
- esac
- # Let cargo-llvm-cov own compiler instrumentation and raw-profile
- # collection. A hand-exported `show-env` setup can be bypassed by the
- # repository's Cargo wrapper configuration in container jobs.
- bash scripts/ci-cancel-aware.sh cargo llvm-cov --features "${PRODUCT_FEATURES}" "$@"
-}
-
-# Workspace packages which do not need the core product-feature vocabulary.
-llvm_cov_package() {
- bash scripts/ci-cancel-aware.sh cargo llvm-cov "$@"
-}
-
-# The embedding facade mirrors the core's feature names. Forward the product
-# set so its own feature-gated façade modules (not just its core dependency)
-# are compiled and measured too. The TUI does not expose that vocabulary, so
-# it must continue through llvm_cov_package above.
-llvm_cov_embed() {
- bash scripts/ci-cancel-aware.sh cargo llvm-cov --features "${PRODUCT_FEATURES}" "$@"
-}
-
-# Total libtest cases executed across every scoped/full run in this invocation.
-# `run_counted` tees libtest output so the count can be read without changing
-# what the log looks like. `${PIPESTATUS[0]}` — not `$?` — carries the cargo
-# exit status through the pipe; reading `$?` here would report tee's status and
-# turn a failing suite green.
-TESTS_RUN=0
-
-run_counted() {
- local log rc n
- log="$(mktemp)"
- set +e
- "$@" 2>&1 | tee "${log}"
- rc=${PIPESTATUS[0]}
- set -e
- n="$(sed -n 's/^running \([0-9]\{1,\}\) tests\{0,1\}$/\1/p' "${log}" | awk '{s+=$1} END {print s+0}')"
- TESTS_RUN=$((TESTS_RUN + n))
- rm -f "${log}"
- return "${rc}"
-}
-
-integration_test_targets() {
- find tests -maxdepth 1 -type f -name '*.rs' -print |
- sed -e 's#^tests/##' -e 's#\.rs$##' |
- sort
-}
-
-# Integration-test targets a changed *source* path must drag in, on top of its
-# `--lib` filter.
-#
-# The default scoping maps `src/<a>/<b>/…` to the libtest filter `<a>::<b>`,
-# which runs `--lib` only. That is right for domains whose contract is unit
-# tested, and wrong for domains whose contract lives in an integration target:
-# such a gate never runs on a PR that touches only the domain's `src/`.
-#
-# `crates/openhuman-core/src/memory/**` used to sit here, naming the golden-workspace
-# schema gates. Both of those targets — `memory_golden_fixture_e2e` and
-# `memory_golden_parity_e2e` — were deleted in cc99ba9c6, which cut the
-# engine out of the test build. A mapping that names a target Cargo no longer
-# has is not a weaker gate: it is a hard `error: no test target named …` on
-# every PR that touches the domain, so the entry is gone rather than pointed
-# at a substitute. The domain scopes to its `--lib` filter alone until there
-# is a live gate to name again.
-#
-# crates/openhuman-core/src/agent/harness/session/** and crates/openhuman-core/src/threads/goals/**
-# → `agent_turn_overrides_e2e`. Per-turn `TurnOverrides` (`session/types.rs`)
-# are consumed in `session/turn/core_turn.rs`, and the terminal thread-goal
-# APIs live in `threads/goals/runtime.rs`; the whole contract is an
-# integration target, so without this a regression in either could merge
-# through CI Lite having executed none of those assertions. Scoped to the two
-# directories the suite actually guards rather than all of `agent/**`, which
-# would drag this target onto most PRs in the tree for no added signal.
-#
-# Echoes zero or more target names, one per line; the caller tolerates an
-# empty result.
-domain_integration_targets() {
- case "$1" in
- crates/openhuman-core/src/agent/harness/session/* | crates/openhuman-core/src/threads/goals/*)
- printf '%s\n' agent_turn_overrides_e2e
- ;;
- esac
-}
-
-raw_coverage_modules() {
- find tests/raw_coverage -maxdepth 1 -type f -name '*.rs' -print |
- sed -e 's#^tests/raw_coverage/##' -e 's#\.rs$##' |
- sort
-}
-
-# `required-features` of each `[[test]]` target in the core package manifest, as
-# "<name><TAB><comma-separated gates>". Targets without the key are omitted.
-#
-# Parsed from the package manifest rather than `cargo metadata` so this stays a
-# dependency-free awk/bash script (no jq, no python) on bash 3.2 and 5.x alike.
-test_target_required_features() {
- awk '
- /^\[\[test\]\]/ { if (name != "" && req != "") print name "\t" req; name=""; req=""; inblk=1; next }
- /^\[/ { if (name != "" && req != "") print name "\t" req; name=""; req=""; inblk=0 }
- inblk && /^name[ \t]*=/ {
- line=$0; sub(/^name[ \t]*=[ \t]*"/, "", line); sub(/".*$/, "", line); name=line; next
- }
- inblk && /^required-features[ \t]*=/ {
- line=$0
- sub(/^required-features[ \t]*=[ \t]*\[/, "", line); sub(/\].*$/, "", line)
- gsub(/[" ]/, "", line); req=line; next
- }
- END { if (name != "" && req != "") print name "\t" req }
- ' crates/openhuman-core/Cargo.toml
-}
-
-TEST_TARGET_REQS="$(test_target_required_features)"
-
-# True when every `required-features` gate of ${1} is enabled in PRODUCT_FEATURES.
-#
-# **Why this guard exists.** `cargo` only SKIPS a target for unsatisfied
-# `required-features` when the target is selected IMPLICITLY (a bare
-# `cargo test`). Every call site here names the target explicitly
-# (`--test <name>`), and naming an unsatisfiable target is a hard ERROR:
-#
-# error: target `memory_artifacts_e2e` in package `openhuman`
-# requires the features: `memory-git`
-#
-# That never fired while every `required-features` gate happened to be in the
-# product set. Dropping `memory-git` from the product set made
-# `memory_artifacts_e2e` the first unsatisfiable one and took this whole lane
-# down — on a PR that had nothing wrong with it. Skipping here restores the
-# behaviour the `required-features` line was written to express, and keeps the
-# next gate removal from breaking the lane the same way.
-target_features_satisfied() {
- local target="$1" req f
- req="$(printf '%s\n' "${TEST_TARGET_REQS}" | awk -F'\t' -v t="${target}" '$1 == t { print $2 }')"
- [ -n "${req}" ] || return 0
- for f in $(printf '%s' "${req}" | tr ',' ' '); do
- case ",${PRODUCT_FEATURES}," in
- *",${f},"*) ;;
- *) return 1 ;;
- esac
- done
- return 0
-}
-
-run_integration_target() {
- local target="$1"
- if ! target_features_satisfied "${target}"; then
- log "skipping ${target}: required-features not in the product set"
- return 0
- fi
- if [ "${target}" = "raw_coverage_all" ]; then
- # These suites used to be separate integration-test binaries. Aggregating
- # them removes repeated full-crate links, but many still exercise process
- # globals (env vars, event bus handlers, auth tokens, singleton stores).
- # Run one process per generated module filter to preserve the former
- # per-binary isolation contract while still paying only one link.
- #
- # `|| return` is load-bearing, not defensive noise. This loop's exit status
- # is that of its LAST iteration, so a module that fails followed by one that
- # succeeds reports success. That used to be masked by ambient errexit — the
- # function was called bare, so a failing `llvm_cov` aborted the script here.
- # It is no longer: `run_counted` runs its command inside a pipeline with
- # `set +e`, which disables errexit for everything underneath, so without this
- # the failure is silently discarded and a red suite goes green.
- #
- # Returning on the first failure also preserves the previous fail-fast
- # timing exactly: no module ran after a failure before, and none does now.
- while IFS= read -r module; do
- [ -n "${module}" ] || continue
- log "running raw coverage module: ${module}"
- llvm_cov --no-report --no-fail-fast -p openhuman --test "${target}" -- "${module}::" --test-threads=1 || return
- done < <(raw_coverage_modules)
- elif [ "${target}" = "json_rpc_e2e" ]; then
- # This target exercises process-global runtime/config state. Its tests take
- # an environment lock, but background agent tasks can outlive an individual
- # case briefly; keeping libtest serial prevents a successor from observing
- # that teardown window.
- llvm_cov --no-report --no-fail-fast -p openhuman --test "${target}" -- --test-threads=1
- else
- llvm_cov --no-report --no-fail-fast -p openhuman --test "${target}"
- fi
-}
-
-compile_raw_coverage_target() {
- log "compiling raw coverage integration target for src/** change"
- bash scripts/ci-cancel-aware.sh cargo test \
- --features "${PRODUCT_FEATURES}" \
- --test raw_coverage_all --no-run
-}
-
-run_full() {
- log "running FULL instrumented suite (reason: $1)"
- llvm_cov clean --workspace
- # Keep the aggregate unit-test process aligned with the canonical
- # `test-rust-with-mock.sh` runner. A number of fixtures intentionally mutate
- # process-global provider/config state, so libtest's default parallelism can
- # make unrelated tests observe each other's temporary overrides. The five
- # build-only reaper test installs process globals and therefore runs in a
- # fresh process below, exactly as it does in the canonical runner.
- llvm_cov --no-report --no-fail-fast -p openhuman --lib --bins -- \
- --test-threads=1 \
- --skip a_build_only_runtime_is_swept_before_it_can_be_invoked
- # This test deliberately boots a real harness-only CoreBuilder. Doing so
- # installs one-shot process globals (including DEFAULT_CONTEXT), which would
- # narrow every later registry lookup in the aggregate unit-test process.
- log "running isolated build-only reaper test"
- llvm_cov --no-report --no-fail-fast -p openhuman --lib \
- -- "openhuman::agent::tinyagents::reaper::tests::a_build_only_runtime_is_swept_before_it_can_be_invoked" \
- --exact --test-threads=1
- llvm_cov_embed --no-report --no-fail-fast -p openhuman-embed --all-targets
- llvm_cov_package --no-report --no-fail-fast -p openhuman-tui --all-targets
- while IFS= read -r target; do
- [ -n "${target}" ] || continue
- log "running full-suite integration target: ${target}"
- run_integration_target "${target}"
- done < <(integration_test_targets)
- log "merging coverage into ${OUT}"
- llvm_cov report --lcov --output-path "${OUT}"
- # FULL mode has no changed-file list (the workflow blanks CHANGED_FILES to
- # stay under the container's argv limit), so assert the whole-tree invariant
- # instead: no eligible source file may be missing from a full product build's
- # coverage. This is the mode PR #5578 ran in when it first landed the
- # uncompiled hosting family, and it is the mode that would have caught it.
- bash scripts/ci/assert-coverage-presence.sh "${OUT}" --all
- exit 0
-}
-
-if [ "${FULL}" = "true" ]; then
- run_full "build-config/workflow-level change detected by paths-filter"
-fi
-
-# Portable across bash 3.2 (macOS) and 5.x (CI containers): no declare -A,
-# no mapfile, and no empty-array "${arr[@]}" expansion under set -u.
-#
-# CHANGED_FILES is the shell-quoted list from dorny/paths-filter
-# (list-files: shell). Filenames are PR-controlled, so never eval it —
-# xargs unquotes tokens as data without ever invoking a shell. If xargs
-# can't parse it (e.g. hostile quoting), we get an empty list and fall
-# back to the full suite.
-declare -a files=()
-while IFS= read -r f; do
- [ -n "${f}" ] && files+=("${f}")
-done < <(printf '%s\n' "${CHANGED_FILES}" | xargs -n1 printf '%s\n' 2>/dev/null || true)
-log "received ${#files[@]} changed rust file(s)"
-
-src_changed=false
-
-if [ "${#files[@]}" -eq 0 ]; then
- run_full "empty changed-file list — scoping unsafe"
-fi
-if [ "${#files[@]}" -gt "${MAX_CHANGED_FILES}" ]; then
- run_full "${#files[@]} changed files exceed MAX_CHANGED_FILES=${MAX_CHANGED_FILES}"
-fi
-
-lib_filters_raw=""
-test_targets_raw=""
-for f in "${files[@]}"; do
- case "${f}" in
- src/*) src_changed=true ;;
- esac
- if [ ! -e "${f}" ]; then
- # dorny/paths-filter includes deleted paths. They contain no changed lines
- # to cover and, for tests, no longer correspond to runnable Cargo targets.
- log "ignoring deleted rust-relevant path: ${f}"
- continue
- fi
- original_f="${f}"
- case "${f}" in
- crates/openhuman-embed/src/* | crates/openhuman-embed/tests/*)
- lib_filters_raw="${lib_filters_raw}__openhuman_embed__
-"
- log "${original_f} → openhuman-embed test suite"
- continue
- ;;
- crates/openhuman-core/src/*)
- src_changed=true
- f="src/${f#crates/openhuman-core/src/}"
- ;;
- crates/openhuman-tui/src/*)
- lib_filters_raw="${lib_filters_raw}__openhuman_tui__
-"
- log "${original_f} → openhuman-tui unit suite"
- continue
- ;;
- crates/openhuman-tui/tests/*)
- lib_filters_raw="${lib_filters_raw}__openhuman_tui__
-"
- log "${original_f} → openhuman-tui test suite"
- continue
- ;;
- esac
- case "${f}" in
- src/lib.rs | src/main.rs)
- run_full "root module ${f} changed — whole-crate scope"
- ;;
- src/bin/*)
- # Standalone ops/bench binaries have no domain unit tests to scope to.
- log "ignoring standalone-binary file: ${f}"
- ;;
- src/*.rs)
- p="${f#src/}"
- p="${p%.rs}"
- IFS='/' read -r -a segs <<<"${p}"
- n="${#segs[@]}"
- if [ "${segs[n - 1]}" = "mod" ]; then
- segs=("${segs[@]:0:n-1}")
- n="${#segs[@]}"
- fi
- if [ "${n}" -ge 2 ]; then
- key="${segs[0]}::${segs[1]}"
- else
- key="${segs[0]}"
- fi
- lib_filters_raw="${lib_filters_raw}${key}
-"
- log "${original_f} → libtest filter '${key}'"
- while IFS= read -r extra_target; do
- [ -n "${extra_target}" ] || continue
- test_targets_raw="${test_targets_raw}${extra_target}
-"
- log "${f} → integration gate '--test ${extra_target}'"
- done < <(domain_integration_targets "${f}")
- ;;
- src/*/*)
- # Non-.rs asset embedded in a domain (e.g. agent prompt markdown under
- # crates/openhuman-core/src/agent/prompts/) — scope to that domain's tests.
- p="${f#src/}"
- IFS='/' read -r -a segs <<<"${p}"
- n="${#segs[@]}"
- if [ "${n}" -ge 3 ]; then
- key="${segs[0]}::${segs[1]}"
- else
- key="${segs[0]}"
- fi
- lib_filters_raw="${lib_filters_raw}${key}
-"
- log "${original_f} → libtest filter '${key}' (embedded asset)"
- while IFS= read -r extra_target; do
- [ -n "${extra_target}" ] || continue
- test_targets_raw="${test_targets_raw}${extra_target}
-"
- log "${f} → integration gate '--test ${extra_target}'"
- done < <(domain_integration_targets "${f}")
- ;;
- tests/raw_coverage/*.rs)
- # The ~76 *_raw_coverage_e2e.rs suites are aggregated into the single
- # `raw_coverage_all` target (see tests/raw_coverage_all.rs + build.rs), so
- # a change to any of them scopes to that one target rather than the full
- # suite. libtest filters within the aggregate binary still work, but the
- # simplest correct scope is running the whole aggregate target.
- test_targets_raw="${test_targets_raw}raw_coverage_all
-"
- log "${f} → aggregated integration target '--test raw_coverage_all'"
- ;;
- tests/*.rs)
- name="${f#tests/}"
- name="${name%.rs}"
- if [[ "${name}" == */* ]]; then
- # Nested support module — can affect any integration target.
- run_full "shared integration-test support file ${f} changed"
- fi
- test_targets_raw="${test_targets_raw}${name}
-"
- log "${f} → integration target '--test ${name}'"
- ;;
- *)
- run_full "unclassified rust-relevant file ${f} changed"
- ;;
- esac
-done
-
-declare -a lib_filters=()
-while IFS= read -r k; do
- [ -n "${k}" ] && lib_filters+=("${k}")
-done < <(printf '%s' "${lib_filters_raw}" | sort -u)
-
-declare -a test_targets=()
-while IFS= read -r k; do
- [ -n "${k}" ] && test_targets+=("${k}")
-done < <(printf '%s' "${test_targets_raw}" | sort -u)
-
-if [ "${#lib_filters[@]}" -eq 0 ] && [ "${#test_targets[@]}" -eq 0 ]; then
- run_full "no scoped test targets derivable from the change set"
-fi
-
-if [ "${src_changed}" = true ]; then
- # Scoped lib tests cannot compile integration targets that are not selected by
- # a domain mapping. Build the aggregate raw-coverage target on every src/**
- # change so source-only PRs cannot leave a broken integration suite behind.
- compile_raw_coverage_target
-fi
-
-# Drop artifacts from previous coverage runs so merged profdata only reflects
-# this run (build cache for dependencies is unaffected).
-llvm_cov clean --workspace
-
-if [ "${#lib_filters[@]}" -gt 0 ]; then
- declare -a core_filters=()
- run_embed=false
- run_tui=false
- for filter in "${lib_filters[@]}"; do
- case "${filter}" in
- __openhuman_embed__) run_embed=true ;;
- __openhuman_tui__) run_tui=true ;;
- *) core_filters+=("${filter}") ;;
- esac
- done
- if [ "${#core_filters[@]}" -gt 0 ]; then
- log "running scoped lib unit tests with filters: ${core_filters[*]}"
- # libtest ORs multiple positional filters — one run covers all domains.
- run_counted llvm_cov --no-report --no-fail-fast -p openhuman --lib -- "${core_filters[@]}"
- fi
- if [ "${run_embed}" = true ]; then
- log "running openhuman-embed tests"
- run_counted llvm_cov_embed --no-report --no-fail-fast -p openhuman-embed --all-targets
- fi
- if [ "${run_tui}" = true ]; then
- log "running openhuman-tui tests"
- run_counted llvm_cov_package --no-report --no-fail-fast -p openhuman-tui --all-targets
- fi
-fi
-
-if [ "${#test_targets[@]}" -gt 0 ]; then
- for t in "${test_targets[@]}"; do
- log "running changed integration-test target: ${t}"
- run_counted run_integration_target "${t}"
- done
-fi
-
-log "merging coverage into ${OUT}"
-llvm_cov report --lcov --output-path "${OUT}"
-
-# Gate 1 (precise, hard): did the lane produce ANY coverage records for the
-# files this PR changed? Run before the zero-test escalation so the hosting-class
-# defect — a file the build never compiled — fails in ~10 minutes with the file
-# names, instead of first spending ~40 minutes on a full suite that cannot
-# compile it either.
-bash scripts/ci/assert-coverage-presence.sh "${OUT}" --files "${files[@]}"
-
-# Gate 2 (imprecise, safe): a scoped run that executed no tests verified
-# nothing. Widen rather than fail — see the header note.
-if [ "${TESTS_RUN}" -eq 0 ]; then
- log "scoped run executed 0 tests (filters: ${lib_filters[*]-none}; targets: ${test_targets[*]-none})"
- run_full "scoped run executed 0 tests — scoping selected no coverage"
-fi
diff --git a/scripts/ci/rust-coverage.sh b/scripts/ci/rust-coverage.sh
new file mode 100755
index 0000000000..c39cde22aa
--- /dev/null
+++ b/scripts/ci/rust-coverage.sh
@@ -0,0 +1,146 @@
+#!/usr/bin/env bash
+# PR CI Rust coverage lane.
+#
+# Every Rust-core change runs the complete product-feature test suite. Path
+# filtering decides whether this high-level area runs; it never narrows the
+# suite to changed files or source modules.
+set -euo pipefail
+
+OUT="${OUT:-lcov-core.info}"
+PRODUCT_FEATURES="$(bash scripts/ci/product-features.sh)"
+
+log() { echo "[ci][rust-cov] $*"; }
+
+# cargo-llvm-cov owns RUSTFLAGS while it instruments crates. Keeping the
+# job-level linker flag here can suppress instrumentation and produce no data.
+unset RUSTFLAGS
+
+llvm_cov() {
+ case "${1:-}" in
+ clean | report)
+ bash scripts/ci-cancel-aware.sh cargo llvm-cov "$@"
+ ;;
+ *)
+ bash scripts/ci-cancel-aware.sh cargo llvm-cov \
+ --features "${PRODUCT_FEATURES}" "$@"
+ ;;
+ esac
+}
+
+llvm_cov_package() {
+ bash scripts/ci-cancel-aware.sh cargo llvm-cov "$@"
+}
+
+llvm_cov_embed() {
+ bash scripts/ci-cancel-aware.sh cargo llvm-cov \
+ --features "${PRODUCT_FEATURES}" "$@"
+}
+
+integration_test_targets() {
+ find tests -maxdepth 1 -type f -name '*.rs' -print |
+ sed -e 's#^tests/##' -e 's#\.rs$##' |
+ sort
+}
+
+raw_coverage_modules() {
+ find tests/raw_coverage -maxdepth 1 -type f -name '*.rs' -print |
+ sed -e 's#^tests/raw_coverage/##' -e 's#\.rs$##' |
+ sort
+}
+
+# Print each explicitly declared integration-test target and its required
+# features as "<name><TAB><comma-separated gates>".
+test_target_required_features() {
+ awk '
+ /^\[\[test\]\]/ { if (name != "" && req != "") print name "\t" req; name=""; req=""; inblk=1; next }
+ /^\[/ { if (name != "" && req != "") print name "\t" req; name=""; req=""; inblk=0 }
+ inblk && /^name[ \t]*=/ {
+ line=$0; sub(/^name[ \t]*=[ \t]*"/, "", line); sub(/".*$/, "", line); name=line; next
+ }
+ inblk && /^required-features[ \t]*=/ {
+ line=$0
+ sub(/^required-features[ \t]*=[ \t]*\[/, "", line); sub(/\].*$/, "", line)
+ gsub(/[" ]/, "", line); req=line; next
+ }
+ END { if (name != "" && req != "") print name "\t" req }
+ ' crates/openhuman-core/Cargo.toml
+}
+
+TEST_TARGET_REQS="$(test_target_required_features)"
+
+target_features_satisfied() {
+ local target="$1" req feature
+ req="$(printf '%s\n' "${TEST_TARGET_REQS}" | awk -F'\t' -v t="${target}" '$1 == t { print $2 }')"
+ [ -n "${req}" ] || return 0
+ for feature in $(printf '%s' "${req}" | tr ',' ' '); do
+ case ",${PRODUCT_FEATURES}," in
+ *",${feature},"*) ;;
+ *) return 1 ;;
+ esac
+ done
+}
+
+run_integration_target() {
+ local target="$1"
+ if ! target_features_satisfied "${target}"; then
+ log "skipping ${target}: required features are not in the product set"
+ return 0
+ fi
+
+ if [ "${target}" = "raw_coverage_all" ]; then
+ # These modules mutate process-global state. Keep one process per module
+ # while paying the link cost for the aggregate target only once.
+ while IFS= read -r module; do
+ [ -n "${module}" ] || continue
+ log "running raw coverage module: ${module}"
+ llvm_cov --no-report --no-fail-fast -p openhuman \
+ --test "${target}" -- "${module}::" --test-threads=1 || return
+ done < <(raw_coverage_modules)
+ elif [ "${target}" = "json_rpc_e2e" ]; then
+ # JSON-RPC tests share runtime/config globals and must remain serial.
+ llvm_cov --no-report --no-fail-fast -p openhuman \
+ --test "${target}" -- --test-threads=1
+ else
+ llvm_cov --no-report --no-fail-fast -p openhuman --test "${target}"
+ fi
+}
+
+log "running complete instrumented Rust suite"
+llvm_cov clean --workspace
+
+# Keep the aggregate unit-test process aligned with the canonical Rust runner.
+# The isolated reaper test installs one-shot process globals, so it cannot run
+# in the same process as the rest of the library tests.
+llvm_cov --no-report --no-fail-fast -p openhuman --lib --bins -- \
+ --test-threads=1 \
+ --skip a_build_only_runtime_is_swept_before_it_can_be_invoked
+
+log "running isolated build-only reaper test"
+llvm_cov --no-report --no-fail-fast -p openhuman --lib -- \
+ openhuman::agent::tinyagents::reaper::tests::a_build_only_runtime_is_swept_before_it_can_be_invoked \
+ --exact --test-threads=1
+
+# Run every root-workspace Rust support crate rather than only crates named by
+# changed paths. Product features are forwarded to the embedding facade; the
+# remaining crates do not expose that feature vocabulary.
+llvm_cov_embed --no-report --no-fail-fast -p openhuman-embed --all-targets
+llvm_cov_package --no-report --no-fail-fast -p openhuman-rpc --all-targets
+llvm_cov_package --no-report --no-fail-fast -p openhuman-session --all-targets
+llvm_cov_package --no-report --no-fail-fast -p openhuman-tui --all-targets
+
+while IFS= read -r target; do
+ [ -n "${target}" ] || continue
+ log "running integration target: ${target}"
+ run_integration_target "${target}"
+done < <(integration_test_targets)
+
+# Doctests are not collected by cargo-llvm-cov, but they are still part of the
+# complete Rust test suite and must run whenever the Rust-core area changes.
+bash scripts/ci-cancel-aware.sh cargo test -p openhuman \
+ --doc --features "${PRODUCT_FEATURES}"
+
+log "merging coverage into ${OUT}"
+llvm_cov report --lcov --output-path "${OUT}"
+
+# A full product build must produce records for every eligible source file.
+bash scripts/ci/assert-coverage-presence.sh "${OUT}" --all
diff --git a/scripts/ci/vitest-changed-coverage.sh b/scripts/ci/vitest-changed-coverage.sh
deleted file mode 100755
index f6cb5d8d0f..0000000000
--- a/scripts/ci/vitest-changed-coverage.sh
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env bash
-# PR CI frontend unit-test lane — changed-files-only Vitest.
-#
-# Fast-lane policy (PRs targeting main): run only the tests related to the
-# files the PR actually changed, via `vitest related` (static import graph —
-# reliable here because dynamic imports are banned in app/src). Coverage is
-# still written to app/coverage/lcov.info; the PR CI Gate's diff-cover step
-# then enforces >= 80% on changed lines. Untested changed files still appear
-# in the lcov report at 0% (vitest coverage.include is explicit), so the gate
-# cannot be dodged by having no related tests.
-#
-# Inputs (env):
-# FULL "true" → run the entire suite with coverage (config-level
-# change: lockfile, vitest/vite/ts config, test setup, etc.)
-# CHANGED_FILES shell-quoted, space-separated repo-relative paths from
-# dorny/paths-filter (list-files: shell)
-#
-# Falls back to the FULL suite whenever scoping is not clearly safe.
-set -euo pipefail
-
-FULL="${FULL:-false}"
-CHANGED_FILES="${CHANGED_FILES:-}"
-# Above this many changed source files a scoped run buys little and the
-# argv/related-graph bookkeeping gets silly — just run everything.
-MAX_RELATED_FILES="${MAX_RELATED_FILES:-200}"
-
-log() { echo "[ci][vitest-changed] $*"; }
-
-run_full() {
- log "running FULL Vitest coverage suite (reason: $1)"
- exec bash scripts/ci-cancel-aware.sh pnpm --filter openhuman-app test:coverage
-}
-
-if [ "${FULL}" = "true" ]; then
- run_full "config/workflow-level change detected by paths-filter"
-fi
-
-# CHANGED_FILES is the shell-quoted list from dorny/paths-filter
-# (list-files: shell). Filenames are PR-controlled, so never eval it —
-# xargs unquotes tokens as data without ever invoking a shell. If xargs
-# can't parse it (e.g. hostile quoting), we get an empty list and fall
-# back to the full suite.
-declare -a files=()
-while IFS= read -r f; do
- [ -n "${f}" ] && files+=("${f}")
-done < <(printf '%s\n' "${CHANGED_FILES}" | xargs -n1 printf '%s\n' 2>/dev/null || true)
-log "received ${#files[@]} changed frontend file(s)"
-
-if [ "${#files[@]}" -eq 0 ]; then
- run_full "empty changed-file list — scoping unsafe"
-fi
-
-declare -a related=()
-for f in "${files[@]}"; do
- case "${f}" in
- app/src/*.ts | app/src/*.tsx) ;;
- *)
- log "ignoring non-source path: ${f}"
- continue
- ;;
- esac
- if [ ! -f "${f}" ]; then
- log "skipping deleted/renamed file: ${f}"
- continue
- fi
- # vitest runs from app/ (config root) — strip the workspace prefix.
- related+=("${f#app/}")
-done
-
-if [ "${#related[@]}" -eq 0 ]; then
- run_full "no surviving changed .ts/.tsx files under app/src — scoping unsafe"
-fi
-if [ "${#related[@]}" -gt "${MAX_RELATED_FILES}" ]; then
- run_full "${#related[@]} changed files exceed MAX_RELATED_FILES=${MAX_RELATED_FILES}"
-fi
-
-log "running 'vitest related' with coverage for ${#related[@]} file(s):"
-printf '[ci][vitest-changed] %s\n' "${related[@]}"
-
-cd app
-exec bash ../scripts/ci-cancel-aware.sh pnpm exec vitest related --run --coverage --config test/vitest.config.ts "${related[@]}"
diff --git a/tests/README.md b/tests/README.md
index bc3010a193..797a8f25c6 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -73,7 +73,7 @@ flakes.
- Domain unit tests live beside their modules as `*_tests.rs` under
`crates/openhuman-core/src/<domain>/`, not here.
- Coverage bookkeeping: `docs/TEST-COVERAGE-MATRIX.md`. PR changed-line
- coverage must be at least 80% (`scripts/ci/rust-coverage-changed.sh`,
+ coverage must be at least 80% (`scripts/ci/rust-coverage.sh`,
`scripts/ci/assert-coverage-presence.sh`).
- Frontend E2E lives in `app/test/e2e/`, using
`app/test/e2e/helpers/element-helpers.ts` rather than raw platform element
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 4ca4c8cfca..d0c7ccb015 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -3741,7 +3741,7 @@ async fn json_rpc_memory_sync_and_learn() {
// source. So clear it first.
//
// This is safe only because the coverage lane runs this target serially —
- // `scripts/ci/rust-coverage-changed.sh`, in `run_integration_target()`:
+ // `scripts/ci/rust-coverage.sh`, in `run_integration_target()`:
// llvm_cov ... --test "${target}" -- --test-threads=1
// If that ever stops being true, a concurrent case would have its store
// wiped underneath it and this is the line that made that possible.