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
192 lines
6.4 KiB
JavaScript
192 lines
6.4 KiB
JavaScript
import { createHash } from "node:crypto";
|
|
import { escapeRegExp } from "./regexp.mjs";
|
|
|
|
const STABLE_RELEASE_TAG_RE = /^v(?<version>\d{4}\.\d{1,2}\.\d{1,2})(?:-[1-9]\d*)?$/u;
|
|
const MAX_ROLLBACK_DRILL_AGE_MS = 90 * 24 * 60 * 60 * 1000;
|
|
|
|
function parseStableReleaseTagDetails(tag) {
|
|
const match = STABLE_RELEASE_TAG_RE.exec(tag);
|
|
if (!match?.groups?.version) {
|
|
throw new Error(`expected a stable release tag, got ${tag}`);
|
|
}
|
|
return {
|
|
baseVersion: match.groups.version,
|
|
tagVersion: tag.slice(1),
|
|
};
|
|
}
|
|
|
|
function sha256(value) {
|
|
return createHash("sha256").update(value).digest("hex");
|
|
}
|
|
|
|
export function parseStableReleaseTag(tag) {
|
|
return parseStableReleaseTagDetails(tag).baseVersion;
|
|
}
|
|
|
|
export function extractStableChangelogSection(changelog, version) {
|
|
const heading = new RegExp(`^## ${escapeRegExp(version)}\\n`, "mu").exec(changelog);
|
|
if (!heading || heading.index === undefined) {
|
|
return null;
|
|
}
|
|
|
|
const section = changelog.slice(heading.index);
|
|
const nextHeading = section.slice(heading[0].length).search(/^## /mu);
|
|
return (
|
|
nextHeading === -1 ? section : section.slice(0, heading[0].length + nextHeading)
|
|
).trimEnd();
|
|
}
|
|
|
|
function readVersion(packageJson, label, errors) {
|
|
const value = packageJson?.version;
|
|
if (typeof value !== "string" || value.length === 0) {
|
|
errors.push(`${label} package.json is missing a version.`);
|
|
return "";
|
|
}
|
|
return value;
|
|
}
|
|
|
|
function readReleaseAssets(release) {
|
|
return Array.isArray(release?.assets)
|
|
? release.assets.filter((asset) => asset && typeof asset.name === "string")
|
|
: [];
|
|
}
|
|
|
|
function isCloseoutEvidenceAsset(assetName, tag) {
|
|
const releaseVersion = tag.slice(1);
|
|
return (
|
|
assetName === `openclaw-${releaseVersion}-stable-main-closeout.json` ||
|
|
assetName === `openclaw-${releaseVersion}-stable-main-closeout.json.sha256`
|
|
);
|
|
}
|
|
|
|
function parseRollbackDrillDate(value) {
|
|
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}$/u.test(value)) {
|
|
return null;
|
|
}
|
|
|
|
const parsed = new Date(`${value}T00:00:00.000Z`);
|
|
return Number.isFinite(parsed.getTime()) && parsed.toISOString().slice(0, 10) === value
|
|
? parsed.getTime()
|
|
: null;
|
|
}
|
|
|
|
function verifyRollbackDrill(params, errors) {
|
|
if (!params.rollbackDrillId?.trim()) {
|
|
errors.push("rollback drill id is required.");
|
|
}
|
|
|
|
const drillDateMs = parseRollbackDrillDate(params.rollbackDrillDate);
|
|
if (drillDateMs === null) {
|
|
errors.push(`rollback drill date is invalid: ${params.rollbackDrillDate ?? "<missing>"}.`);
|
|
return;
|
|
}
|
|
|
|
const ageMs = params.nowMs - drillDateMs;
|
|
if (ageMs < 0) {
|
|
errors.push(`rollback drill date is in the future: ${params.rollbackDrillDate}.`);
|
|
} else if (!params.allowStaleRollbackDrill && ageMs > MAX_ROLLBACK_DRILL_AGE_MS) {
|
|
errors.push(
|
|
`rollback drill is older than 90 days: ${params.rollbackDrillDate}. Run the private rollback drill before stable closeout.`,
|
|
);
|
|
}
|
|
}
|
|
|
|
export function verifyStableMainCloseout(params) {
|
|
const { baseVersion, tagVersion } = parseStableReleaseTagDetails(params.tag);
|
|
const errors = [];
|
|
const mainVersion = readVersion(params.mainPackageJson, "main", errors);
|
|
const tagPackageVersion = readVersion(params.tagPackageJson, "release tag", errors);
|
|
const fallbackCorrection =
|
|
tagVersion !== baseVersion && mainVersion === baseVersion && tagPackageVersion === baseVersion;
|
|
const version = fallbackCorrection ? baseVersion : tagVersion;
|
|
|
|
if (mainVersion && mainVersion !== version) {
|
|
errors.push(
|
|
`main package.json version is ${mainVersion}, expected shipped version ${version}.`,
|
|
);
|
|
}
|
|
if (tagPackageVersion && tagPackageVersion !== version) {
|
|
errors.push(
|
|
`release tag package.json version is ${tagPackageVersion}, expected shipped version ${version}.`,
|
|
);
|
|
}
|
|
|
|
const mainChangelog = extractStableChangelogSection(params.mainChangelog, version);
|
|
const tagChangelog = extractStableChangelogSection(params.tagChangelog, version);
|
|
if (!mainChangelog) {
|
|
errors.push(`main CHANGELOG.md is missing the ## ${version} section.`);
|
|
}
|
|
if (!tagChangelog) {
|
|
errors.push(`release tag CHANGELOG.md is missing the ## ${version} section.`);
|
|
}
|
|
if (mainChangelog && tagChangelog && mainChangelog !== tagChangelog) {
|
|
errors.push(
|
|
`main CHANGELOG.md ## ${version} does not exactly match the shipped release section.`,
|
|
);
|
|
}
|
|
|
|
if (params.release?.tagName !== params.tag) {
|
|
errors.push(
|
|
`GitHub release tag is ${String(params.release?.tagName ?? "<missing>")}, expected ${params.tag}.`,
|
|
);
|
|
}
|
|
if (params.release?.isDraft === true) {
|
|
errors.push(`GitHub release ${params.tag} is still a draft.`);
|
|
}
|
|
if (params.release?.isPrerelease === true) {
|
|
errors.push(`GitHub release ${params.tag} is marked as a prerelease.`);
|
|
}
|
|
|
|
const macAssetVersion = version;
|
|
const expectedMacAssets = [
|
|
`OpenClaw-${macAssetVersion}.zip`,
|
|
`OpenClaw-${macAssetVersion}.dmg`,
|
|
`OpenClaw-${macAssetVersion}.dSYM.zip`,
|
|
];
|
|
const assetNames = new Set(readReleaseAssets(params.release).map((asset) => asset.name));
|
|
const missingMacAssets = expectedMacAssets.filter((asset) => !assetNames.has(asset));
|
|
if (missingMacAssets.length > 0) {
|
|
errors.push(
|
|
`GitHub release ${params.tag} is missing required macOS asset(s): ${missingMacAssets.join(", ")}.`,
|
|
);
|
|
} else {
|
|
const macZip = expectedMacAssets[0];
|
|
if (!params.mainAppcast.includes(`/releases/download/${params.tag}/${macZip}`)) {
|
|
errors.push(`main appcast.xml does not point at ${macZip} from ${params.tag}.`);
|
|
}
|
|
}
|
|
|
|
verifyRollbackDrill(params, errors);
|
|
|
|
if (errors.length > 0) {
|
|
return { errors, manifest: null };
|
|
}
|
|
|
|
return {
|
|
errors,
|
|
manifest: {
|
|
version: 1,
|
|
releaseTag: params.tag,
|
|
releaseVersion: version,
|
|
releaseTagSha: params.releaseTagSha,
|
|
mainSha: params.mainSha,
|
|
mainPackageVersion: mainVersion,
|
|
releaseTagPackageVersion: tagPackageVersion,
|
|
changelogSha256: sha256(mainChangelog),
|
|
appcastSha256: sha256(params.mainAppcast),
|
|
fullReleaseValidationRunId: params.fullReleaseValidationRunId,
|
|
releasePublishRunId: params.releasePublishRunId,
|
|
rollbackDrill: {
|
|
id: params.rollbackDrillId,
|
|
date: params.rollbackDrillDate,
|
|
},
|
|
githubReleaseAssets: readReleaseAssets(params.release)
|
|
.filter((asset) => !isCloseoutEvidenceAsset(asset.name, params.tag))
|
|
.map((asset) => ({
|
|
name: asset.name,
|
|
digest: typeof asset.digest === "string" ? asset.digest : null,
|
|
})),
|
|
},
|
|
};
|
|
}
|