Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
403 lines
12 KiB
TypeScript
403 lines
12 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
collectHostedGateEvidence,
|
|
parseArgs,
|
|
parseWorkflowRunPages,
|
|
SCHEDULED_HOSTED_WORKFLOWS,
|
|
} from "../../scripts/verify-pr-hosted-gates.mjs";
|
|
|
|
const sha = "773ffd87a1e1e34451ad6e38fda37380c2569a50";
|
|
const BUILD_ARTIFACTS_WORKFLOW = "Blacksmith Build Artifacts Testbox";
|
|
|
|
function successfulRun(name: string, id: number, updatedAt: string) {
|
|
return {
|
|
id,
|
|
name,
|
|
event: "pull_request",
|
|
status: "completed",
|
|
conclusion: "success",
|
|
head_sha: sha,
|
|
path: ".github/workflows/ci.yml",
|
|
created_at: "2026-06-17T10:46:24Z",
|
|
updated_at: updatedAt,
|
|
html_url: `https://github.com/openclaw/openclaw/actions/runs/${id}`,
|
|
};
|
|
}
|
|
|
|
describe("verify-pr-hosted-gates", () => {
|
|
it("requires the latest scheduled workflow run to pass", () => {
|
|
const evidence = collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
successfulRun("CI", 1, "2026-06-17T10:47:00Z"),
|
|
{
|
|
...successfulRun("Blacksmith Testbox", 2, "2026-06-17T10:47:30Z"),
|
|
event: "workflow_dispatch",
|
|
},
|
|
successfulRun("Blacksmith Testbox", 3, "2026-06-17T10:48:00Z"),
|
|
successfulRun("Blacksmith ARM Testbox", 4, "2026-06-17T10:49:00Z"),
|
|
successfulRun("Blacksmith Build Artifacts Testbox", 5, "2026-06-17T10:50:00Z"),
|
|
successfulRun("Workflow Sanity", 6, "2026-06-17T10:51:00Z"),
|
|
],
|
|
});
|
|
|
|
expect(evidence).toEqual({
|
|
headSha: sha,
|
|
workflows: [
|
|
expect.objectContaining({ name: "CI", id: 1 }),
|
|
expect.objectContaining({ name: "Blacksmith Testbox", id: 3 }),
|
|
expect.objectContaining({ name: "Blacksmith ARM Testbox", id: 4 }),
|
|
expect.objectContaining({ name: "Blacksmith Build Artifacts Testbox", id: 5 }),
|
|
expect.objectContaining({ name: "Workflow Sanity", id: 6 }),
|
|
],
|
|
});
|
|
});
|
|
|
|
it("rejects a failed rerun of a workflow that was scheduled for the exact head", () => {
|
|
const workflowRuns = ["CI", ...SCHEDULED_HOSTED_WORKFLOWS].map((name, index) =>
|
|
successfulRun(name, index + 1, `2026-06-17T10:4${index}:00Z`),
|
|
);
|
|
workflowRuns[2] = {
|
|
...workflowRuns[2],
|
|
conclusion: "failure",
|
|
updated_at: "2026-06-17T10:50:00Z",
|
|
};
|
|
|
|
expect(() => collectHostedGateEvidence({ sha, workflowRuns })).toThrow(
|
|
"Missing successful exact-head Blacksmith ARM Testbox workflow",
|
|
);
|
|
});
|
|
|
|
it("accepts a non-docs PR when CI is the only scheduled authoritative workflow", () => {
|
|
expect(
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [successfulRun("CI", 1, "2026-06-17T10:47:00Z")],
|
|
}),
|
|
).toEqual({
|
|
headSha: sha,
|
|
workflows: [expect.objectContaining({ name: "CI", id: 1 })],
|
|
});
|
|
});
|
|
|
|
it("uses the latest CI run when an older duplicate was cancelled", () => {
|
|
expect(
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun("CI", 1, "2026-06-17T10:47:00Z"),
|
|
conclusion: "cancelled",
|
|
},
|
|
successfulRun("CI", 2, "2026-06-17T10:48:00Z"),
|
|
],
|
|
}),
|
|
).toEqual({
|
|
headSha: sha,
|
|
workflows: [expect.objectContaining({ name: "CI", id: 2 })],
|
|
});
|
|
});
|
|
|
|
it("accepts the explicit exact-SHA manual CI release gate", () => {
|
|
expect(
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 1, "2026-06-17T10:47:00Z"),
|
|
event: "workflow_dispatch",
|
|
path: ".github/workflows/ci.yml@refs/heads/release-controls",
|
|
display_title: `CI release gate ${sha}`,
|
|
},
|
|
],
|
|
}),
|
|
).toEqual({
|
|
headSha: sha,
|
|
workflows: [expect.objectContaining({ name: `CI release gate ${sha}`, id: 1 })],
|
|
});
|
|
});
|
|
|
|
it("prefers the exact release-gate fallback while scheduled CI remains queued", () => {
|
|
expect(
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun("CI", 1, "2026-06-17T10:47:00Z"),
|
|
status: "queued",
|
|
conclusion: null,
|
|
updated_at: "2026-06-17T10:50:00Z",
|
|
},
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 2, "2026-06-17T10:49:00Z"),
|
|
event: "workflow_dispatch",
|
|
display_title: `CI release gate ${sha}`,
|
|
},
|
|
],
|
|
}),
|
|
).toEqual({
|
|
headSha: sha,
|
|
workflows: [expect.objectContaining({ name: `CI release gate ${sha}`, id: 2 })],
|
|
});
|
|
});
|
|
|
|
it("rejects a completed scheduled CI failure even when a fallback passed", () => {
|
|
expect(() =>
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun("CI", 1, "2026-06-17T10:50:00Z"),
|
|
conclusion: "failure",
|
|
},
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 2, "2026-06-17T10:49:00Z"),
|
|
event: "workflow_dispatch",
|
|
display_title: `CI release gate ${sha}`,
|
|
},
|
|
],
|
|
}),
|
|
).toThrow("Missing successful exact-head CI workflow");
|
|
});
|
|
|
|
it("does not mask a failed CI run with a queued rerun and release-gate fallback", () => {
|
|
expect(() =>
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun("CI", 1, "2026-06-17T10:47:00Z"),
|
|
conclusion: "failure",
|
|
},
|
|
{
|
|
...successfulRun("CI", 2, "2026-06-17T10:48:00Z"),
|
|
status: "in_progress",
|
|
conclusion: null,
|
|
},
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 3, "2026-06-17T10:49:00Z"),
|
|
event: "workflow_dispatch",
|
|
display_title: `CI release gate ${sha}`,
|
|
},
|
|
],
|
|
}),
|
|
).toThrow("Missing successful exact-head CI workflow");
|
|
});
|
|
|
|
it("covers a queued artifact Testbox only with a completed exact CI fallback", () => {
|
|
expect(
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 1, "2026-06-17T10:49:00Z"),
|
|
event: "workflow_dispatch",
|
|
display_title: `CI release gate ${sha}`,
|
|
},
|
|
successfulRun("CI", 3, "2026-06-17T10:51:00Z"),
|
|
successfulRun("Blacksmith Testbox", 4, "2026-06-17T10:52:00Z"),
|
|
successfulRun("Blacksmith ARM Testbox", 5, "2026-06-17T10:53:00Z"),
|
|
successfulRun("Workflow Sanity", 6, "2026-06-17T10:54:00Z"),
|
|
{
|
|
...successfulRun(BUILD_ARTIFACTS_WORKFLOW, 2, "2026-06-17T10:50:00Z"),
|
|
status: "queued",
|
|
conclusion: null,
|
|
},
|
|
],
|
|
}),
|
|
).toEqual({
|
|
headSha: sha,
|
|
workflows: [
|
|
expect.objectContaining({ name: "CI", id: 3 }),
|
|
expect.objectContaining({ name: "Blacksmith Testbox", id: 4 }),
|
|
expect.objectContaining({ name: "Blacksmith ARM Testbox", id: 5 }),
|
|
expect.objectContaining({ name: "Workflow Sanity", id: 6 }),
|
|
],
|
|
fallbackCoveredWorkflows: [
|
|
{
|
|
name: BUILD_ARTIFACTS_WORKFLOW,
|
|
coveredBy: "CI release gate",
|
|
reason: "scheduled workflow is queued",
|
|
},
|
|
],
|
|
});
|
|
});
|
|
|
|
it("does not cover queued artifacts until all supporting workflow gates pass", () => {
|
|
expect(() =>
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 1, "2026-06-17T10:49:00Z"),
|
|
event: "workflow_dispatch",
|
|
display_title: `CI release gate ${sha}`,
|
|
},
|
|
{
|
|
...successfulRun(BUILD_ARTIFACTS_WORKFLOW, 2, "2026-06-17T10:50:00Z"),
|
|
status: "queued",
|
|
conclusion: null,
|
|
},
|
|
],
|
|
}),
|
|
).toThrow("Missing successful exact-head Blacksmith Build Artifacts Testbox workflow");
|
|
});
|
|
|
|
it("keeps active or terminal non-successful artifact Testboxes blocking", () => {
|
|
const ciFallback = {
|
|
...successfulRun(`CI release gate ${sha}`, 1, "2026-06-17T10:49:00Z"),
|
|
event: "workflow_dispatch",
|
|
display_title: `CI release gate ${sha}`,
|
|
};
|
|
|
|
for (const artifactRun of [
|
|
{
|
|
...successfulRun(BUILD_ARTIFACTS_WORKFLOW, 2, "2026-06-17T10:50:00Z"),
|
|
status: "in_progress",
|
|
conclusion: null,
|
|
},
|
|
{
|
|
...successfulRun(BUILD_ARTIFACTS_WORKFLOW, 3, "2026-06-17T10:51:00Z"),
|
|
conclusion: "failure",
|
|
},
|
|
]) {
|
|
expect(() =>
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [ciFallback, artifactRun],
|
|
}),
|
|
).toThrow("Missing successful exact-head Blacksmith Build Artifacts Testbox workflow");
|
|
}
|
|
|
|
expect(() =>
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
ciFallback,
|
|
{
|
|
...successfulRun(BUILD_ARTIFACTS_WORKFLOW, 4, "2026-06-17T10:52:00Z"),
|
|
conclusion: "failure",
|
|
},
|
|
{
|
|
...successfulRun(BUILD_ARTIFACTS_WORKFLOW, 5, "2026-06-17T10:53:00Z"),
|
|
status: "queued",
|
|
conclusion: null,
|
|
},
|
|
],
|
|
}),
|
|
).toThrow("Missing successful exact-head Blacksmith Build Artifacts Testbox workflow");
|
|
});
|
|
|
|
it("rejects an unmarked manual CI run", () => {
|
|
expect(() =>
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 1, "2026-06-17T10:47:00Z"),
|
|
event: "workflow_dispatch",
|
|
display_title: "CI",
|
|
},
|
|
],
|
|
}),
|
|
).toThrow("Missing successful exact-head CI workflow");
|
|
});
|
|
|
|
it("rejects a manual release-gate title from another workflow", () => {
|
|
expect(() =>
|
|
collectHostedGateEvidence({
|
|
sha,
|
|
workflowRuns: [
|
|
{
|
|
...successfulRun(`CI release gate ${sha}`, 1, "2026-06-17T10:47:00Z"),
|
|
event: "workflow_dispatch",
|
|
path: ".github/workflows/something-else.yml",
|
|
display_title: `CI release gate ${sha}`,
|
|
},
|
|
],
|
|
}),
|
|
).toThrow("Missing successful exact-head CI workflow");
|
|
});
|
|
|
|
it("requires CI for docs unless the head changes only CHANGELOG.md", () => {
|
|
expect(() => collectHostedGateEvidence({ sha, workflowRuns: [] })).toThrow(
|
|
"Missing successful exact-head CI workflow",
|
|
);
|
|
expect(collectHostedGateEvidence({ sha, workflowRuns: [], changelogOnly: true })).toEqual({
|
|
headSha: sha,
|
|
workflows: [],
|
|
});
|
|
});
|
|
|
|
it("parses required CLI arguments", () => {
|
|
expect(
|
|
parseArgs([
|
|
"--repo",
|
|
"openclaw/openclaw",
|
|
"--sha",
|
|
sha,
|
|
"--output",
|
|
".local/gates-hosted-checks.json",
|
|
]),
|
|
).toEqual({
|
|
repo: "openclaw/openclaw",
|
|
sha,
|
|
output: ".local/gates-hosted-checks.json",
|
|
changelogOnly: false,
|
|
});
|
|
expect(() => parseArgs(["--repo", "openclaw/openclaw"])).toThrow("Usage:");
|
|
expect(() =>
|
|
parseArgs(["--repo", "-h", "--sha", sha, "--output", ".local/gates-hosted-checks.json"]),
|
|
).toThrow("Expected --repo <value>.");
|
|
expect(() =>
|
|
parseArgs([
|
|
"--repo",
|
|
"openclaw/openclaw",
|
|
"--sha",
|
|
"-h",
|
|
"--output",
|
|
".local/gates-hosted-checks.json",
|
|
]),
|
|
).toThrow("Expected --sha <value>.");
|
|
expect(() =>
|
|
parseArgs(["--repo", "openclaw/openclaw", "--sha", sha, "--output", "-h"]),
|
|
).toThrow("Expected --output <value>.");
|
|
});
|
|
|
|
it("rejects duplicate hosted gate verifier CLI arguments", () => {
|
|
const requiredArgs = [
|
|
"--repo",
|
|
"openclaw/openclaw",
|
|
"--sha",
|
|
sha,
|
|
"--output",
|
|
".local/gates-hosted-checks.json",
|
|
];
|
|
const duplicateCases = [
|
|
[
|
|
"--repo",
|
|
["--repo", "openclaw/openclaw", "--repo", "fork/openclaw", "--sha", sha, "--output", "out.json"],
|
|
],
|
|
[
|
|
"--sha",
|
|
["--repo", "openclaw/openclaw", "--sha", sha, "--sha", "other-sha", "--output", "out.json"],
|
|
],
|
|
[
|
|
"--output",
|
|
["--repo", "openclaw/openclaw", "--sha", sha, "--output", "one.json", "--output", "two.json"],
|
|
],
|
|
["--changelog-only", [...requiredArgs, "--changelog-only", "--changelog-only"]],
|
|
] satisfies Array<[string, string[]]>;
|
|
|
|
for (const [flag, args] of duplicateCases) {
|
|
expect(() => parseArgs(args), flag).toThrow(`${flag} was provided more than once.`);
|
|
}
|
|
});
|
|
|
|
it("accepts JSON emitted through a colorizing GitHub CLI shim", () => {
|
|
expect(
|
|
parseWorkflowRunPages('\u001B[1;37m[{"workflow_runs":[{"id":1,"name":"CI"}]}]\u001B[0m'),
|
|
).toEqual([{ id: 1, name: "CI" }]);
|
|
});
|
|
});
|