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
test: cover embed boundary and ambient scan edge cases
Steven Enamakel17aaab6c5032
diff --git a/scripts/__tests__/embed-contract-boundary.test.mjs b/scripts/__tests__/embed-contract-boundary.test.mjsindex 24221a84f7..5fa18a1fbe 100644--- a/scripts/__tests__/embed-contract-boundary.test.mjs+++ b/scripts/__tests__/embed-contract-boundary.test.mjs@@ -96,3 +96,59 @@ test("Embed preserves native persisted codecs without admitting core facades", (assert.match(rejected.output, /openhuman-upstream-reexport/);}});++test("a builder method named with_thread_id is not a task-local accessor", () => {+ const result = check({+ "crates/openhuman-tinyhumans/src/inference/managed_model.rs":+ "let model = builder.with_thread_id(thread_id);\n",+ });+ assert.equal(result.status, 0, result.output);+});++test("task-local with_thread_id calls, imports, and declarations remain forbidden", () => {+ for (const source of [+ "let request = with_thread_id(request, thread_id);\n",+ "use crate::turn_context::with_thread_id;\n",+ "fn with_thread_id(request: Request) -> Request { request }\n",+ ]) {+ const result = check({ "crates/openhuman-core/src/example.rs": source });+ assert.equal(result.status, 1, result.output);+ assert.match(result.output, /openhuman-task-local/);+ }+});++test("Embed preserves the exact native dispatch-budget and observer contracts", () => {+ const budget = "pub use tinyagents_harness::cost::{\n" ++ " ControlledDispatchError, DispatchModelOptions, DispatchRefusal, DispatchRefusalReason,\n" ++ " PhysicalDispatchAdmission, PhysicalDispatchPermit,\n" ++ "};\n";+ const observer = "pub use tinyagents_harness::observability::{\n" ++ " PhysicalDispatchMetadata, PhysicalDispatchObserver, PhysicalDispatchOutcome,\n" ++ " PhysicalDispatchStatus, PhysicalDispatchTerminal, PhysicalDispatchUsage,\n" ++ "};\n";+ const allowed = check({+ "crates/openhuman-embed/src/budget.rs": budget,+ "crates/openhuman-embed/src/complete.rs": observer,+ });+ assert.equal(allowed.status, 0, allowed.output);++ for (const files of [+ {+ "crates/openhuman-embed/src/budget.rs": budget.replace(+ "PhysicalDispatchAdmission, PhysicalDispatchPermit,",+ "PhysicalDispatchAdmission, PhysicalDispatchPermit, UnreviewedType,",+ ),+ },+ {+ "crates/openhuman-embed/src/complete.rs": observer.replace(+ "PhysicalDispatchStatus, PhysicalDispatchTerminal, PhysicalDispatchUsage,",+ "PhysicalDispatchStatus, PhysicalDispatchTerminal, PhysicalDispatchUsage, UnreviewedType,",+ ),+ },+ { "crates/openhuman-core/src/agent/tinyagents/budget.rs": budget },+ ]) {+ const rejected = check(files);+ assert.equal(rejected.status, 1, rejected.output);+ assert.match(rejected.output, /openhuman-upstream-reexport/);+ }+});diff --git a/scripts/__tests__/saas-ambient.test.mjs b/scripts/__tests__/saas-ambient.test.mjsindex 59d79aec4f..66d1bad168 100644--- a/scripts/__tests__/saas-ambient.test.mjs+++ b/scripts/__tests__/saas-ambient.test.mjs@@ -81,18 +81,27 @@ test("a moved line is not a new site, a new line is", () => {assert.equal(compare(grown, before).added.length, 1);});-test("passes on a matching baseline and skips test files", () => {+test("passes on a matching baseline and skips test files and test support helpers", () => {const files = {[`${SRC}/a.rs`]: "tokio::spawn(f);\n",[`${SRC}/a_tests.rs`]: "tokio::spawn(f);\n",+ [`${SRC}/inference/provider/model_listing_test_support.rs`]: "tokio::spawn(f);\n",+ [`${SRC}/inference/provider/catalog_listing.rs`]: "Config::load_or_init();\n",[`${SRC}/core/runtime/spawn.rs`]: "tokio::spawn(f);\n",};const first = run(files, null, ["--write-baseline"]);assert.equal(first.status, 0, first.out);- assert.equal(first.after.length, 1, "only the non-test, non-helper site");+ assert.equal(first.after.length, 2, "only ordinary production sites are scanned");+ assert.deepEqual(+ first.after.map(({ path, rule }) => ({ path, rule })),+ [+ { path: `${SRC}/a.rs`, rule: "bare-spawn" },+ { path: `${SRC}/inference/provider/catalog_listing.rs`, rule: "ambient-config" },+ ],+ );const again = run(files, first.after);assert.equal(again.status, 0, again.out);- assert.match(again.out, /ratchet holds \(1 /);+ assert.match(again.out, /ratchet holds \(2 /);});test("fails on a new site and names the fix", () => {