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): tighten crate chain re-export checks
Steven Enamakele3d07f1e6730
diff --git a/crates/openhuman-embed/src/host_internals.rs b/crates/openhuman-embed/src/host_internals.rsindex fceb8acdc9..8876b719e7 100644--- a/crates/openhuman-embed/src/host_internals.rs+++ b/crates/openhuman-embed/src/host_internals.rs@@ -300,7 +300,7 @@ pub mod voice {subscribe_dictation_events, subscribe_transcription_results,};}- #[cfg(feature = "voice")]+ #[cfg(all(feature = "voice", feature = "http-server"))]pub mod live {pub mod ws {pub use openhuman_core::voice::live::ws::handle_live_voice_ws;diff --git a/crates/openhuman-rpc/src/server/http/live_voice.rs b/crates/openhuman-rpc/src/server/http/live_voice.rsindex 8bc3dfe99b..b1f229c653 100644--- a/crates/openhuman-rpc/src/server/http/live_voice.rs+++ b/crates/openhuman-rpc/src/server/http/live_voice.rs@@ -31,9 +31,9 @@ pub(super) async fn live_voice_ws_handler(return;}};- #[cfg(feature = "voice")]+ #[cfg(all(feature = "voice", feature = "http-server"))]crate::core_host::voice::live::ws::handle_live_voice_ws(socket, config).await;- #[cfg(not(feature = "voice"))]+ #[cfg(not(all(feature = "voice", feature = "http-server")))]{// The core only carries the live-voice socket with voice compiled in.let _ = (socket, config);diff --git a/scripts/__tests__/check-crate-chain.test.mjs b/scripts/__tests__/check-crate-chain.test.mjsindex 93d2b1fa23..dae9110e54 100644--- a/scripts/__tests__/check-crate-chain.test.mjs+++ b/scripts/__tests__/check-crate-chain.test.mjs@@ -12,6 +12,7 @@ import {checkRepository,findForbiddenPaths,findPatternHits,+ CORE_WHOLESALE_REEXPORT_PATTERNS,HOST_RPC_INTERNAL_PATTERNS,RPC_INTERNAL_REEXPORT_PATTERNS,WHOLESALE_REEXPORT_PATTERNS,@@ -173,6 +174,20 @@ test('a layer re-exporting the layer below wholesale is flagged', () => {assert.deepEqual(flagged('/* pub use openhuman_embed::*; */\n'), []);});+test('embed may not re-export the core wholesale, and grouped wholesale forms are flagged', () => {+ const core = text =>+ findPatternHits(text, 'lib.rs', CORE_WHOLESALE_REEXPORT_PATTERNS).map(h => h.line);+ assert.deepEqual(core('pub use openhuman_core as core;\n'), [1]);+ assert.deepEqual(core('pub use openhuman_core::*;\n'), [1]);+ assert.deepEqual(core('pub use openhuman_core::{self, agent};\n'), [1]);+ assert.deepEqual(core('pub use openhuman_core::agent::turn_origin::AgentTurnOrigin;\n'), []);+ assert.deepEqual(core('pub use openhuman_core::{CoreBuilder, CoreRuntime};\n'), []);+ const grouped = text =>+ findPatternHits(text, 'lib.rs', WHOLESALE_REEXPORT_PATTERNS).map(h => h.line);+ assert.deepEqual(grouped('pub use openhuman_embed::{self as embed};\n'), [1]);+ assert.deepEqual(grouped('pub use openhuman_tinyhumans::{embed, SessionManager};\n'), []);+});+test('rpc may not re-export the internal list on a public path', () => {const flagged = text =>findPatternHits(text, 'lib.rs', RPC_INTERNAL_REEXPORT_PATTERNS).map(h => `${h.line}`);@@ -184,7 +199,9 @@ test('rpc may not re-export the internal list on a public path', () => {['2']);assert.deepEqual(flagged('pub(crate) use openhuman_tinyhumans::__host as core_host;\n'), []);- // Re-exporting one item reached through the list is an item, not the list.+ // A public re-export of a module beneath the list is still the list leaking.+ assert.deepEqual(flagged('pub use crate::core_host::config;\n'), ['1']);+ // `unwrap_rpc` is the one item rpc passes up from the list.assert.deepEqual(flagged('pub use crate::core_host::core::unwrap_rpc;\n'), []);});diff --git a/scripts/ci/check-crate-chain.mjs b/scripts/ci/check-crate-chain.mjsindex 2375da17ce..decb82f952 100644--- a/scripts/ci/check-crate-chain.mjs+++ b/scripts/ci/check-crate-chain.mjs@@ -63,7 +63,11 @@ export const FORBIDDEN_HOST_PATTERNS = [];/** Layer crates whose `src/` must not re-export the layer below wholesale. */-export const LAYER_SOURCE_DIRS = ['crates/openhuman-tinyhumans/src', 'crates/openhuman-rpc/src'];+export const LAYER_SOURCE_DIRS = [+ 'crates/openhuman-embed/src',+ 'crates/openhuman-tinyhumans/src',+ 'crates/openhuman-rpc/src',+];/** Wholesale re-exports of a lower layer (matched across lines, comments stripped). */export const WHOLESALE_REEXPORT_PATTERNS = [@@ -79,6 +83,11 @@ export const WHOLESALE_REEXPORT_PATTERNS = [name: 'pub use openhuman_embed::*',regex: /\bpub(?:\([^)]*\))?\s+use\s+openhuman_(?:embed|tinyhumans)(?:::embed)?::\*/,},+ {+ name: 'pub use openhuman_embed::{self, *} (grouped wholesale)',+ regex:+ /\bpub(?:\([^)]*\))?\s+use\s+openhuman_(?:embed|tinyhumans)(?:::embed)?::\{[^}]*(?:\bself\b|\*)/,+ },{name: 'pub use openhuman_embed / openhuman_tinyhumans (the bare crate)',regex: /\bpub(?:\([^)]*\))?\s+use\s+openhuman_(?:embed|tinyhumans)\s*;/,@@ -89,11 +98,19 @@ export const WHOLESALE_REEXPORT_PATTERNS = [},];+/** Embed must not re-export the core wholesale either. */+export const CORE_WHOLESALE_REEXPORT_PATTERNS = [+ {+ name: 'pub use openhuman_core (the bare crate, an alias or a glob)',+ regex: /\bpub(?:\([^)]*\))?\s+use\s+openhuman_core\s*(?:;|as\b|::\*|::\{[^}]*(?:\bself\b|\*))/,+ },+];+/** `pub use` of the internal list from rpc (it may only be `pub(crate)`). */export const RPC_INTERNAL_REEXPORT_PATTERNS = [{- name: 'pub use of the __host / core_host list itself',- regex: /\bpub\s+use\b[^;]*\b(?:__host|core_host)\b\s*(?:as\s+\w+\s*)?(?:[;,}]|::\*)/,+ name: 'pub use of anything under __host / core_host (bar unwrap_rpc)',+ regex: /\bpub\s+use\b(?![^;]*::unwrap_rpc\s*;)[^;]*\b(?:__host|core_host)\b/,},];@@ -362,7 +379,9 @@ export function checkRepository(root) {if (!existsSync(abs)) throw new Error(`missing layer source directory ${dir}`);const patterns = dir.includes('openhuman-rpc')? [...WHOLESALE_REEXPORT_PATTERNS, ...RPC_INTERNAL_REEXPORT_PATTERNS]- : WHOLESALE_REEXPORT_PATTERNS;+ : dir.includes('openhuman-embed')+ ? CORE_WHOLESALE_REEXPORT_PATTERNS+ : WHOLESALE_REEXPORT_PATTERNS;for (const file of rustFiles(abs)) {facadeViolations.push(...findPatternHits(readFileSync(file, 'utf8'), relative(root, file), patterns)