Skip to content

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

ci: record tinymold cache stats and save duration in private lane

Steven Enamakel7f28d9b9a0ac
diff --git a/.github/workflows/ci-lanes.yml b/.github/workflows/ci-lanes.yml
index 42643e20c0..c6e695eea7 100644
--- a/.github/workflows/ci-lanes.yml
+++ b/.github/workflows/ci-lanes.yml
@@ -154,11 +154,26 @@ jobs:
steps.filter.outputs['rust-tauri'] == 'true')
run: node scripts/ci/self-hosted/verify-linkage.mjs
+ - name: Start cache save timer
+ if: ${{ always() && steps.tinymold.outcome == 'success' }}
+ run: |
+ mkdir -p ci-out
+ date +%s > ci-out/cache-save-start
+
- name: Save Tinymold cache
if: ${{ always() && steps.tinymold.outcome == 'success' }}
continue-on-error: true
uses: tinyhumansai/tinymold/save@b7c4c26f184acdbf7133487b158062fc610d2f28
+ - name: Record cache statistics and save time
+ if: ${{ always() && steps.tinymold.outcome == 'success' }}
+ run: |
+ mkdir -p ci-out
+ tinymold stats > ci-out/tinymold-stats.txt || true
+ if [ -f ci-out/cache-save-start ]; then
+ echo "$(( $(date +%s) - $(cat ci-out/cache-save-start) ))" > ci-out/cache-save-seconds.txt
+ fi
+
- name: Upload lane logs, timings and coverage
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
diff --git a/docs/ci-private-validation.md b/docs/ci-private-validation.md
index f28189feb0..7df4bb83a9 100644
--- a/docs/ci-private-validation.md
+++ b/docs/ci-private-validation.md
@@ -4,20 +4,20 @@ This inventory records the test selections before changing execution for #8063.
Coverage replaces equivalent executions inside the private job. Feature sets are
not treated as equivalent merely because they select the same crate.
-| Selection | Earlier execution | Private execution |
-| --- | --- | --- |
-| `openhuman` product `--lib --bins` | coverage nextest, background unit build | coverage nextest, sequential |
-| `openhuman-cli` product integration targets | coverage nextest `kind(test)` | same, fails empty selection |
-| `openhuman-embed`, `openhuman-tinyhumans` product, all targets | coverage libtest | coverage nextest |
-| `openhuman-embed`, `openhuman-tinyhumans` default, all targets | omitted as presumed duplicates | separate coverage nextest configurations |
-| `openhuman-rpc`, `openhuman-tui` default, all targets | coverage libtest | coverage nextest |
-| core no-default lib, existing gate filters | plain libtest | coverage nextest with equivalent substring unions |
-| core no-default plus `modules,mcp,e2e-test-support`, gate filters | serial plain libtest | serial coverage nextest |
-| Tauri own manifest/default features | coverage libtest | coverage nextest |
-| CLI ten storage E2E targets, `storage-sqlite,storage-file` | plain libtest | coverage nextest, same targets and driver matrix |
-| core storage domain filters excluding cron module tests | plain libtest | coverage nextest, same inclusions/exclusions |
-| core storage cron bus/documents tests | serial plain libtest | serial coverage nextest |
-| RPC `session-store,storage-sqlite,storage-file`, `session_store::` | plain libtest | coverage nextest |
+| Selection | Earlier execution | Private execution |
+| ------------------------------------------------------------------ | --------------------------------------- | ------------------------------------------------- |
+| `openhuman` product `--lib --bins` | coverage nextest, background unit build | coverage nextest, sequential |
+| `openhuman-cli` product integration targets | coverage nextest `kind(test)` | same, fails empty selection |
+| `openhuman-embed`, `openhuman-tinyhumans` product, all targets | coverage libtest | coverage nextest |
+| `openhuman-embed`, `openhuman-tinyhumans` default, all targets | omitted as presumed duplicates | separate coverage nextest configurations |
+| `openhuman-rpc`, `openhuman-tui` default, all targets | coverage libtest | coverage nextest |
+| core no-default lib, existing gate filters | plain libtest | coverage nextest with equivalent substring unions |
+| core no-default plus `modules,mcp,e2e-test-support`, gate filters | serial plain libtest | serial coverage nextest |
+| Tauri own manifest/default features | coverage libtest | coverage nextest |
+| CLI ten storage E2E targets, `storage-sqlite,storage-file` | plain libtest | coverage nextest, same targets and driver matrix |
+| core storage domain filters excluding cron module tests | plain libtest | coverage nextest, same inclusions/exclusions |
+| core storage cron bus/documents tests | serial plain libtest | serial coverage nextest |
+| RPC `session-store,storage-sqlite,storage-file`, `session_store::` | plain libtest | coverage nextest |
The storage E2E list and domain filter list remain declared in `lanes-plan.mjs`.
Product features remain in `scripts/ci/product-features.txt`; they are resolved
diff --git a/scripts/__tests__/private-runner-contract.test.mjs b/scripts/__tests__/private-runner-contract.test.mjs
index 0de380324c..4ec9ab3dfa 100644
--- a/scripts/__tests__/private-runner-contract.test.mjs
+++ b/scripts/__tests__/private-runner-contract.test.mjs
@@ -7,15 +7,20 @@ import test from "node:test";
import { classifyElf } from "../ci/self-hosted/verify-linkage.mjs";
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();
+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 },
- });
+ 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);
@@ -23,15 +28,23 @@ test("private runner rejects missing, stale and unqualified guest image metadata
assert.notEqual(run().status, 0);
writeFileSync(metadata, `digest=${pin.split("@")[1]}\n`);
assert.equal(run().status, 0);
- } finally { rmSync(dir, { recursive: true, force: true }); }
+ } 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 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,
+ /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/);
@@ -41,9 +54,18 @@ test("private workflow pins checkout, image and signed Tinymold without artifact
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/);
+ 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", () => {
@@ -59,22 +81,46 @@ test("private routing requires both trusted identities and retains outsider host
});
test("mold proof distinguishes instrumented binaries from ordinary executables", () => {
- assert.deepEqual(classifyElf(" [1] .interp PROGBITS\n [2] __llvm_prf_cnts PROGBITS", "mold 2.40.4"), {
- executable: true, instrumented: true, mold: true,
- });
+ assert.deepEqual(
+ classifyElf(
+ " [1] .interp PROGBITS\n [2] __llvm_prf_cnts PROGBITS",
+ "mold 2.40.4",
+ ),
+ {
+ executable: true,
+ instrumented: true,
+ mold: true,
+ },
+ );
assert.deepEqual(classifyElf(" [1] .interp PROGBITS", "GCC 15"), {
- executable: true, instrumented: false, mold: false,
+ executable: true,
+ instrumented: false,
+ mold: false,
});
- assert.equal(classifyElf(" [1] .text PROGBITS", "mold 2.40.4").executable, false);
+ assert.equal(
+ classifyElf(" [1] .text PROGBITS", "mold 2.40.4").executable,
+ false,
+ );
});
test("membership gate routes mixed identities, outsiders and bots away from EX63", () => {
- const route = readFileSync(new URL("../../.github/workflows/ci-fast.yml", import.meta.url), "utf8");
- const body = route.split(" run: |\n")[1].split("\n lanes:")[0]
- .split("\n").map((line) => line.slice(10)).join("\n");
+ const route = readFileSync(
+ new URL("../../.github/workflows/ci-fast.yml", import.meta.url),
+ "utf8",
+ );
+ const body = route
+ .split(" run: |\n")[1]
+ .split("\n lanes:")[0]
+ .split("\n")
+ .map((line) => line.slice(10))
+ .join("\n");
const dir = mkdtempSync(join(tmpdir(), "ci-membership-"));
try {
- writeFileSync(join(dir, "curl"), '#!/usr/bin/env bash\nurl="${!#}"\ncase "$url" in */members/alice|*/members/bob) echo 204;; *) echo 404;; esac\n', { mode: 0o755 });
+ writeFileSync(
+ join(dir, "curl"),
+ '#!/usr/bin/env bash\nurl="${!#}"\ncase "$url" in */members/alice|*/members/bob) echo 204;; *) echo 404;; esac\n',
+ { mode: 0o755 },
+ );
for (const [author, actor, association, token, expected] of [
["alice", "bob", "MEMBER", "fixture", true],
["alice", "outsider", "MEMBER", "fixture", false],
@@ -85,12 +131,27 @@ test("membership gate routes mixed identities, outsiders and bots away from EX63
]) {
const output = join(dir, "output");
writeFileSync(output, "");
- const result = spawnSync("bash", ["-c", body], { encoding: "utf8", env: {
- ...process.env, PATH: `${dir}:${process.env.PATH}`, ORG: "fixture", AUTHOR: author,
- ACTOR: actor, ASSOCIATION: association, MEMBERSHIP_TOKEN: token, GITHUB_OUTPUT: output,
- } });
+ const result = spawnSync("bash", ["-c", body], {
+ encoding: "utf8",
+ env: {
+ ...process.env,
+ PATH: `${dir}:${process.env.PATH}`,
+ ORG: "fixture",
+ AUTHOR: author,
+ ACTOR: actor,
+ ASSOCIATION: association,
+ MEMBERSHIP_TOKEN: token,
+ GITHUB_OUTPUT: output,
+ },
+ });
assert.equal(result.status, 0, result.stderr);
- assert.equal(readFileSync(output, "utf8").trim(), `member=${expected}`, `${author}/${actor}`);
+ assert.equal(
+ readFileSync(output, "utf8").trim(),
+ `member=${expected}`,
+ `${author}/${actor}`,
+ );
}
- } finally { rmSync(dir, { recursive: true, force: true }); }
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
});
diff --git a/scripts/ci/self-hosted/verify-linkage.mjs b/scripts/ci/self-hosted/verify-linkage.mjs
index c32a5d8e2c..32953c0afa 100644
--- a/scripts/ci/self-hosted/verify-linkage.mjs
+++ b/scripts/ci/self-hosted/verify-linkage.mjs
@@ -18,14 +18,26 @@ export function findProof(root, instrumented) {
for (const entry of readdirSync(directory, { withFileTypes: true })) {
const path = join(directory, entry.name);
if (entry.isDirectory()) {
- if (["incremental", "build", ".fingerprint"].includes(entry.name)) continue;
+ if (["incremental", "build", ".fingerprint"].includes(entry.name))
+ continue;
const result = visit(path);
if (result) return result;
- } else if (entry.isFile() && (statSync(path).mode & 0o111) && /\/debug\/(deps|examples)\//.test(path)) {
+ } else if (
+ entry.isFile() &&
+ statSync(path).mode & 0o111 &&
+ /\/debug\/(deps|examples)\//.test(path)
+ ) {
try {
- const options = { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] };
+ const options = {
+ encoding: "utf8",
+ stdio: ["ignore", "pipe", "ignore"],
+ };
const sections = execFileSync("readelf", ["-SW", path], options);
- const comments = execFileSync("readelf", ["--string-dump=.comment", path], options);
+ const comments = execFileSync(
+ "readelf",
+ ["--string-dump=.comment", path],
+ options,
+ );
const kind = classifyElf(sections, comments);
if (!kind.executable || kind.instrumented !== instrumented) continue;
if (!kind.mold) throw new Error(`ELF lacks mold metadata: ${path}`);
@@ -38,11 +50,17 @@ export function findProof(root, instrumented) {
return null;
};
const result = visit(root);
- if (!result) throw new Error(`No ${instrumented ? "instrumented" : "uninstrumented"} lane executable under ${root}`);
+ if (!result)
+ throw new Error(
+ `No ${instrumented ? "instrumented" : "uninstrumented"} lane executable under ${root}`,
+ );
return result;
}
-if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+if (
+ process.argv[1] &&
+ import.meta.url === pathToFileURL(process.argv[1]).href
+) {
const output = process.argv[2] ?? "ci-out/linkage.json";
const proof = [
findProof("target/ci-private-build", false),