From df3431f91464d16fd1893337663120ced857a0da Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 26 Oct 2026 09:15:27 +0000 Subject: [PATCH] test(diagram-render): name the bundle, BUILD_INFO and build script by repo path so the pre-gate sees their lane Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/diagram-render-drift.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/diagram-render-drift.test.ts b/test/diagram-render-drift.test.ts index 48b1574e6..5ad5d1857 100644 --- a/test/diagram-render-drift.test.ts +++ b/test/diagram-render-drift.test.ts @@ -17,9 +17,13 @@ import { createHash } from "node:crypto"; import { existsSync } from "node:fs"; import path from "node:path"; -const ROOT = path.resolve(import.meta.dir, "..", "lib", "diagram-render"); -const DIST_HTML = path.join(ROOT, "dist", "diagram-render.html"); -const BUILD_INFO = path.join(ROOT, "dist", "BUILD_INFO.json"); +// Repo-relative segment runs, so the pre-gate's import graph sees that this +// test owns the committed bundle, its BUILD_INFO and the build script. +const REPO = path.resolve(import.meta.dir, ".."); +const ROOT = path.join(REPO, "lib", "diagram-render"); +const DIST_HTML = path.join(REPO, "lib", "diagram-render", "dist", "diagram-render.html"); +const BUILD_INFO = path.join(REPO, "lib", "diagram-render", "dist", "BUILD_INFO.json"); +const BUILD_SCRIPT = path.join(REPO, "lib", "diagram-render", "scripts", "build.ts"); describe("diagram-render bundle drift", () => { test("dist hash matches BUILD_INFO (tamper check)", async () => { @@ -43,7 +47,7 @@ describe("diagram-render bundle drift", () => { const info = await Bun.file(BUILD_INFO).json(); const srcSha = createHash("sha256") .update(await Bun.file(path.join(ROOT, "src", "entry.ts")).text()) - .update(await Bun.file(path.join(ROOT, "scripts", "build.ts")).text()) + .update(await Bun.file(BUILD_SCRIPT).text()) .digest("hex"); expect(srcSha).toBe(info.srcSha256); });