Skip to content

refactor: split OpenHuman Rust tests and oversized modules - #5856

Merged
senamakel merged 9 commits into
tinyhumansai:mainfrom
senamakel:split-openhuman-tests-modules
Aug 30, 2026
Merged

senamakel merged 9 commits into
tinyhumansai:mainfrom
senamakel:split-openhuman-tests-modules

Conversation

@senamakel

@senamakel senamakel commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Moves inline Rust unit tests under src/openhuman into sibling *_tests.rs files.
  • Splits oversized test and production modules into smaller files centered on the 750-line limit.
  • Adds a CI layout gate that rejects inline test modules, legacy tests.rs/test.rs names, oversized test files, and new oversized production files.
  • Ratchets four remaining legacy production exceptions at their current sizes so they cannot grow while deeper semantic extraction remains follow-up work.

Problem

  • Tests embedded in production modules and very large Rust files make src/openhuman difficult to navigate and review.
  • There was no automated guard preventing files from growing beyond the requested 750-line limit or inline tests from being reintroduced.

Solution

  • Extracted 721 inline test modules into explicitly wired sibling *_tests.rs files and split oversized test suites into focused parts.
  • Split large production files along existing type, schema, operation, and implementation boundaries without intentionally changing behavior.
  • Added scripts/ci/check-openhuman-rust-layout.mjs, exposed it as pnpm rust:layout, and wired it into CI Lite.
  • The gate permits only four named legacy production files above 750 lines, pinned to their current line counts; any growth or new exception fails CI.

Submission Checklist

If a section does not apply to this change, mark the item as N/A with a one-line reason. Do not delete items.

  • Tests added or updated (happy path + at least one failure / edge case) per Testing Strategy — existing unit tests were relocated and compile successfully; no behavior was added.
  • Diff coverage ≥ 80% — changed lines (Vitest + cargo-llvm-cov merged via diff-cover) meet the gate enforced by .github/workflows/ci-lite.yml. CI will verify the structural refactor against the preserved test suite.
  • N/A: no feature rows were added, removed, or renamed in docs/TEST-COVERAGE-MATRIX.md; this is a source-layout-only change.
  • N/A: no feature IDs are affected by this source-layout-only change.
  • No new external network dependencies introduced.
  • N/A: no release-cut surface or user workflow changed.
  • N/A: no linked issue was supplied for this maintenance refactor.

Impact

  • No intended runtime, platform, security, migration, compatibility, or user-visible behavior change.
  • Rust module paths internal to src/openhuman are reorganized; public behavior and test coverage are preserved.
  • New and modified OpenHuman Rust files are constrained to 750 lines. Four legacy hotspots remain ratcheted exceptions pending deeper refactors:
    • src/openhuman/agent/harness/session/builder/factory.rs (1,552)
    • src/openhuman/agent/harness/subagent_runner/ops/runner.rs (1,766)
    • src/openhuman/tools/ops.rs (1,502)
    • src/openhuman/web_chat/progress_bridge.rs (1,547)

Related

  • Closes: N/A — maintenance request without a linked issue.
  • Follow-up PR(s)/TODOs: semantically extract the four ratcheted legacy production files below 750 lines.

AI Authored PR Metadata (required for Codex/Linear PRs)

Keep this section for AI-authored PRs. For human-only PRs, mark each field N/A.

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: split-openhuman-tests-modules
  • Commit SHA: 23ee2cc69

Validation Run

  • pnpm --filter openhuman-app format:check — Prettier passed; Rust-wide formatting is documented below as blocked by unchanged vendored files.
  • pnpm typecheck
  • Focused tests: cargo test --lib --no-run
  • Rust fmt/check (if changed): changed files formatted; cargo check --lib, core cargo clippy -p openhuman -- -D warnings, and node scripts/ci/check-openhuman-rust-layout.mjs passed.
  • Tauri fmt/check (if changed): N/A — no Tauri source changed; Tauri clippy nevertheless passed in the pre-push hook.

Validation Blocked

  • command: git push pre-push hook (pnpm format:check and pnpm lint:ui-tokens)
  • error: Root cargo fmt --all --check reports formatting drift in six unchanged files inside the pinned vendor/tinymemory submodule; lint:ui-tokens references the absent pre-existing path app/src/components/orchestration/.
  • impact: The hook could not complete cleanly, so the branch was pushed with --no-verify after Prettier, TypeScript, core clippy, Tauri clippy, OpenHuman layout validation, core compilation, and test compilation passed. No vendored or frontend files are changed by this PR.

Behavior Changes

  • Intended behavior change: None; source and test layout only.
  • User-visible effect: None.

Parity Contract

  • Legacy behavior preserved: Existing tests were moved without changing their assertions, and the library test target compiles.
  • Guard/fallback/dispatch parity checks: Module wiring uses explicit #[path = "*_tests.rs"]; the layout script verifies all tests remain external and file-size rules remain enforced.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): None found for this branch.
  • Canonical PR: This PR.
  • Resolution (closed/superseded/updated): N/A.

senamakel and others added 8 commits August 30, 2026 19:08
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel requested a review from a team August 30, 2026 16:53
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-08-30T17:09:39.663096Z b646869 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62c2691db6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci-lite.yml
Comment thread scripts/ci/check-openhuman-rust-layout.mjs
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@senamakel
senamakel merged commit e6eefbd into tinyhumansai:main Aug 30, 2026
16 of 25 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b646869586

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/openhuman/agent/harness/builtin_definitions.rs
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Aug 31, 2026
The gate reported 100% for five namespaces it had measured nothing in, and
never looked at ~50 more at all. Three defects, all provable:

(a) Discovery read only files whose PATH matched /(^|\/)schemas?(\.rs|\/)/.
    The 2026-08-30 include! split (tinyhumansai#5856/tinyhumansai#5857) moved ControllerSchema literals
    into *_part_NN.rs siblings that the pattern does not match -- flows into
    flows_schema_part_01/02.rs, and the same for threads, tools, composio,
    inference, memory/sources, mcp/registry, agent/learning, agent/orchestration.
    13 files and 180 controllers went invisible in one commit with no signal.
    Restoring the old filter on top of this change drops discovery from 625
    controllers / 83 namespaces to 445 / 72.

    The path filter bought nothing a content match does not: a file with no
    ControllerSchema literal contributes nothing either way. Dropped it.

(b) percent = expected.size === 0 ? 100 : ... turned "measured nothing" into a
    pass. On this tree the old script prints, verbatim:

        | channels       | channels       | 0/0 | 100.0% | - |
        | composio       | composio       | 0/0 | 100.0% | - |
        | threads        | threads        | 0/0 | 100.0% | - |
        | tools          | tools          | 0/0 | 100.0% | - |
        | memory_sources | memory_sources | 0/0 | 100.0% | - |

    indistinguishable from genuine full coverage. A namespace named in MODULES
    with no discovered controllers is now a hard failure with its own message,
    which says explicitly that nothing was measured.

    channels is the case that made this load-bearing rather than theoretical:
    its 20 controllers are declared in the vendored tinychannels-bus crate as
    ChannelControllerSchema literals, and openhuman's adapter only maps them
    across with a dynamic namespace field no static scan can read. Added that
    crate as a second schema root, as
    app/src/services/__tests__/rpcMethods.test.ts already does for the same
    reason. channels now measures 18/20.

(c) MODULES was the SCOPE of the check, so a namespace nobody added a line for
    was never measured at any threshold: webhooks, skill_runtime, subagent,
    mcp_setup, flows, skills, cron, voice, workflow_run, team, billing, medulla
    and ~40 more. MODULES is now presentational grouping only; every discovered
    namespace is measured whether or not it is listed. A list you must remember
    to extend is a list that silently stops covering things.

Honest numbers, not tuned -- threshold left at 90:

    before: 17 namespaces, 4 failing
    after : 83 namespaces, 625 controllers, 359 named by an e2e target (57.4%),
            62 namespaces below 90%, 39 of them at 0%

The worst are whole namespaces with no Rust e2e at all: webhooks 0/13,
learning 0/11, medulla 0/9, session_db 0/6, skill_runtime 0/6, mcp_setup 0/6,
socket 0/5, memory_goals 0/5, test_support 0/5.

Also documented, not fixed: coverage is a string match, so a method NAMED by an
e2e target counts as covered without being provably invoked. Measured both
cheap tightenings before leaving it -- comment-only credit is exactly zero
today (390 methods with comments, 390 without), and bare-list-entry credit is
not separable by line shape, because rustfmt puts a long call's method argument
on its own line and a list element looks identical. Separating them needs an AST.

scripts/__tests__/coverage-script-help.test.mjs still passes.
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Aug 31, 2026
The gate reported 100% for five namespaces it had measured nothing in, and
never looked at ~50 more at all. Three defects, all provable:

(a) Discovery read only files whose PATH matched /(^|\/)schemas?(\.rs|\/)/.
    The 2026-08-30 include! split (tinyhumansai#5856/tinyhumansai#5857) moved ControllerSchema literals
    into *_part_NN.rs siblings that the pattern does not match -- flows into
    flows_schema_part_01/02.rs, and the same for threads, tools, composio,
    inference, memory/sources, mcp/registry, agent/learning, agent/orchestration.
    13 files and 180 controllers went invisible in one commit with no signal.
    Restoring the old filter on top of this change drops discovery from 625
    controllers / 83 namespaces to 445 / 72.

    The path filter bought nothing a content match does not: a file with no
    ControllerSchema literal contributes nothing either way. Dropped it.

(b) percent = expected.size === 0 ? 100 : ... turned "measured nothing" into a
    pass. On this tree the old script prints, verbatim:

        | channels       | channels       | 0/0 | 100.0% | - |
        | composio       | composio       | 0/0 | 100.0% | - |
        | threads        | threads        | 0/0 | 100.0% | - |
        | tools          | tools          | 0/0 | 100.0% | - |
        | memory_sources | memory_sources | 0/0 | 100.0% | - |

    indistinguishable from genuine full coverage. A namespace named in MODULES
    with no discovered controllers is now a hard failure with its own message,
    which says explicitly that nothing was measured.

    channels is the case that made this load-bearing rather than theoretical:
    its 20 controllers are declared in the vendored tinychannels-bus crate as
    ChannelControllerSchema literals, and openhuman's adapter only maps them
    across with a dynamic namespace field no static scan can read. Added that
    crate as a second schema root, as
    app/src/services/__tests__/rpcMethods.test.ts already does for the same
    reason. channels now measures 18/20.

(c) MODULES was the SCOPE of the check, so a namespace nobody added a line for
    was never measured at any threshold: webhooks, skill_runtime, subagent,
    mcp_setup, flows, skills, cron, voice, workflow_run, team, billing, medulla
    and ~40 more. MODULES is now presentational grouping only; every discovered
    namespace is measured whether or not it is listed. A list you must remember
    to extend is a list that silently stops covering things.

Honest numbers, not tuned -- threshold left at 90:

    before: 17 namespaces, 4 failing
    after : 83 namespaces, 625 controllers, 359 named by an e2e target (57.4%),
            62 namespaces below 90%, 39 of them at 0%

The worst are whole namespaces with no Rust e2e at all: webhooks 0/13,
learning 0/11, medulla 0/9, session_db 0/6, skill_runtime 0/6, mcp_setup 0/6,
socket 0/5, memory_goals 0/5, test_support 0/5.

Also documented, not fixed: coverage is a string match, so a method NAMED by an
e2e target counts as covered without being provably invoked. Measured both
cheap tightenings before leaving it -- comment-only credit is exactly zero
today (390 methods with comments, 390 without), and bare-list-entry credit is
not separable by line shape, because rustfmt puts a long call's method argument
on its own line and a list element looks identical. Separating them needs an AST.

scripts/__tests__/coverage-script-help.test.mjs still passes.
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Aug 31, 2026
…iring

This test was RED on main. It fails at 1904382 with

    expected 'use crate::core::{ControllerSchema, F...' to contain
             'function: "get_agent_paths"'

and the method it names exists — the corpus had shrunk under it. Same root
cause as the domain e2e coverage gate: the 2026-08-30 include! split
(tinyhumansai#5856/tinyhumansai#5857) turned several guarded schemas.rs files into shells that
`#[path = "..._part_NN.rs"] mod ...;` their contents.
config/schemas/schema_defs.rs is 29 lines of module declarations now;
inference/schemas.rs is 5; mcp/registry/schemas.rs is 11.

Two defects, both proven by mutation before changing anything:

(a) The corpus was ten hardcoded readFileSync paths. Replaced with a walk of
    the same two roots the Rust gate uses -- src/openhuman, plus the vendored
    tinychannels-bus controllers, which the old list already reached into for
    the same reason (channels declares ChannelControllerSchema literals that
    openhuman's adapter only maps across with a dynamic namespace field).
    A declaration that moves is still found; one that is deleted still fails.

(b) The assertion was two INDEPENDENT substring checks over the concatenated
    blob:

        expect(schemaSources).toContain(`namespace: "${namespace}"`);
        expect(schemaSources).toContain(`function: "${fnName}"`);

    It never checked that the two belonged to the same ControllerSchema.
    Measured: delete openhuman.config_get from source, remove staleness from
    the corpus entirely, and the old assertion still PASSES -- because
    `function: "get"` is supplied by ten other namespaces (agent_team,
    workflow_run, session_db, run_ledger, flows, http_host, task_sources,
    mcp_setup, thread_goals, tool_registry). Function names like get, list,
    status and update are shared across dozens of namespaces, so a deleted
    controller was very likely to keep passing.

    Now parses namespace+function into `openhuman.<ns>_<fn>` pairs and asserts
    exact membership. The same mutation now fails with
    "catalog method not declared by any ControllerSchema: openhuman.config_get".

Also added a floor (declared.size > 400) and an explicit existsSync check per
root, so a discovery bug fails loudly instead of shrinking the corpus to
nothing and passing on lucky substrings -- the failure mode that hid (a).

All 60 canonical CORE_RPC_METHODS entries resolve against the 625 discovered
controllers. 19/19 green; prettier and tsc clean.
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Sep 1, 2026
The gate reported 100% for five namespaces it had measured nothing in, and
never looked at ~50 more at all. Three defects, all provable:

(a) Discovery read only files whose PATH matched /(^|\/)schemas?(\.rs|\/)/.
    The 2026-08-30 include! split (tinyhumansai#5856/tinyhumansai#5857) moved ControllerSchema literals
    into *_part_NN.rs siblings that the pattern does not match -- flows into
    flows_schema_part_01/02.rs, and the same for threads, tools, composio,
    inference, memory/sources, mcp/registry, agent/learning, agent/orchestration.
    13 files and 180 controllers went invisible in one commit with no signal.
    Restoring the old filter on top of this change drops discovery from 625
    controllers / 83 namespaces to 445 / 72.

    The path filter bought nothing a content match does not: a file with no
    ControllerSchema literal contributes nothing either way. Dropped it.

(b) percent = expected.size === 0 ? 100 : ... turned "measured nothing" into a
    pass. On this tree the old script prints, verbatim:

        | channels       | channels       | 0/0 | 100.0% | - |
        | composio       | composio       | 0/0 | 100.0% | - |
        | threads        | threads        | 0/0 | 100.0% | - |
        | tools          | tools          | 0/0 | 100.0% | - |
        | memory_sources | memory_sources | 0/0 | 100.0% | - |

    indistinguishable from genuine full coverage. A namespace named in MODULES
    with no discovered controllers is now a hard failure with its own message,
    which says explicitly that nothing was measured.

    channels is the case that made this load-bearing rather than theoretical:
    its 20 controllers are declared in the vendored tinychannels-bus crate as
    ChannelControllerSchema literals, and openhuman's adapter only maps them
    across with a dynamic namespace field no static scan can read. Added that
    crate as a second schema root, as
    app/src/services/__tests__/rpcMethods.test.ts already does for the same
    reason. channels now measures 18/20.

(c) MODULES was the SCOPE of the check, so a namespace nobody added a line for
    was never measured at any threshold: webhooks, skill_runtime, subagent,
    mcp_setup, flows, skills, cron, voice, workflow_run, team, billing, medulla
    and ~40 more. MODULES is now presentational grouping only; every discovered
    namespace is measured whether or not it is listed. A list you must remember
    to extend is a list that silently stops covering things.

Honest numbers, not tuned -- threshold left at 90:

    before: 17 namespaces, 4 failing
    after : 83 namespaces, 625 controllers, 359 named by an e2e target (57.4%),
            62 namespaces below 90%, 39 of them at 0%

The worst are whole namespaces with no Rust e2e at all: webhooks 0/13,
learning 0/11, medulla 0/9, session_db 0/6, skill_runtime 0/6, mcp_setup 0/6,
socket 0/5, memory_goals 0/5, test_support 0/5.

Also documented, not fixed: coverage is a string match, so a method NAMED by an
e2e target counts as covered without being provably invoked. Measured both
cheap tightenings before leaving it -- comment-only credit is exactly zero
today (390 methods with comments, 390 without), and bare-list-entry credit is
not separable by line shape, because rustfmt puts a long call's method argument
on its own line and a list element looks identical. Separating them needs an AST.

scripts/__tests__/coverage-script-help.test.mjs still passes.
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Sep 1, 2026
The gate reported 100% for five namespaces it had measured nothing in, and
never looked at ~50 more at all. Three defects, all provable:

(a) Discovery read only files whose PATH matched /(^|\/)schemas?(\.rs|\/)/.
    The 2026-08-30 include! split (tinyhumansai#5856/tinyhumansai#5857) moved ControllerSchema literals
    into *_part_NN.rs siblings that the pattern does not match -- flows into
    flows_schema_part_01/02.rs, and the same for threads, tools, composio,
    inference, memory/sources, mcp/registry, agent/learning, agent/orchestration.
    13 files and 180 controllers went invisible in one commit with no signal.
    Restoring the old filter on top of this change drops discovery from 625
    controllers / 83 namespaces to 445 / 72.

    The path filter bought nothing a content match does not: a file with no
    ControllerSchema literal contributes nothing either way. Dropped it.

(b) percent = expected.size === 0 ? 100 : ... turned "measured nothing" into a
    pass. On this tree the old script prints, verbatim:

        | channels       | channels       | 0/0 | 100.0% | - |
        | composio       | composio       | 0/0 | 100.0% | - |
        | threads        | threads        | 0/0 | 100.0% | - |
        | tools          | tools          | 0/0 | 100.0% | - |
        | memory_sources | memory_sources | 0/0 | 100.0% | - |

    indistinguishable from genuine full coverage. A namespace named in MODULES
    with no discovered controllers is now a hard failure with its own message,
    which says explicitly that nothing was measured.

    channels is the case that made this load-bearing rather than theoretical:
    its 20 controllers are declared in the vendored tinychannels-bus crate as
    ChannelControllerSchema literals, and openhuman's adapter only maps them
    across with a dynamic namespace field no static scan can read. Added that
    crate as a second schema root, as
    app/src/services/__tests__/rpcMethods.test.ts already does for the same
    reason. channels now measures 18/20.

(c) MODULES was the SCOPE of the check, so a namespace nobody added a line for
    was never measured at any threshold: webhooks, skill_runtime, subagent,
    mcp_setup, flows, skills, cron, voice, workflow_run, team, billing, medulla
    and ~40 more. MODULES is now presentational grouping only; every discovered
    namespace is measured whether or not it is listed. A list you must remember
    to extend is a list that silently stops covering things.

Honest numbers, not tuned -- threshold left at 90:

    before: 17 namespaces, 4 failing
    after : 83 namespaces, 625 controllers, 359 named by an e2e target (57.4%),
            62 namespaces below 90%, 39 of them at 0%

The worst are whole namespaces with no Rust e2e at all: webhooks 0/13,
learning 0/11, medulla 0/9, session_db 0/6, skill_runtime 0/6, mcp_setup 0/6,
socket 0/5, memory_goals 0/5, test_support 0/5.

Also documented, not fixed: coverage is a string match, so a method NAMED by an
e2e target counts as covered without being provably invoked. Measured both
cheap tightenings before leaving it -- comment-only credit is exactly zero
today (390 methods with comments, 390 without), and bare-list-entry credit is
not separable by line shape, because rustfmt puts a long call's method argument
on its own line and a list element looks identical. Separating them needs an AST.

scripts/__tests__/coverage-script-help.test.mjs still passes.
M3gA-Mind added a commit to M3gA-Mind/openhuman that referenced this pull request Sep 1, 2026
The gate reported 100% for five namespaces it had measured nothing in, and
never looked at ~50 more at all. Three defects, all provable:

(a) Discovery read only files whose PATH matched /(^|\/)schemas?(\.rs|\/)/.
    The 2026-08-30 include! split (tinyhumansai#5856/tinyhumansai#5857) moved ControllerSchema literals
    into *_part_NN.rs siblings that the pattern does not match -- flows into
    flows_schema_part_01/02.rs, and the same for threads, tools, composio,
    inference, memory/sources, mcp/registry, agent/learning, agent/orchestration.
    13 files and 180 controllers went invisible in one commit with no signal.
    Restoring the old filter on top of this change drops discovery from 625
    controllers / 83 namespaces to 445 / 72.

    The path filter bought nothing a content match does not: a file with no
    ControllerSchema literal contributes nothing either way. Dropped it.

(b) percent = expected.size === 0 ? 100 : ... turned "measured nothing" into a
    pass. On this tree the old script prints, verbatim:

        | channels       | channels       | 0/0 | 100.0% | - |
        | composio       | composio       | 0/0 | 100.0% | - |
        | threads        | threads        | 0/0 | 100.0% | - |
        | tools          | tools          | 0/0 | 100.0% | - |
        | memory_sources | memory_sources | 0/0 | 100.0% | - |

    indistinguishable from genuine full coverage. A namespace named in MODULES
    with no discovered controllers is now a hard failure with its own message,
    which says explicitly that nothing was measured.

    channels is the case that made this load-bearing rather than theoretical:
    its 20 controllers are declared in the vendored tinychannels-bus crate as
    ChannelControllerSchema literals, and openhuman's adapter only maps them
    across with a dynamic namespace field no static scan can read. Added that
    crate as a second schema root, as
    app/src/services/__tests__/rpcMethods.test.ts already does for the same
    reason. channels now measures 18/20.

(c) MODULES was the SCOPE of the check, so a namespace nobody added a line for
    was never measured at any threshold: webhooks, skill_runtime, subagent,
    mcp_setup, flows, skills, cron, voice, workflow_run, team, billing, medulla
    and ~40 more. MODULES is now presentational grouping only; every discovered
    namespace is measured whether or not it is listed. A list you must remember
    to extend is a list that silently stops covering things.

Honest numbers, not tuned -- threshold left at 90:

    before: 17 namespaces, 4 failing
    after : 83 namespaces, 625 controllers, 359 named by an e2e target (57.4%),
            62 namespaces below 90%, 39 of them at 0%

The worst are whole namespaces with no Rust e2e at all: webhooks 0/13,
learning 0/11, medulla 0/9, session_db 0/6, skill_runtime 0/6, mcp_setup 0/6,
socket 0/5, memory_goals 0/5, test_support 0/5.

Also documented, not fixed: coverage is a string match, so a method NAMED by an
e2e target counts as covered without being provably invoked. Measured both
cheap tightenings before leaving it -- comment-only credit is exactly zero
today (390 methods with comments, 390 without), and bare-list-entry credit is
not separable by line shape, because rustfmt puts a long call's method argument
on its own line and a list element looks identical. Separating them needs an AST.

scripts/__tests__/coverage-script-help.test.mjs still passes.
senamakel pushed a commit to HDZTony/openhuman that referenced this pull request Sep 11, 2026
…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 (tinyhumansai#5856/tinyhumansai#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
senamakel added a commit to nocstah/openhuman that referenced this pull request Sep 11, 2026
…ests-modules\n\nrefactor: split OpenHuman Rust tests and oversized modules\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant