Menu
popagent
publicLatest change 524957811967067a7f24e61c8d72142273a81d9e - Harden model catalog and release gates by AkurAI Build
import { describe, expect, test } from "bun:test";
const root = new URL("..", import.meta.url).pathname;
describe("deploy.sh", () => {
test("is valid Bash and passes the built-in publication privacy scan", async () => {
const syntax = Bun.spawnSync(["bash", "-n", "deploy.sh"], { cwd: root });
expect(syntax.exitCode).toBe(0);
const privacy = Bun.spawnSync(["bash", "deploy.sh", "privacy-check"], { cwd: root });
expect(privacy.exitCode).toBe(0);
});
test("reinstalls dependencies when a dependency patch changes", async () => {
const script = await Bun.file(new URL("../deploy.sh", import.meta.url)).text();
expect(script).toContain("package.json bun.lock patches/");
expect(script).toContain("bun install --force --frozen-lockfile");
});
test("preserves the pre-update revision across deploy script re-execution", async () => {
const script = await Bun.file(new URL("../deploy.sh", import.meta.url)).text();
expect(script).toContain('POPAGENT_DEPLOY_BEFORE="$checkout_before"');
expect(script).toContain('checkout_before="${POPAGENT_DEPLOY_BEFORE:-$checkout_before}"');
});
test("requires changelog and version changes from the deployed release", async () => {
const script = await Bun.file(new URL("../deploy.sh", import.meta.url)).text();
expect(script).toContain('previous="$(<"$DATA_DIR/deploy/current-release")"');
expect(script).toContain('require_changelog_update "$previous" "$release"');
expect(script).toContain('require_version_update "$previous" "$release"');
});
test("connects non-root managed deployments to the user service manager", async () => {
const script = await Bun.file(new URL("../deploy.sh", import.meta.url)).text();
expect(script).toContain('XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"');
expect(script).toContain('DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-unix:path=$XDG_RUNTIME_DIR/bus}"');
});
test("reuses immutable CI verification with timestamp evidence during managed deployment", async () => {
const script = await Bun.file(new URL("../deploy.sh", import.meta.url)).text();
const pipeline = await Bun.file(new URL("../.akurai.yml", import.meta.url)).text();
expect(script).toContain("reuse_immutable_verification");
expect(script).toContain("POPAGENT_VERIFIED_AT");
expect(pipeline).toContain('POPAGENT_VERIFIED_REVISION="$REVISION"');
expect(pipeline).toContain('POPAGENT_VERIFIED_AT="$(date -u +%Y%m%dT%H%M%SZ)"');
});
test("allows integration contracts to finish under shared worker load", async () => {
const script = await Bun.file(new URL("../deploy.sh", import.meta.url)).text();
expect(script).toContain('bun test --timeout 15000 "$@"');
});
test("ignores managed runtime checkouts during verification", async () => {
const bunfig = await Bun.file(new URL("../bunfig.toml", import.meta.url)).text();
const tsconfig = await Bun.file(new URL("../tsconfig.json", import.meta.url)).text();
expect(bunfig).toContain('"data/self-update/**"');
expect(bunfig).toContain('"data/build-maintenance/**"');
expect(tsconfig).toContain('"data/self-update/**"');
expect(tsconfig).toContain('"data/build-maintenance/**"');
});
});