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
ci: enforce OpenHuman Rust file layout
Steven Enamakel6e77a7ce80eb
diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.ymlindex add4d798ed..8b70c2b23c 100644--- a/.github/workflows/ci-lite.yml+++ b/.github/workflows/ci-lite.yml@@ -417,6 +417,10 @@ jobs:- name: Check Rust formattingrun: cargo fmt --all -- --check+ - name: Enforce OpenHuman Rust file layout+ if: needs.changes.outputs['rust-core'] == 'true'+ run: node scripts/ci/check-openhuman-rust-layout.mjs+- name: Enforce Linux TLS dependency policyif: needs.changes.outputs['rust-core'] == 'true' || needs.changes.outputs['rust-tauri'] == 'true'run: bash scripts/check-linux-tls-dependencies.shdiff --git a/package.json b/package.jsonindex ff116ba24a..9fa022f7a8 100644--- a/package.json+++ b/package.json@@ -54,6 +54,7 @@"test:install-ps1": "pwsh -NoProfile -File scripts/tests/OpenHumanWindowsInstall.Tests.ps1","rust:check": "pnpm --filter openhuman-app rust:check","rust:clippy": "cargo clippy -p openhuman -- -D warnings && pnpm --filter openhuman-app rust:clippy",+ "rust:layout": "node scripts/ci/check-openhuman-rust-layout.mjs","typecheck": "pnpm --filter openhuman-app compile","tauri:ios:init": "bash scripts/ios-init.sh","tauri:ios:dev": "pnpm --filter openhuman-app tauri:ios:dev",diff --git a/scripts/ci/check-openhuman-rust-layout.mjs b/scripts/ci/check-openhuman-rust-layout.mjsnew file mode 100644index 0000000000..c274d968ab--- /dev/null+++ b/scripts/ci/check-openhuman-rust-layout.mjs@@ -0,0 +1,66 @@+#!/usr/bin/env node++import fs from "node:fs";+import path from "node:path";++const ROOT = "src/openhuman";+const LINE_LIMIT = 750;++// These stateful assembly functions still need semantic decomposition. Pinning+// their current size makes the gate monotonic: they cannot grow, no new+// exception can appear, and deleting an entry is the only way to relax it.+const LEGACY_LIMITS = new Map([+ ["src/openhuman/agent/harness/session/builder/factory.rs", 1552],+ ["src/openhuman/agent/harness/subagent_runner/ops/runner.rs", 1766],+ ["src/openhuman/tools/ops.rs", 1502],+ ["src/openhuman/web_chat/progress_bridge.rs", 1547],+]);++function rustFiles(directory) {+ return fs.readdirSync(directory, { withFileTypes: true }).flatMap((entry) => {+ const file = path.join(directory, entry.name);+ if (entry.isDirectory()) return rustFiles(file);+ return entry.isFile() && entry.name.endsWith(".rs") ? [file] : [];+ });+}++const failures = [];+for (const file of rustFiles(ROOT)) {+ const source = fs.readFileSync(file, "utf8");+ const lineCount = source.split("\n").length - (source.endsWith("\n") ? 1 : 0);+ const legacyLimit = LEGACY_LIMITS.get(file);+ if (lineCount > (legacyLimit ?? LINE_LIMIT)) {+ failures.push(+ `${file}: ${lineCount} lines (limit ${legacyLimit ?? LINE_LIMIT})`,+ );+ }+ if (["tests.rs", "test.rs"].includes(path.basename(file))) {+ failures.push(+ `${file}: test modules must use a descriptive *_tests.rs filename`,+ );+ }+ if (+ /^#\[cfg\([^\n]*\btest\b[^\n]*\)\]\s*\n(?:#\[[^\n]+\]\s*\n)*(?:pub(?:\([^)]*\))?\s+)?mod\s+\w+\s*\{/m.test(+ source,+ )+ ) {+ failures.push(+ `${file}: inline test module; move it to a sibling *_tests.rs file`,+ );+ }+}++for (const file of LEGACY_LIMITS.keys()) {+ if (!fs.existsSync(file))+ failures.push(`${file}: stale legacy exception; remove it from the gate`);+}++if (failures.length) {+ console.error("OpenHuman Rust layout check failed:");+ failures.forEach((failure) => console.error(` - ${failure}`));+ process.exit(1);+}++console.log(+ `OpenHuman Rust layout check passed (new files <= ${LINE_LIMIT} lines; tests external).`,+);