426e9eeabd
Voice Workbench / headless workbench (mocked backends) (push) Has been cancelled
Voice Workbench / real acoustic lane (nightly, provisioned only) (push) Has been cancelled
ci / test (push) Has been cancelled
ci / lint-and-format (push) Has been cancelled
ci / build (push) Has been cancelled
ci / dev-startup (push) Has been cancelled
gitleaks / gitleaks (push) Has been cancelled
Markdown Links / Relative Markdown Links (push) Has been cancelled
Quality (Extended) / Homepage Build (PR smoke) (push) Has been cancelled
Quality (Extended) / Comment-only diff guard (push) Has been cancelled
Quality (Extended) / Format + Type Safety Ratchet (push) Has been cancelled
Quality (Extended) / Develop Gate (secret scan + UI determinism) (push) Has been cancelled
Quality (Extended) / Develop Gate (lint) (push) Has been cancelled
Chat shell gestures / Chat shell gesture + parity e2e (push) Has been cancelled
Cloud Gateway Discord / Test (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx @biomejs/biome check packages/lifeops-bench/src, benchmark-lint) (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx vitest run --config packages/lifeops-bench/vitest.config.ts --root packages/lifeops-bench --passWithNoTests, benchmark-tests) (push) Has been cancelled
Build Agent Image / build-and-push (push) Has been cancelled
Dev Smoke / bun run dev onboarding chat (push) Has been cancelled
Dev Smoke / Vite HMR dependency-level smoke (push) Has been cancelled
Electrobun Submodule Guard / electrobun gitlink is fetchable (push) Has been cancelled
Publish @elizaos/example-code / check_npm (push) Has been cancelled
Publish @elizaos/example-code / publish_npm (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / verify_version (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / publish_npm (push) Has been cancelled
Sandbox Live Smoke / Sandbox live smoke (push) Has been cancelled
Snap Build & Test / Build Snap (amd64) (push) Has been cancelled
Snap Build & Test / Build Snap (arm64) (push) Has been cancelled
Test Packaging / elizaos CLI global-install smoke (node + bun) (push) Has been cancelled
Cloud Gateway Webhook / Test (push) Has been cancelled
Cloud Tests / lint-and-types (push) Has been cancelled
Cloud Tests / unit-tests (push) Has been cancelled
Cloud Tests / integration-tests (push) Has been cancelled
Cloud Tests / e2e-tests (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Apps Worker (Product 2) / Determine environment (push) Has been cancelled
Deploy Apps Worker (Product 2) / Deploy apps worker to apps-control host (${{ needs.determine-env.outputs.environment }}) (push) Has been cancelled
Deploy Eliza Provisioning Worker / Determine environment (push) Has been cancelled
Deploy Eliza Provisioning Worker / Deploy worker to Hetzner host (${{ needs.determine-env.outputs.environment }} @ ${{ needs.determine-env.outputs.deployment_sha }}) (push) Has been cancelled
Dev Smoke / Classify changed paths (push) Has been cancelled
supply-chain / sbom (push) Has been cancelled
supply-chain / vulnerability-scan (push) Has been cancelled
Build, Push & Deploy to Phala Cloud / build-and-push (push) Has been cancelled
Test Packaging / Validate Packaging Configs (push) Has been cancelled
Test Packaging / Build & Test PyPI Package (push) Has been cancelled
Test Packaging / PyPI on Python ${{ matrix.python }} (push) Has been cancelled
Test Packaging / Pack & Test JS Tarballs (push) Has been cancelled
UI Fixture E2E / ui-fixture-e2e (push) Has been cancelled
UI Fixture E2E / fixture-e2e (push) Has been cancelled
UI Story Gate / story-gate (push) Has been cancelled
vault-ci / test (macos-latest) (push) Has been cancelled
vault-ci / test (ubuntu-latest) (push) Has been cancelled
vault-ci / test (windows-latest) (push) Has been cancelled
vault-ci / app-core wiring tests (push) Has been cancelled
verify-patches / verify patches/CHECKSUMS.sha256 (push) Has been cancelled
Voice Benchmark Smoke / voice-emotion fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voiceagentbench fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench-quality unit smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench TypeScript unit (no audio) (push) Has been cancelled
Voice Benchmark Smoke / voice bench smoke summary (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/app-core test bun run --cwd packages/elizaos test bun run --cwd packages/cloud/shared test], app-and-cli) (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/scenario-runner test bun run --cwd packages/vault test bun run --cwd packages/security test bun run --cwd plugins/plugin-coding-tools test], framework-packages) (push) Has been cancelled
Windows CI / windows ([bun run --cwd plugins/plugin-elizacloud test bun run --cwd plugins/plugin-discord test bun run --cwd plugins/plugin-anthropic test bun run --cwd plugins/plugin-openai test bun run --cwd plugins/plugin-app-control test bun run --cwd plugins/pl… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run build --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/agent --concurrency=4 node packages/scripts/run-bash-linux-only.mjs scripts/verify-riscv64-buildpaths.sh node packages/scripts/run… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run typecheck --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/cloud-shared --concurrency=4 bun run --cwd packages/core test bun run --cwd packages/shared test], core-runtime, 75) (push) Has been cancelled
163 lines
5.8 KiB
TypeScript
163 lines
5.8 KiB
TypeScript
/**
|
|
* Smoke test for the packages/app extension of the script inventory tool
|
|
* (issue #10200, item 2). The tool classifies the *second* dense script surface
|
|
* (packages/app/package.json) by reachability; this locks in that the app
|
|
* section is produced, totals are internally consistent, and the Turbo-fan-out /
|
|
* --cwd reachability edges keep classifying the canonical app scripts.
|
|
*
|
|
* Outside workspace test discovery — run via
|
|
* bun test packages/scripts/__tests__/audit-scripts-inventory.test.ts
|
|
*/
|
|
import { describe, expect, test } from "bun:test";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
import { buildInventory } from "../audit-scripts-inventory.mjs";
|
|
|
|
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
const REPO_ROOT = path.resolve(SCRIPT_DIR, "..", "..", "..");
|
|
|
|
const APP_CATEGORIES = [
|
|
"reachable-from-verify",
|
|
"reachable-from-test",
|
|
"reachable-from-build",
|
|
"reachable-from-ci-workflow",
|
|
"reachable-from-app-internal",
|
|
"orphan",
|
|
];
|
|
|
|
const FILE_CATEGORIES = [
|
|
"reachable-from-verify",
|
|
"reachable-from-test",
|
|
"reachable-from-build",
|
|
"reachable-from-ci-workflow",
|
|
"reachable-from-operator-script",
|
|
"reachable-from-package-script",
|
|
"reachable-from-docs",
|
|
"orphan",
|
|
];
|
|
|
|
function appScriptNames() {
|
|
const pkg = JSON.parse(
|
|
readFileSync(
|
|
path.join(REPO_ROOT, "packages", "app", "package.json"),
|
|
"utf8",
|
|
),
|
|
) as { scripts?: Record<string, string> };
|
|
return Object.keys(pkg.scripts ?? {});
|
|
}
|
|
|
|
describe("script inventory: packages/app surface (issue #10200)", () => {
|
|
const inv = buildInventory();
|
|
|
|
test("classifies every packages/app script exactly once", () => {
|
|
const names = appScriptNames();
|
|
expect(inv.appScripts.map((a) => a.name).sort()).toEqual([...names].sort());
|
|
expect(inv.summary.totalAppScripts).toBe(names.length);
|
|
});
|
|
|
|
test("every app script carries a known category", () => {
|
|
for (const a of inv.appScripts) {
|
|
expect(APP_CATEGORIES).toContain(a.category);
|
|
}
|
|
});
|
|
|
|
test("category totals sum to the script count and match the per-script tally", () => {
|
|
const byCat = inv.summary.appScriptsByCategory;
|
|
const sum = APP_CATEGORIES.reduce((n, c) => n + byCat[c], 0);
|
|
expect(sum).toBe(inv.summary.totalAppScripts);
|
|
expect(byCat.orphan).toBe(inv.summary.orphanAppScripts);
|
|
});
|
|
|
|
test("Turbo fan-out reaches the app build/lint/typecheck scripts (not orphan)", () => {
|
|
const cat = (name: string) =>
|
|
inv.appScripts.find((a) => a.name === name)?.category;
|
|
const names = new Set(appScriptNames());
|
|
for (const task of ["build", "lint", "typecheck"]) {
|
|
if (names.has(task)) {
|
|
expect(cat(task), `app ${task} should be reachable`).not.toBe("orphan");
|
|
}
|
|
}
|
|
});
|
|
|
|
test("a --cwd packages/app CI-only script is reachable-from-ci-workflow", () => {
|
|
// test:e2e is invoked across the workflows as `--cwd packages/app test:e2e`.
|
|
const names = new Set(appScriptNames());
|
|
if (names.has("test:e2e")) {
|
|
const entry = inv.appScripts.find((a) => a.name === "test:e2e");
|
|
expect(entry?.category).toBe("reachable-from-ci-workflow");
|
|
}
|
|
});
|
|
|
|
test("the root/file sections are still present and unchanged in shape", () => {
|
|
expect(Array.isArray(inv.roots)).toBe(true);
|
|
expect(Array.isArray(inv.files)).toBe(true);
|
|
expect(inv.summary.totalRootScripts).toBe(inv.roots.length);
|
|
});
|
|
|
|
test("package-local script callers keep helper files out of the orphan bucket", () => {
|
|
for (const f of inv.files) {
|
|
expect(FILE_CATEGORIES).toContain(f.category);
|
|
}
|
|
|
|
const darwinWrapper = inv.files.find(
|
|
(f) => f.file === "run-bash-darwin-only.mjs",
|
|
);
|
|
expect(darwinWrapper?.category).toBe("reachable-from-package-script");
|
|
expect(darwinWrapper?.packageScriptCallers).toContainEqual({
|
|
packageJson: "packages/native/ios-deps/package.json",
|
|
script: "build:llama-cpp",
|
|
});
|
|
expect(
|
|
inv.summary.filesByCategory["reachable-from-package-script"],
|
|
).toBeGreaterThan(0);
|
|
expect(inv.summary.packageScriptFileReferences).toBeGreaterThan(0);
|
|
});
|
|
|
|
test("named root operator scripts keep their entrypoint files out of the orphan bucket", () => {
|
|
const byFile = (name: string) => inv.files.find((f) => f.file === name);
|
|
const byRoot = (name: string) => inv.roots.find((r) => r.name === name);
|
|
|
|
expect(byRoot("dev:all")?.category).toBe("reachable-from-operator-script");
|
|
expect(byFile("dev-all.mjs")?.category).toBe(
|
|
"reachable-from-operator-script",
|
|
);
|
|
expect(byFile("dev-all.mjs")?.operatorScriptCallers).toContainEqual({
|
|
packageJson: "package.json",
|
|
script: "dev:all",
|
|
});
|
|
expect(byRoot("audit:scripts:inventory")?.category).toBe(
|
|
"reachable-from-operator-script",
|
|
);
|
|
expect(byFile("audit-scripts-inventory.mjs")?.category).toBe(
|
|
"reachable-from-operator-script",
|
|
);
|
|
expect(
|
|
byFile("audit-scripts-inventory.mjs")?.operatorScriptCallers,
|
|
).toContainEqual({
|
|
packageJson: "package.json",
|
|
script: "audit:scripts:inventory",
|
|
});
|
|
expect(
|
|
inv.summary.filesByCategory["reachable-from-operator-script"],
|
|
).toBeGreaterThan(0);
|
|
expect(inv.summary.operatorScriptFileReferences).toBeGreaterThan(0);
|
|
});
|
|
|
|
test("documented standalone scripts are tracked separately from true orphans", () => {
|
|
const byFile = (name: string) => inv.files.find((f) => f.file === name);
|
|
|
|
expect(byFile("ensure-skills.mjs")?.category).toBe("reachable-from-docs");
|
|
expect(byFile("run-scenarios-isolated.mjs")?.category).toBe(
|
|
"reachable-from-docs",
|
|
);
|
|
expect(byFile("validate-tee-local-stack.mjs")?.category).toBe(
|
|
"reachable-from-docs",
|
|
);
|
|
expect(inv.summary.filesByCategory.orphan).toBe(0);
|
|
expect(inv.summary.orphanFiles).toBe(0);
|
|
expect(inv.summary.documentationFileReferences).toBeGreaterThan(0);
|
|
});
|
|
});
|