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
381 lines
11 KiB
JavaScript
Executable File
381 lines
11 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
/** Exercises changed-source/test classification against a real throwaway Git history. */
|
|
import assert from "node:assert/strict";
|
|
import { spawnSync } from "node:child_process";
|
|
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { dirname, join } from "node:path";
|
|
|
|
const root = new URL("../..", import.meta.url).pathname;
|
|
const script = join(root, "scripts/security/coverage-changed-files.sh");
|
|
|
|
function git(cwd, ...args) {
|
|
const result = spawnSync("git", args, { cwd, encoding: "utf8" });
|
|
assert.equal(
|
|
result.status,
|
|
0,
|
|
`git ${args.join(" ")} failed: ${result.stderr}`,
|
|
);
|
|
return result.stdout.trim();
|
|
}
|
|
|
|
function write(cwd, relPath, contents) {
|
|
const full = join(cwd, relPath);
|
|
mkdirSync(dirname(full), { recursive: true });
|
|
writeFileSync(full, contents);
|
|
}
|
|
|
|
// Parse the `name<<EOF\n...\nEOF` heredoc blocks the script emits so assertions
|
|
// read against the same shape GitHub Actions stores into step outputs.
|
|
function parseOutput(stdout) {
|
|
const sections = {};
|
|
const lines = stdout.split("\n");
|
|
let key = null;
|
|
let buf = [];
|
|
for (const line of lines) {
|
|
if (key === null) {
|
|
const m = line.match(/^(\w+)<<EOF$/);
|
|
if (m) {
|
|
key = m[1];
|
|
buf = [];
|
|
}
|
|
continue;
|
|
}
|
|
if (line === "EOF") {
|
|
sections[key] = buf.filter((l) => l !== "");
|
|
key = null;
|
|
continue;
|
|
}
|
|
buf.push(line);
|
|
}
|
|
return sections;
|
|
}
|
|
|
|
function runScript(cwd, base, head) {
|
|
const result = spawnSync("bash", [script, base, head], {
|
|
cwd,
|
|
encoding: "utf8",
|
|
});
|
|
assert.equal(result.status, 0, result.stderr || result.stdout);
|
|
return parseOutput(result.stdout);
|
|
}
|
|
|
|
function assertCase(name, fn) {
|
|
try {
|
|
fn();
|
|
console.log(`ok - ${name}`);
|
|
} catch (error) {
|
|
console.error(`not ok - ${name}`);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
const dir = mkdtempSync(join(tmpdir(), "coverage-changed-"));
|
|
try {
|
|
git(dir, "init", "-q");
|
|
git(dir, "config", "user.email", "test@example.com");
|
|
git(dir, "config", "user.name", "test");
|
|
git(dir, "checkout", "-q", "-b", "develop");
|
|
|
|
// Merge-base commit: the point the feature branch forks from.
|
|
write(dir, "packages/demo/src/base.ts", "export const base = 1;\n");
|
|
write(
|
|
dir,
|
|
"packages/demo/src/runtime-equivalent.ts",
|
|
"export const stable: number = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/runtime-changed.ts",
|
|
"export const changed: number = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/vite-directive.ts",
|
|
'export const load = () => import("./module");\n',
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/coverage-directive.ts",
|
|
"export const covered: number = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/decorator-metadata.ts",
|
|
"class Example { @field value: string; }\n",
|
|
);
|
|
write(dir, "packages/demo/src/deleted.ts", "export const removed = 1;\n");
|
|
git(dir, "add", "-A");
|
|
git(dir, "commit", "-q", "-m", "base");
|
|
const mergeBase = git(dir, "rev-parse", "HEAD");
|
|
|
|
// develop advances with a file the feature branch never touches.
|
|
write(dir, "packages/demo/src/develop-only.ts", "export const d = 1;\n");
|
|
git(dir, "add", "-A");
|
|
git(dir, "commit", "-q", "-m", "develop advances");
|
|
const developTip = git(dir, "rev-parse", "HEAD"); // BASE (event-time develop tip)
|
|
|
|
// Feature branch forks from the merge-base and adds its own source + tests.
|
|
git(dir, "checkout", "-q", "-b", "feature", mergeBase);
|
|
rmSync(join(dir, "packages/demo/src/deleted.ts"));
|
|
write(
|
|
dir,
|
|
"packages/demo/src/runtime-equivalent.ts",
|
|
"export const stable : number | string = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/runtime-changed.ts",
|
|
"export const changed: number = 2;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/vite-directive.ts",
|
|
'export const load = () => import(/* @vite-ignore */ "./module");\n',
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/coverage-directive.ts",
|
|
"/* c8 ignore next */\nexport const covered: number = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/decorator-metadata.ts",
|
|
"class Example { @field value: number; }\n",
|
|
);
|
|
write(dir, "packages/demo/src/feature.ts", "export const f = 1;\n");
|
|
write(
|
|
dir,
|
|
"packages/demo/src/types.ts",
|
|
"export interface RuntimeFree { id: string }\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/public.d.ts",
|
|
"export interface PublicType { id: string }\n",
|
|
);
|
|
write(dir, "packages/demo/src/runtime.mjs", "export const mjs = 1;\n");
|
|
write(dir, "packages/demo/src/runtime.cjs", "exports.cjs = 1;\n");
|
|
write(
|
|
dir,
|
|
"packages/demo/src/_router.generated.ts",
|
|
"export const generatedRoute = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/generated/schema.ts",
|
|
"export const generatedSchema = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/runtime.mts",
|
|
"export const mts: number = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/runtime.cts",
|
|
"export const cts: number = 1;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/app/scripts/walkthrough-e2e.mjs",
|
|
"export async function runWalkthrough() {}\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"scripts/security/tool.self-test.mjs",
|
|
"throw new Error('self-test only');\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"scripts/security/coverage-gate.self-test.mjs",
|
|
"process.stdout.write('registered self-test ran');\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"plugins/plugin-demo/vitest.config.ts",
|
|
"export default { test: { include: ['scripts/**/*.test.mjs'] } };\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/feature.test.ts",
|
|
"import { test } from 'vitest';\ntest('f', () => {});\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/native.test.ts",
|
|
"import { test } from 'bun:test';\ntest('n', () => {});\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/test/e2e/flow.test.ts",
|
|
"import { test } from 'bun:test';\ntest('e2e', () => {});\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/test/cloud-e2e/tests/live-deploy.spec.ts",
|
|
"import { test } from '../src/helpers/test-fixtures';\ntest('live', () => {});\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/__e2e__/fixture.tsx",
|
|
"export const Fixture = () => null;\n",
|
|
);
|
|
write(
|
|
dir,
|
|
"packages/demo/src/feature.stories.tsx",
|
|
"export default { title: 'Feature' };\n",
|
|
);
|
|
git(dir, "add", "-A");
|
|
git(dir, "commit", "-q", "-m", "feature work");
|
|
const featureTip = git(dir, "rev-parse", "HEAD"); // HEAD
|
|
|
|
const out = runScript(dir, developTip, featureTip);
|
|
|
|
assertCase(
|
|
"three-dot diff excludes develop-side files (issue #15845)",
|
|
() => {
|
|
// Prove the hazard is real: a plain two-dot diff would drag the develop-only
|
|
// file into the changed set.
|
|
const twoDot = git(
|
|
dir,
|
|
"diff",
|
|
"--name-only",
|
|
developTip,
|
|
featureTip,
|
|
).split("\n");
|
|
assert.ok(
|
|
twoDot.includes("packages/demo/src/develop-only.ts"),
|
|
"expected two-dot diff to include the develop-side file",
|
|
);
|
|
// The script uses three-dot, so it must not.
|
|
assert.ok(
|
|
!out.files.includes("packages/demo/src/develop-only.ts"),
|
|
`develop-side file leaked into changed source: ${out.files.join(",")}`,
|
|
);
|
|
assert.ok(
|
|
out.files.includes("packages/demo/src/feature.ts"),
|
|
`feature source missing from changed set: ${out.files.join(",")}`,
|
|
);
|
|
},
|
|
);
|
|
|
|
assertCase(
|
|
"e2e directory tests excluded from unit lanes (issue #15845)",
|
|
() => {
|
|
assert.ok(
|
|
!out.bun_tests.includes("packages/demo/test/e2e/flow.test.ts"),
|
|
`e2e-dir test leaked into bun lane: ${out.bun_tests.join(",")}`,
|
|
);
|
|
assert.ok(
|
|
!out.vitest_tests.includes("packages/demo/test/e2e/flow.test.ts"),
|
|
`e2e-dir test leaked into vitest lane: ${out.vitest_tests.join(",")}`,
|
|
);
|
|
},
|
|
);
|
|
|
|
assertCase("cloud Playwright specs stay in their dedicated lane", () => {
|
|
const liveSpec = "packages/test/cloud-e2e/tests/live-deploy.spec.ts";
|
|
assert.ok(
|
|
!out.bun_tests.includes(liveSpec),
|
|
`cloud Playwright spec leaked into bun lane: ${out.bun_tests.join(",")}`,
|
|
);
|
|
assert.ok(
|
|
!out.vitest_tests.includes(liveSpec),
|
|
`cloud Playwright spec leaked into vitest lane: ${out.vitest_tests.join(",")}`,
|
|
);
|
|
});
|
|
|
|
assertCase(
|
|
"e2e fixtures and stories are not product coverage targets",
|
|
() => {
|
|
assert.ok(!out.files.includes("packages/demo/src/__e2e__/fixture.tsx"));
|
|
assert.ok(!out.files.includes("packages/demo/src/feature.stories.tsx"));
|
|
assert.ok(
|
|
!out.files.includes("packages/app/scripts/walkthrough-e2e.mjs"),
|
|
);
|
|
},
|
|
);
|
|
|
|
assertCase("unit tests bucket by imported runner", () => {
|
|
assert.ok(
|
|
out.bun_tests.includes("packages/demo/src/native.test.ts"),
|
|
`bun-native test missing: ${out.bun_tests.join(",")}`,
|
|
);
|
|
assert.ok(
|
|
!out.bun_tests.includes("packages/demo/src/feature.test.ts"),
|
|
"vitest test wrongly in bun lane",
|
|
);
|
|
assert.ok(
|
|
out.vitest_tests.includes("packages/demo/src/feature.test.ts"),
|
|
`vitest test missing: ${out.vitest_tests.join(",")}`,
|
|
);
|
|
});
|
|
|
|
assertCase("vitest config changes are not LCOV-enforced source", () => {
|
|
assert.ok(
|
|
!out.files.includes("plugins/plugin-demo/vitest.config.ts"),
|
|
`vitest config leaked into changed source: ${out.files.join(",")}`,
|
|
);
|
|
});
|
|
|
|
assertCase("generated modules are not LCOV-enforced source", () => {
|
|
assert.ok(!out.files.includes("packages/demo/src/_router.generated.ts"));
|
|
assert.ok(!out.files.includes("packages/demo/src/generated/schema.ts"));
|
|
});
|
|
|
|
assertCase(
|
|
"only registered standalone self-tests leave source enforcement",
|
|
() => {
|
|
assert.ok(out.files.includes("scripts/security/tool.self-test.mjs"));
|
|
assert.ok(
|
|
!out.files.includes("scripts/security/coverage-gate.self-test.mjs"),
|
|
);
|
|
assert.ok(
|
|
out.node_tests.includes("scripts/security/coverage-gate.self-test.mjs"),
|
|
);
|
|
},
|
|
);
|
|
|
|
assertCase(
|
|
"deleted, declaration, and type-only sources are not LCOV-enforced",
|
|
() => {
|
|
assert.ok(!out.files.includes("packages/demo/src/deleted.ts"));
|
|
assert.ok(!out.files.includes("packages/demo/src/public.d.ts"));
|
|
assert.ok(!out.files.includes("packages/demo/src/types.ts"));
|
|
},
|
|
);
|
|
|
|
assertCase("runtime-equivalent source changes are not LCOV-enforced", () => {
|
|
assert.ok(!out.files.includes("packages/demo/src/runtime-equivalent.ts"));
|
|
assert.ok(
|
|
out.files.includes("packages/demo/src/runtime-changed.ts"),
|
|
`runtime change missing from changed source: ${out.files.join(",")}`,
|
|
);
|
|
assert.ok(
|
|
out.files.includes("packages/demo/src/feature.ts"),
|
|
`added runtime source missing from changed source: ${out.files.join(",")}`,
|
|
);
|
|
});
|
|
|
|
assertCase("semantic comment changes remain LCOV-enforced", () => {
|
|
assert.ok(out.files.includes("packages/demo/src/vite-directive.ts"));
|
|
assert.ok(out.files.includes("packages/demo/src/coverage-directive.ts"));
|
|
});
|
|
|
|
assertCase("decorator metadata type changes remain LCOV-enforced", () => {
|
|
assert.ok(out.files.includes("packages/demo/src/decorator-metadata.ts"));
|
|
});
|
|
|
|
assertCase("all executable module extensions are LCOV-enforced", () => {
|
|
for (const extension of ["mjs", "cjs", "mts", "cts"]) {
|
|
assert.ok(
|
|
out.files.includes(`packages/demo/src/runtime.${extension}`),
|
|
`${extension} runtime module missing: ${out.files.join(",")}`,
|
|
);
|
|
}
|
|
});
|
|
} finally {
|
|
rmSync(dir, { recursive: true, force: true });
|
|
}
|