The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(ci): make the domain e2e coverage gate measure what it claims to\n\nThe gate reported 100% for five namespaces it had measured nothing in, and\nnever looked at ~50 more at all. Three defects, all provable:\n\n(a) Discovery read only files whose PATH matched /(^|\/)schemas?(\.rs|\/)/.\n The 2026-08-30 include! split (#5856/#5857) moved ControllerSchema literals\n into *_part_NN.rs siblings that the pattern does not match -- flows into\n flows_schema_part_01/02.rs, and the same for threads, tools, composio,\n inference, memory/sources, mcp/registry, agent/learning, agent/orchestration.\n 13 files and 180 controllers went invisible in one commit with no signal.\n Restoring the old filter on top of this change drops discovery from 625\n controllers / 83 namespaces to 445 / 72.\n\n The path filter bought nothing a content match does not: a file with no\n ControllerSchema literal contributes nothing either way. Dropped it.\n\n(b) percent = expected.size === 0 ? 100 : ... turned "measured nothing" into a\n pass. On this tree the old script prints, verbatim:\n\n | channels | channels | 0/0 | 100.0% | - |\n | composio | composio | 0/0 | 100.0% | - |\n | threads | threads | 0/0 | 100.0% | - |\n | tools | tools | 0/0 | 100.0% | - |\n | memory_sources | memory_sources | 0/0 | 100.0% | - |\n\n indistinguishable from genuine full coverage. A namespace named in MODULES\n with no discovered controllers is now a hard failure with its own message,\n which says explicitly that nothing was measured.\n\n channels is the case that made this load-bearing rather than theoretical:\n its 20 controllers are declared in the vendored tinychannels-bus crate as\n ChannelControllerSchema literals, and openhuman's adapter only maps them\n across with a dynamic namespace field no static scan can read. Added that\n crate as a second schema root, as\n app/src/services/__tests__/rpcMethods.test.ts already does for the same\n reason. channels now measures 18/20.\n\n(c) MODULES was the SCOPE of the check, so a namespace nobody added a line for\n was never measured at any threshold: webhooks, skill_runtime, subagent,\n mcp_setup, flows, skills, cron, voice, workflow_run, team, billing, medulla\n and ~40 more. MODULES is now presentational grouping only; every discovered\n namespace is measured whether or not it is listed. A list you must remember\n to extend is a list that silently stops covering things.\n\nHonest numbers, not tuned -- threshold left at 90:\n\n before: 17 namespaces, 4 failing\n after : 83 namespaces, 625 controllers, 359 named by an e2e target (57.4%),\n 62 namespaces below 90%, 39 of them at 0%\n\nThe worst are whole namespaces with no Rust e2e at all: webhooks 0/13,\nlearning 0/11, medulla 0/9, session_db 0/6, skill_runtime 0/6, mcp_setup 0/6,\nsocket 0/5, memory_goals 0/5, test_support 0/5.\n\nAlso documented, not fixed: coverage is a string match, so a method NAMED by an\ne2e target counts as covered without being provably invoked. Measured both\ncheap tightenings before leaving it -- comment-only credit is exactly zero\ntoday (390 methods with comments, 390 without), and bare-list-entry credit is\nnot separable by line shape, because rustfmt puts a long call's method argument\non its own line and a list element looks identical. Separating them needs an AST.\n\nscripts/__tests__/coverage-script-help.test.mjs still passes.\n
M3gA-Mindf63e7187dcc2
diff --git a/scripts/check-domain-e2e-coverage.mjs b/scripts/check-domain-e2e-coverage.mjsindex 29d3dd8370..679a7e7e06 100644--- a/scripts/check-domain-e2e-coverage.mjs+++ b/scripts/check-domain-e2e-coverage.mjs@@ -29,6 +29,21 @@ if (!Number.isFinite(THRESHOLD) || THRESHOLD < 0 || THRESHOLD > 100) {process.exit(2);}+// Curated labels for namespaces that read better grouped, plus the namespaces+// this gate was originally written to watch. This list is now PRESENTATIONAL+// and a safety net, not the scope of the check: every namespace discovered in+// the source is measured whether or not it appears here (see `rows` below).+//+// It used to be the scope, and that was the bug. Fifty-odd namespaces —+// `flows`, `skills`, `skill_runtime`, `webhooks`, `cron`, `subagent`,+// `mcp_setup`, `workflow_run`, `voice`, `billing`, `team`, … — were never+// measured at any threshold simply because nobody added a line here, and+// nothing made that visible. A list you must remember to extend is a list that+// silently stops covering things.+//+// A namespace named here that no longer exists in the source is a hard failure:+// it means either the namespace was deleted (drop the line) or discovery has+// stopped seeing it (fix discovery). Both are worth a red lane.const MODULES = [{ label: 'config', namespaces: ['config'] },{ label: 'credentials', namespaces: ['auth'] },@@ -49,7 +64,22 @@ const MODULES = [{ label: 'threads', namespaces: ['threads'] },];-const TARGET_NAMESPACES = new Set(MODULES.flatMap((module) => module.namespaces));+// Where `ControllerSchema` literals live.+//+// `src/openhuman` is the bulk. The second root is not optional: the `channels`+// namespace's 20 controllers are declared in the vendored TinyChannels *bus*+// crate as `ChannelControllerSchema` literals, and openhuman's+// `channels/controllers/schemas.rs` only maps them across with+// `namespace: schema.namespace` — dynamic fields no static scan can read. With+// only the first root, `channels` discovers zero controllers and (before the+// fix below) scored a vacuous 100%.+//+// `app/src/services/__tests__/rpcMethods.test.ts` already reaches into the same+// vendored crate for the same reason.+const SCHEMA_ROOTS = [+ path.join(ROOT, 'src', 'openhuman'),+ path.join(ROOT, 'vendor', 'tinychannels', 'crates', 'tinychannels-bus', 'src', 'controllers'),+];function walk(dir, predicate, out = []) {if (!fs.existsSync(dir)) return out;@@ -68,6 +98,27 @@ function read(file) {return fs.readFileSync(file, 'utf8');}+/**+ * Every `"openhuman.x_y"` string literal appearing in a `tests/**\/*_e2e.rs`.+ *+ * KNOWN LIMITATION, left in place deliberately. This is a text match, so a+ * method named anywhere in such a file counts as covered — including in a+ * schema-catalog assertion list that never calls it.+ *+ * Two tightenings were measured before deciding to leave it:+ *+ * - Ignoring comments: **zero** methods are credited by a comment alone today+ * (390 found with comments, 390 without), so stripping them is a no-op that+ * would only add a regex able to mangle a string literal containing `//`.+ * - Ignoring bare list entries: not separable by line shape. rustfmt puts a+ * long call's method argument on its own line, so an invocation and a list+ * element look identical (`"openhuman.flows_create",` is a list entry by+ * shape and a real `post_json_rpc` argument at `json_rpc_e2e.rs:11049`).+ * Telling them apart needs an AST, which is a different tool than this.+ *+ * So: a method credited here is *named* by an e2e target, not provably invoked+ * by one. Read the percentages with that in mind.+ */function collectInvokedMethods() {const methods = new Set();const testsDir = path.join(ROOT, 'tests');@@ -83,24 +134,38 @@ function collectInvokedMethods() {return methods;}+/**+ * Every controller declared anywhere under `SCHEMA_ROOTS`, keyed by namespace.+ *+ * This reads EVERY `.rs` file under those roots. It used to read only files+ * whose path matched `/(^|\/)schemas?(\.rs|\/)/`, which stopped working on+ * 2026-08-30: the `include!` split (#5856/#5857) moved `ControllerSchema`+ * literals out of `schemas.rs` into `*_part_NN.rs` siblings that the pattern+ * does not match, and out of `flows/schemas.rs` into `flows_schema_part_*.rs`+ * entirely. Thirteen files and 180 controllers went invisible in one commit,+ * with no signal — the gate simply reported a smaller world.+ *+ * The path filter bought nothing a content match does not: a file with no+ * `ControllerSchema` literal contributes nothing either way. Dropping it means+ * the next refactor that moves a declaration cannot repeat this.+ */function collectSchemaMethods() {- const methodsByNamespace = new Map([...TARGET_NAMESPACES].map((namespace) => [namespace, new Set()]));- const files = walk(path.join(ROOT, 'src', 'openhuman'), (file) => {- const normalized = file.split(path.sep).join('/');- return file.endsWith('.rs') && /(^|\/)schemas?(\.rs|\/)/.test(normalized);- });+ const methodsByNamespace = new Map();- for (const file of files) {- const text = read(file);- const constNamespace = text.match(/const\s+NAMESPACE:\s*&str\s*=\s*"([a-z_]+)"/)?.[1];- for (const match of text.matchAll(/ControllerSchema\s*\{([\s\S]*?)\n\s*\}/g)) {- const block = match[1];- const namespaceToken = block.match(/namespace:\s*(?:NAMESPACE|"([a-z_]+)")/);- const functionName = block.match(/function:\s*"([A-Za-z0-9_]+)"/)?.[1];- const namespace = namespaceToken?.[1] ?? (namespaceToken ? constNamespace : undefined);- if (!namespace || !functionName || functionName === 'unknown') continue;- if (!TARGET_NAMESPACES.has(namespace)) continue;- methodsByNamespace.get(namespace).add(`openhuman.${namespace}_${functionName}`);+ for (const root of SCHEMA_ROOTS) {+ for (const file of walk(root, (f) => f.endsWith('.rs'))) {+ const text = read(file);+ const constNamespace = text.match(/const\s+NAMESPACE:\s*&str\s*=\s*"([a-z_]+)"/)?.[1];+ // `ChannelControllerSchema` is the vendored bus crate's equivalent shape.+ for (const match of text.matchAll(/(?:Channel)?ControllerSchema\s*\{([\s\S]*?)\n\s*\}/g)) {+ const block = match[1];+ const namespaceToken = block.match(/namespace:\s*(?:NAMESPACE|"([a-z_]+)")/);+ const functionName = block.match(/function:\s*"([A-Za-z0-9_]+)"/)?.[1];+ const namespace = namespaceToken?.[1] ?? (namespaceToken ? constNamespace : undefined);+ if (!namespace || !functionName || functionName === 'unknown') continue;+ if (!methodsByNamespace.has(namespace)) methodsByNamespace.set(namespace, new Set());+ methodsByNamespace.get(namespace).add(`openhuman.${namespace}_${functionName}`);+ }}}@@ -109,37 +174,83 @@ function collectSchemaMethods() {const invoked = collectInvokedMethods();const schemas = collectSchemaMethods();++const labelForNamespace = new Map();+for (const module of MODULES) {+ for (const namespace of module.namespaces) labelForNamespace.set(namespace, module.label);+}++// A MODULES entry naming a namespace discovery cannot find. Either the+// namespace is gone (delete the line) or discovery broke (fix it). Reporting+// this as 0/0 = 100% is exactly the bug this gate had.+const declaredButMissing = [...labelForNamespace.keys()]+ .filter((namespace) => !schemas.has(namespace))+ .sort();++// One row per namespace that actually exists, grouped where MODULES says so.+const rows = new Map();+for (const [namespace, methods] of schemas) {+ const label = labelForNamespace.get(namespace) ?? namespace;+ if (!rows.has(label)) rows.set(label, { label, namespaces: [], expected: new Set() });+ const row = rows.get(label);+ row.namespaces.push(namespace);+ for (const method of methods) row.expected.add(method);+}+let failed = false;+const below = [];console.log(`Domain Rust E2E controller coverage threshold: ${THRESHOLD}%`);console.log('');console.log('| Module | Namespace(s) | Covered | Percent | Missing |');console.log('| --- | --- | ---: | ---: | --- |');-for (const module of MODULES) {- const expected = new Set();- const covered = new Set();- for (const namespace of module.namespaces) {- for (const method of schemas.get(namespace) ?? []) expected.add(method);- }- for (const method of expected) {- if (invoked.has(method)) covered.add(method);- }+for (const row of [...rows.values()].sort((a, b) => a.label.localeCompare(b.label))) {+ const covered = new Set([...row.expected].filter((method) => invoked.has(method)));+ const missing = [...row.expected].filter((method) => !covered.has(method)).sort();- const missing = [...expected].filter((method) => !covered.has(method)).sort();- const percent = expected.size === 0 ? 100 : (covered.size / expected.size) * 100;+ // `expected.size === 0` used to score 100%. It cannot happen here — a row+ // only exists because discovery found at least one controller for it — and+ // the case it used to hide is now `declaredButMissing` above.+ const percent = (covered.size / row.expected.size) * 100;const missingText = missing.length === 0 ? '-' : missing.join('<br>');console.log(- `| ${module.label} | ${module.namespaces.join(', ')} | ${covered.size}/${expected.size} | ${percent.toFixed(1)}% | ${missingText} |`,+ `| ${row.label} | ${row.namespaces.sort().join(', ')} | ${covered.size}/${row.expected.size} | ${percent.toFixed(1)}% | ${missingText} |`,);- if (expected.size > 0 && percent < THRESHOLD) failed = true;+ if (percent < THRESHOLD) {+ failed = true;+ below.push(`${row.label} (${covered.size}/${row.expected.size}, ${percent.toFixed(1)}%)`);+ }+}++const totalExpected = [...rows.values()].reduce((sum, row) => sum + row.expected.size, 0);+const totalCovered = [...rows.values()].reduce(+ (sum, row) => sum + [...row.expected].filter((method) => invoked.has(method)).length,+ 0,+);+console.log('');+console.log(+ `Discovered ${totalExpected} controllers across ${rows.size} namespaces; ${totalCovered} invoked by a tests/**/*_e2e.rs target.`,+);++if (declaredButMissing.length > 0) {+ failed = true;+ console.error(+ `\nMODULES names ${declaredButMissing.length} namespace(s) with no discovered controllers: ${declaredButMissing.join(', ')}.` ++ '\nEither the namespace was removed (drop it from MODULES) or schema discovery has stopped seeing it (fix SCHEMA_ROOTS / the match).' ++ '\nThis is NOT a coverage result — nothing was measured.',+ );}if (failed) {- console.error(`\nDomain Rust E2E controller coverage is below ${THRESHOLD}% for one or more modules.`);+ if (below.length > 0) {+ console.error(+ `\nDomain Rust E2E controller coverage is below ${THRESHOLD}% for ${below.length} module(s):\n ${below.join('\n ')}`,+ );+ }process.exit(1);}-console.log(`\nAll named modules meet the ${THRESHOLD}% Rust E2E controller coverage threshold.`);+console.log(`\nAll ${rows.size} namespaces meet the ${THRESHOLD}% Rust E2E controller coverage threshold.`);