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(scripts): add contract test for private runner
Steven Enamakel21d85431b7f0
diff --git a/scripts/__tests__/private-runner-contract.test.mjs b/scripts/__tests__/private-runner-contract.test.mjsnew file mode 100644index 0000000000..783eb7bde7--- /dev/null+++ b/scripts/__tests__/private-runner-contract.test.mjs@@ -0,0 +1,58 @@+import assert from "node:assert/strict";+import { spawnSync } from "node:child_process";+import { mkdtempSync, writeFileSync, rmSync, readFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import test from "node:test";++const helper = new URL("../ci/self-hosted/verify-runner.sh", import.meta.url);+const pin = readFileSync(new URL("../ci/self-hosted/guest-image.txt", import.meta.url), "utf8").trim();++test("private runner rejects missing, stale and unqualified guest image metadata", () => {+ const dir = mkdtempSync(join(tmpdir(), "guest-contract-"));+ try {+ const metadata = join(dir, "build-info");+ const run = () => spawnSync("bash", [helper.pathname, "image"], {+ encoding: "utf8", env: { ...process.env, CI_IMAGE_BUILD_INFO: metadata },+ });+ assert.notEqual(run().status, 0);+ writeFileSync(metadata, "digest=sha256:stale\n");+ assert.notEqual(run().status, 0);+ writeFileSync(metadata, `image=${pin}\n`);+ assert.notEqual(run().status, 0);+ writeFileSync(metadata, `digest=${pin.split("@")[1]}\n`);+ assert.equal(run().status, 0);+ } finally { rmSync(dir, { recursive: true, force: true }); }+});++test("private workflow pins checkout, image and signed Tinymold without artifact caches", () => {+ const workflow = readFileSync(new URL("../../.github/workflows/ci-lanes.yml", import.meta.url), "utf8");+ const privateJob = workflow.split(" # ── hosted:")[0];+ assert.match(privateJob, /group: openhuman-ex63/);+ assert.match(privateJob, /labels: \[self-hosted, openhuman-ex63\]/);+ assert.match(privateJob, /tinyhumansai\/\.github\/actions\/checkout@[a-f0-9]{40}/);+ assert.match(privateJob, /submodules: recursive/);+ assert.match(privateJob, /exclude-submodules: wiki/);+ assert.match(privateJob, /fetch-depth: 0/);+ assert.match(privateJob, /tinyhumansai\/tinymold@[a-f0-9]{40}/);+ assert.match(privateJob, /install: none/);+ assert.match(privateJob, /backend: remote/);+ assert.match(privateJob, /remote-signing-key:/);+ assert.match(privateJob, /remote-trusted-keys:/);+ assert.match(privateJob, /tinyhumansai\/tinymold\/save@[a-f0-9]{40}/);+ assert.doesNotMatch(privateJob, /Swatinem\/rust-cache|sccache|actions\/cache/);+ assert.ok(privateJob.indexOf("verify-runner.sh") < privateJob.indexOf("- name: Start lanes"));+ assert.match(privateJob, /name: Save Tinymold cache\n\s+if:.*always\(\).*\n\s+continue-on-error: true/);+});++test("private routing requires both trusted identities and retains outsider hosted fallback", () => {+ const root = new URL("../../.github/workflows/", import.meta.url);+ const route = readFileSync(new URL("ci-fast.yml", root), "utf8");+ const hosted = readFileSync(new URL("ci-fast-hosted.yml", root), "utf8");+ assert.match(route, /pull_request_target:/);+ assert.match(route, /is_member "\$\{AUTHOR\}" && is_member "\$\{ACTOR\}"/);+ assert.match(route, /contents: read/);+ assert.match(route, /needs.route.outputs.member == 'true'/);+ assert.match(hosted, /profile: hosted/);+ assert.doesNotMatch(route, /contents: write|secrets: inherit/);+});