Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(ci): source tinyconnectors from releases like other test modules

Steven Enamakelb0adebfcd2c4
diff --git a/scripts/__tests__/connector-fixture-attestation.test.mjs b/scripts/__tests__/connector-fixture-attestation.test.mjs
deleted file mode 100644
index cca5d7ad59..0000000000
--- a/scripts/__tests__/connector-fixture-attestation.test.mjs
+++ /dev/null
@@ -1,188 +0,0 @@
-import assert from "node:assert/strict";
-import { spawnSync } from "node:child_process";
-import { createHash } from "node:crypto";
-import {
- existsSync,
- mkdirSync,
- mkdtempSync,
- readFileSync,
- rmSync,
- writeFileSync,
-} from "node:fs";
-import { tmpdir } from "node:os";
-import { join } from "node:path";
-import test from "node:test";
-import { fileURLToPath } from "node:url";
-
-const stage = fileURLToPath(
- new URL("../ci/stage-connector-test-module.mjs", import.meta.url),
-);
-
-test("locally built connector fixtures carry the exact artifact digest for confidential calls", () => {
- const root = mkdtempSync(join(tmpdir(), "connector-fixture-"));
- try {
- const source = join(root, "libtinyconnectors.so");
- const destination = join(root, "fixture");
- for (const bytes of ["first pinned build", "replacement pinned build"]) {
- writeFileSync(source, bytes);
- const result = spawnSync(process.execPath, [stage, source, destination], {
- encoding: "utf8",
- });
- assert.equal(result.status, 0, result.stdout + result.stderr);
- const fixture = result.stdout.trim();
- assert.equal(readFileSync(fixture, "utf8"), bytes);
- const digest = createHash("sha256").update(bytes).digest("hex");
- assert.equal(
- readFileSync(join(destination, "modules.toml"), "utf8"),
- `"libtinyconnectors.so" = "${digest}"\n`,
- );
- }
- } finally {
- rmSync(root, { recursive: true, force: true });
- }
-});
-
-test("native E2E installation attests the connector module before launching the app", () => {
- const root = mkdtempSync(join(tmpdir(), "native-connector-fixture-"));
- try {
- const workflow = readFileSync(
- new URL("../../.github/workflows/e2e-reusable.yml", import.meta.url),
- "utf8",
- );
- const block = workflow.match(
- /- name: Install native E2E test modules\n run: \|\n([\s\S]*?)(?=\n - name:)/,
- );
- assert.ok(block, "native module installation step exists");
- const command = block[1]
- .replace(/^ /gm, "")
- .replace("/opt/openhuman-test-modules", join(root, "modules"));
- const bytes = "pinned native connector module";
- const bin = join(root, "bin");
- const cache = join(root, "cache");
- mkdirSync(bin);
- mkdirSync(join(cache, "blobs"), { recursive: true });
- const rustcVersion = "fixture rustc\n";
- const rustcDigest = createHash("sha256")
- .update(rustcVersion)
- .digest("hex")
- .slice(0, 12);
- writeFileSync(
- join(cache, "blobs", `tinyconnectors-fixture-${rustcDigest}.so`),
- bytes,
- );
- const assets = [];
- for (const id of [
- "tinyjuice",
- "tinybox",
- "tinysearch",
- "tinydocs",
- "tinywallet",
- "tinychannels",
- "tinymcp",
- "tinyhosts",
- ]) {
- const archive = `${id}.tar.gz`;
- const contents = join(root, `archive-${id}`);
- mkdirSync(contents);
- const moduleFile =
- id === "tinyhosts"
- ? "libtinyhosts.so"
- : id === "tinybox"
- ? "libtinybox.so"
- : "module-fixture.so";
- writeFileSync(join(contents, moduleFile), `released ${id}`);
- const packed = spawnSync("tar", [
- "-czf",
- join(root, archive),
- "-C",
- contents,
- ".",
- ]);
- assert.equal(packed.status, 0, packed.stderr?.toString());
- const sha = createHash("sha256")
- .update(readFileSync(join(root, archive)))
- .digest("hex");
- writeFileSync(
- join(cache, "blobs", `${sha}-${archive}`),
- readFileSync(join(root, archive)),
- );
- assets.push(
- [id, "https://fixture.invalid/unused", archive, sha].join("\t"),
- );
- }
- writeFileSync(join(root, "assets.tsv"), assets.join("\n") + "\n");
- writeFileSync(
- join(bin, "node"),
- `#!/bin/sh\ncase "$1" in *test-module-assets.mjs) cat assets.tsv;; *) exec '${process.execPath}' "$@";; esac\n`,
- { mode: 0o755 },
- );
- writeFileSync(
- join(bin, "git"),
- '#!/bin/sh\ncase "$*" in *rev-parse*) echo fixture;; esac\n',
- { mode: 0o755 },
- );
- writeFileSync(join(bin, "rustc"), `#!/bin/sh\nprintf '${rustcVersion}'\n`, {
- mode: 0o755,
- });
- for (const command of ["curl", "cargo"]) {
- writeFileSync(
- join(bin, command),
- "#!/bin/sh\necho unexpected build or download >&2\nexit 99\n",
- { mode: 0o755 },
- );
- }
- mkdirSync(join(root, "scripts/ci/self-hosted"), { recursive: true });
- writeFileSync(
- join(root, "scripts/ci/stage-connector-test-module.mjs"),
- readFileSync(stage),
- );
- writeFileSync(
- join(root, "scripts/ci/self-hosted/install-test-modules.sh"),
- readFileSync(
- new URL("../ci/self-hosted/install-test-modules.sh", import.meta.url),
- ),
- );
- const envFile = join(root, "env");
- const result = spawnSync("bash", ["-c", command], {
- cwd: root,
- encoding: "utf8",
- env: {
- ...process.env,
- GITHUB_RUN_ID: "fixture",
- GITHUB_RUN_ATTEMPT: "1",
- GITHUB_ENV: envFile,
- PATH: `${bin}:${process.env.PATH}`,
- CI_CACHE_DIR: cache,
- OPENHUMAN_MODULE_PATH: "",
- },
- });
- assert.equal(result.status, 0, result.stdout + result.stderr);
- const destination = join(root, "modules/fixture-1/tinyconnectors");
- assert.equal(
- readFileSync(join(destination, "libtinyconnectors.so"), "utf8"),
- bytes,
- );
- assert.equal(
- readFileSync(join(destination, "modules.toml"), "utf8"),
- `"libtinyconnectors.so" = "${createHash("sha256").update(bytes).digest("hex")}"\n`,
- );
- assert.equal(
- readFileSync(envFile, "utf8").trim(),
- [
- `OPENHUMAN_MODULE_PATH=${["tinybox", "tinydocs", "tinywallet", "tinychannels", "tinymcp", "tinyjuice", "tinysearch", "tinyhosts", "tinyconnectors"].map((id) => join(root, "modules/fixture-1", id)).join(":")}`,
- ].join("\n"),
- );
- assert.equal(
- existsSync(join(root, "modules/fixture-1/tinyhosts/libtinyhosts.so")),
- true,
- "the released module fixture is staged for its isolated core test",
- );
- assert.equal(
- existsSync(join(root, "modules/fixture-1/tinybox/libtinybox.so")),
- true,
- "the released TinyBox module fixture is available to Rust E2E tests",
- );
- } finally {
- rmSync(root, { recursive: true, force: true });
- }
-});
diff --git a/scripts/ci/self-hosted/install-test-modules.sh b/scripts/ci/self-hosted/install-test-modules.sh
index 0393ee7954..66fe1f5064 100755
--- a/scripts/ci/self-hosted/install-test-modules.sh
+++ b/scripts/ci/self-hosted/install-test-modules.sh
@@ -7,8 +7,8 @@
# Release archives come from the module registry (test-module-assets.mjs),
# are cached by sha256 under $CI_CACHE_DIR/blobs when that is set, and are
# verified against the registry digest on every use, cached or not.
-# libtinyconnectors has no published artifact, so it is built from the pinned
-# submodule and cached by (submodule SHA, rustc version).
+# All nine modules, tinyconnectors included, come from releases; nothing is
+# compiled from source here (#7618).
#
# tinybus refuses a module when any ancestor directory is owned by someone
# other than root or the current user, so <dest-dir> must sit under a tree the
@@ -58,33 +58,8 @@ while IFS=$'\t' read -r id url archive sha; do
tar --no-same-owner -xzf "${cached}" -C "${dest}/${id}"
done <<< "${assets}"
-# The checkout action initializes root submodules, but the module build also
-# needs tinyconnectors' nested tinybus dependency.
-git submodule update --init --recursive vendor/tinyconnectors
-
-conn_rev="$(git -C vendor/tinyconnectors rev-parse HEAD)"
-rustc_rev="$(rustc -V | sha256sum | cut -c1-12)"
-conn_cached="${blobs}/tinyconnectors-${conn_rev}-${rustc_rev}.so"
-if [ -f "${conn_cached}" ]; then
- log "tinyconnectors: cache hit ${conn_rev:0:12}"
-else
- conn_target="${TINYCONNECTORS_TARGET_DIR:-target/native-test-modules/tinyconnectors}"
- log "tinyconnectors: building ${conn_rev:0:12} into ${conn_target}"
- bash scripts/ci-cancel-aware.sh cargo build --release \
- --manifest-path vendor/tinyconnectors/crates/tinyconnectors/Cargo.toml \
- --target-dir "${conn_target}"
- cp "${conn_target}/release/libtinyconnectors.so" "${conn_cached}.part"
- mv "${conn_cached}.part" "${conn_cached}"
-fi
-touch "${conn_cached}"
-mkdir -p "${dest}/tinyconnectors"
-cp "${conn_cached}" "${dest}/tinyconnectors/libtinyconnectors.so"
-node scripts/ci/stage-connector-test-module.mjs \
- "${dest}/tinyconnectors/libtinyconnectors.so" "${dest}/tinyconnectors" > /dev/null
-
# Every staged directory goes on the search path the loader already honours
-# (release mode); each holds the library and, for tinyconnectors, the
-# operator-trust modules.toml beside it.
+# (release mode); each holds the released library.
module_dirs=""
for id in tinybox tinydocs tinywallet tinychannels tinymcp tinyjuice tinysearch tinyhosts tinyconnectors; do
module_dirs="${module_dirs:+${module_dirs}:}${dest}/${id}"
diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjs
index 5aa2056ed9..2a02bcf091 100644
--- a/scripts/ci/self-hosted/lanes-plan.mjs
+++ b/scripts/ci/self-hosted/lanes-plan.mjs
@@ -374,13 +374,6 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
{
name: "test-modules",
when: core,
- env: ex63
- ? {
- TINYCONNECTORS_TARGET_DIR: `${scratch}/target/tinyconnectors`,
- ...rustEnv,
- ...sccache,
- }
- : {},
run: `bash scripts/ci/self-hosted/install-test-modules.sh "${modulesDir}" ${modulesEnvFile}`,
},
{
diff --git a/scripts/ci/self-hosted/test-module-assets.mjs b/scripts/ci/self-hosted/test-module-assets.mjs
index 2e7b1bf8ff..036a098f8d 100644
--- a/scripts/ci/self-hosted/test-module-assets.mjs
+++ b/scripts/ci/self-hosted/test-module-assets.mjs
@@ -26,6 +26,7 @@ export const TEST_MODULE_IDS = [
"tinychannels",
"tinymcp",
"tinyhosts",
+ "tinyconnectors",
];
/** Concatenate registry.rs and its `registry/records_*.rs` fragments. */
diff --git a/scripts/ci/stage-connector-test-module.mjs b/scripts/ci/stage-connector-test-module.mjs
deleted file mode 100644
index 92315aad8f..0000000000
--- a/scripts/ci/stage-connector-test-module.mjs
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env node
-// The test runner builds this fixture from the pinned submodule. Record that
-// artifact's digest as operator trust; TinyBus still verifies it before loading
-// and refuses confidential delivery when the file or allowlist does not match.
-import { createHash } from "node:crypto";
-import { basename, join, resolve } from "node:path";
-import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
-
-const [source, destination] = process.argv.slice(2);
-if (!source || !destination) {
- throw new Error(
- "usage: stage-connector-test-module.mjs <built-library> <fixture-directory>",
- );
-}
-const bytes = readFileSync(source);
-const filename = basename(source);
-if (!/^libtinyconnectors\.(so|dylib)$|^tinyconnectors\.dll$/.test(filename)) {
- throw new Error("expected the locally built TinyConnectors library");
-}
-const directory = resolve(destination);
-mkdirSync(directory, { recursive: true });
-const artifact = join(directory, filename);
-writeFileSync(artifact, bytes);
-const digest = createHash("sha256").update(bytes).digest("hex");
-writeFileSync(join(directory, "modules.toml"), `"${filename}" = "${digest}"\n`);
-process.stdout.write(`${artifact}\n`);