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
251 lines
7.1 KiB
TypeScript
251 lines
7.1 KiB
TypeScript
// Release Beta Verifier tests cover release beta verifier script behavior.
|
|
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import {
|
|
fetchStatusWithRetry,
|
|
parseNpmViewFields,
|
|
parseReleaseVerifyBetaArgs,
|
|
readBoundedJsonResponse,
|
|
runNpmViewWithRetry,
|
|
} from "../../scripts/lib/release-beta-verifier.ts";
|
|
|
|
afterEach(() => {
|
|
vi.unstubAllGlobals();
|
|
vi.useRealTimers();
|
|
});
|
|
|
|
describe("parseReleaseVerifyBetaArgs", () => {
|
|
it("defaults beta verification to the matching tag and repo", () => {
|
|
expect(parseReleaseVerifyBetaArgs(["2026.5.10-beta.3"])).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
tag: "v2026.5.10-beta.3",
|
|
distTag: "beta",
|
|
repo: "openclaw/openclaw",
|
|
registry: "https://clawhub.ai",
|
|
workflowRef: undefined,
|
|
clawHubWorkflowRef: undefined,
|
|
pluginSelection: [],
|
|
evidenceOut: undefined,
|
|
skipPostpublish: false,
|
|
skipGitHubRelease: false,
|
|
skipClawHub: false,
|
|
rerunFailedClawHub: false,
|
|
workflowRuns: {},
|
|
});
|
|
});
|
|
|
|
it("parses child run IDs and repair flags", () => {
|
|
expect(
|
|
parseReleaseVerifyBetaArgs([
|
|
"--",
|
|
"2026.5.10-beta.3",
|
|
"--workflow-ref",
|
|
"release/2026.5.10",
|
|
"--clawhub-workflow-ref",
|
|
"v2026.5.10-beta.3",
|
|
"--plugins",
|
|
"@openclaw/plugin-a,@openclaw/plugin-b",
|
|
"--full-release-validation-run",
|
|
"10",
|
|
"--openclaw-npm-run",
|
|
"11",
|
|
"--plugin-npm-run",
|
|
"22",
|
|
"--plugin-clawhub-run",
|
|
"33",
|
|
"--plugin-clawhub-bootstrap-run",
|
|
"34",
|
|
"--npm-telegram-run",
|
|
"44",
|
|
"--evidence-out",
|
|
".artifacts/release-evidence.json",
|
|
"--skip-postpublish",
|
|
"--skip-github-release",
|
|
"--skip-clawhub",
|
|
"--rerun-failed-clawhub",
|
|
]),
|
|
).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
tag: "v2026.5.10-beta.3",
|
|
distTag: "beta",
|
|
repo: "openclaw/openclaw",
|
|
registry: "https://clawhub.ai",
|
|
workflowRef: "release/2026.5.10",
|
|
clawHubWorkflowRef: "v2026.5.10-beta.3",
|
|
pluginSelection: ["@openclaw/plugin-a", "@openclaw/plugin-b"],
|
|
evidenceOut: ".artifacts/release-evidence.json",
|
|
skipPostpublish: true,
|
|
skipGitHubRelease: true,
|
|
skipClawHub: true,
|
|
rerunFailedClawHub: true,
|
|
workflowRuns: {
|
|
fullReleaseValidation: "10",
|
|
openclawNpm: "11",
|
|
pluginNpm: "22",
|
|
pluginClawHub: "33",
|
|
pluginClawHubBootstrap: "34",
|
|
npmTelegram: "44",
|
|
},
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("parseNpmViewFields", () => {
|
|
it("accepts keyed npm view JSON", () => {
|
|
expect(
|
|
parseNpmViewFields(
|
|
JSON.stringify({
|
|
version: "2026.5.10-beta.3",
|
|
"dist-tags.beta": "2026.5.10-beta.3",
|
|
"dist.integrity": "sha512-test",
|
|
"dist.tarball": "https://registry.example/openclaw.tgz",
|
|
}),
|
|
"beta",
|
|
),
|
|
).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
distTagVersion: "2026.5.10-beta.3",
|
|
integrity: "sha512-test",
|
|
tarball: "https://registry.example/openclaw.tgz",
|
|
});
|
|
});
|
|
|
|
it("accepts nested npm view JSON", () => {
|
|
expect(
|
|
parseNpmViewFields(
|
|
JSON.stringify({
|
|
version: "2026.5.10-beta.3",
|
|
"dist-tags": { beta: "2026.5.10-beta.3" },
|
|
dist: {
|
|
integrity: "sha512-test",
|
|
tarball: "https://registry.example/openclaw.tgz",
|
|
},
|
|
}),
|
|
"beta",
|
|
),
|
|
).toEqual({
|
|
version: "2026.5.10-beta.3",
|
|
distTagVersion: "2026.5.10-beta.3",
|
|
integrity: "sha512-test",
|
|
tarball: "https://registry.example/openclaw.tgz",
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("runNpmViewWithRetry", () => {
|
|
it("retries transient registry failures with online metadata reads", async () => {
|
|
const calls: string[][] = [];
|
|
const delays: number[] = [];
|
|
|
|
await expect(
|
|
runNpmViewWithRetry(["view", "openclaw@2026.5.10-beta.3", "version", "--json"], {
|
|
attempts: 3,
|
|
delay: async (delayMs) => {
|
|
delays.push(delayMs);
|
|
},
|
|
run: (args) => {
|
|
calls.push(args);
|
|
if (calls.length < 3) {
|
|
throw new Error("npm registry has not propagated the release yet");
|
|
}
|
|
return '"2026.5.10-beta.3"';
|
|
},
|
|
}),
|
|
).resolves.toBe('"2026.5.10-beta.3"');
|
|
|
|
expect(calls).toHaveLength(3);
|
|
expect(calls.every((args) => args.at(-1) === "--prefer-online")).toBe(true);
|
|
expect(delays).toEqual([1000, 2000]);
|
|
});
|
|
});
|
|
|
|
describe("fetchStatusWithRetry", () => {
|
|
it("cancels retryable and returned GET response bodies", async () => {
|
|
vi.useFakeTimers();
|
|
const canceled: string[] = [];
|
|
const responses = [
|
|
new Response(
|
|
new ReadableStream<Uint8Array>({
|
|
cancel() {
|
|
canceled.push("retry");
|
|
},
|
|
}),
|
|
{ status: 500 },
|
|
),
|
|
new Response(
|
|
new ReadableStream<Uint8Array>({
|
|
cancel() {
|
|
canceled.push("final");
|
|
},
|
|
}),
|
|
{ status: 200 },
|
|
),
|
|
];
|
|
const fetchImpl = vi.fn(async () => {
|
|
const response = responses.shift();
|
|
if (!response) {
|
|
throw new Error("unexpected fetch call");
|
|
}
|
|
return response;
|
|
});
|
|
vi.stubGlobal("fetch", fetchImpl);
|
|
|
|
const status = fetchStatusWithRetry("https://clawhub.test/api/v1/package", "GET");
|
|
await vi.advanceTimersByTimeAsync(1000);
|
|
|
|
await expect(status).resolves.toBe(200);
|
|
expect(canceled).toEqual(["retry", "final"]);
|
|
expect(fetchImpl).toHaveBeenCalledTimes(2);
|
|
});
|
|
});
|
|
|
|
describe("readBoundedJsonResponse", () => {
|
|
it("parses JSON bodies within the release verifier limit", async () => {
|
|
await expect(
|
|
readBoundedJsonResponse(new Response('{"ok":true}'), "ClawHub package", 64),
|
|
).resolves.toEqual({ ok: true });
|
|
});
|
|
|
|
it("rejects oversized JSON bodies by content length", async () => {
|
|
await expect(
|
|
readBoundedJsonResponse(
|
|
new Response("{}", { headers: { "content-length": "65" } }),
|
|
"ClawHub package",
|
|
64,
|
|
),
|
|
).rejects.toThrow("ClawHub package response body exceeded 64 bytes.");
|
|
});
|
|
|
|
it("rejects oversized streamed JSON bodies", async () => {
|
|
await expect(
|
|
readBoundedJsonResponse(new Response('{"padding":"too-large"}'), "ClawHub package", 8),
|
|
).rejects.toThrow("ClawHub package response body exceeded 8 bytes.");
|
|
});
|
|
|
|
it("keeps ClawHub request timeouts active while reading JSON bodies", async () => {
|
|
let canceled = false;
|
|
const abortController = new AbortController();
|
|
const response = new Response(
|
|
new ReadableStream<Uint8Array>({
|
|
start(controller) {
|
|
controller.enqueue(new TextEncoder().encode('{"partial":'));
|
|
},
|
|
cancel() {
|
|
canceled = true;
|
|
},
|
|
}),
|
|
);
|
|
|
|
const json = readBoundedJsonResponse(response, "ClawHub package", 64, {
|
|
signal: abortController.signal,
|
|
});
|
|
|
|
await new Promise((resolveDelay) => {
|
|
setTimeout(resolveDelay, 0);
|
|
});
|
|
abortController.abort(new Error("ClawHub body timed out"));
|
|
|
|
await expect(json).rejects.toThrow("ClawHub body timed out");
|
|
expect(canceled).toBe(true);
|
|
});
|
|
});
|