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): resolve symlinked checkouts when enforcing storage bypass history
Steven Enamakeldfc69e1dbfe5
diff --git a/scripts/__tests__/storage-bypass-debt.test.mjs b/scripts/__tests__/storage-bypass-debt.test.mjsindex ef973f8c12..14a3525057 100644--- a/scripts/__tests__/storage-bypass-debt.test.mjs+++ b/scripts/__tests__/storage-bypass-debt.test.mjs@@ -1,6 +1,12 @@import assert from "node:assert/strict";import test from "node:test";-import { mkdtempSync, rmSync, mkdirSync, writeFileSync, symlinkSync } from "node:fs";+import {+ mkdtempSync,+ rmSync,+ mkdirSync,+ writeFileSync,+ symlinkSync,+} from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";import { fileURLToPath } from "node:url";@@ -193,7 +199,6 @@ test("present but empty curated vendor directories cannot appear as debt shrinka}});-test("symlinked real checkouts still refuse missing curated source", async () => {const fixture = mkdtempSync(join(tmpdir(), "storage-symlink-source-"));const root = join(fixture, "checkout");@@ -204,7 +209,9 @@ test("symlinked real checkouts still refuse missing curated source", async () =>mkdirSync(join(root, "crates"));symlinkSync(root, linked, "junction");await assert.rejects(collectFindings(linked), /Missing curated source/);- } finally { rmSync(fixture, { recursive: true, force: true }); }+ } finally {+ rmSync(fixture, { recursive: true, force: true });+ }});test("symlinked --root checkouts cannot bypass required canonical history", () => {@@ -225,10 +232,25 @@ test("symlinked --root checkouts cannot bypass required canonical history", () =}}mkdirSync(join(root, "scripts", "ci"), { recursive: true });- writeFileSync(join(root, "scripts", "ci", "storage-bypass-baseline.json"), "[]\n");+ writeFileSync(+ join(root, "scripts", "ci", "storage-bypass-baseline.json"),+ "[]\n",+ );symlinkSync(root, linked, "junction");- const result = spawnSync(process.execPath, [fileURLToPath(new URL("../ci/check-storage-bypass.mjs", import.meta.url)), "--root", linked], { encoding: "utf8" });+ const result = spawnSync(+ process.execPath,+ [+ fileURLToPath(+ new URL("../ci/check-storage-bypass.mjs", import.meta.url),+ ),+ "--root",+ linked,+ ],+ { encoding: "utf8" },+ );assert.equal(result.status, 1, result.stdout + result.stderr);assert.match(result.stderr, /merge-base|origin\/main|upstream\/main/);- } finally { rmSync(fixture, { recursive: true, force: true }); }+ } finally {+ rmSync(fixture, { recursive: true, force: true });+ }});diff --git a/scripts/ci/check-storage-bypass.mjs b/scripts/ci/check-storage-bypass.mjsindex 71aa55b757..85a3bdb680 100755--- a/scripts/ci/check-storage-bypass.mjs+++ b/scripts/ci/check-storage-bypass.mjs@@ -24,6 +24,7 @@// node scripts/ci/check-storage-bypass.mjs --root <dir> (tests)import { execFileSync } from "node:child_process";+import { realpathSync } from "node:fs";import { stripRustComments } from "./check-crate-chain.mjs";import {validateCoverageDebt,@@ -44,21 +45,20 @@ const baselinePath = resolve("scripts/ci/storage-bypass-baseline.json",);const writeBaseline = process.argv.includes("--write-baseline");-const enforceHistory =- rootFlag === -1 ||- (() => {- try {- return (- execFileSync("git", ["rev-parse", "--show-toplevel"], {- cwd: repoRoot,- encoding: "utf8",- stdio: ["ignore", "pipe", "pipe"],- }).trim() === repoRoot- );- } catch {- return false;- }- })();+/** Identify the actual checkout across symlinks and platform path spelling. */+function sameCheckout(root) {+ try {+ const top = execFileSync("git", ["rev-parse", "--show-toplevel"], {+ cwd: root,+ encoding: "utf8",+ stdio: ["ignore", "pipe", "pipe"],+ }).trim();+ return realpathSync(top) === realpathSync(root);+ } catch {+ return false;+ }+}+const enforceHistory = rootFlag === -1 || sameCheckout(repoRoot);export const CURATED_VENDOR_ROOTS = ["vendor/tinyagents/crates/tinyagents-session/src/run_ledger",@@ -249,15 +249,7 @@ export async function collectFindings(root, { includeAllowed = false } = {}) {const roots = (await readdir(scanRoot, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => resolve(scanRoot, e.name, "src"));- let realCheckout = false;- try {- realCheckout =- execFileSync("git", ["rev-parse", "--show-toplevel"], {- cwd: root,- encoding: "utf8",- stdio: ["ignore", "pipe", "pipe"],- }).trim() === resolve(root);- } catch {}+ const realCheckout = sameCheckout(root);const files = (await Promise.all(roots.map((path) => rustFiles(path)))).flat();