Files
adolf/scripts/docker-e2e-timings.mjs
alvis bedb527145
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
Vendor OpenClaw source as Adolf fork baseline
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
2026-07-05 09:36:54 +00:00

158 lines
5.2 KiB
JavaScript

#!/usr/bin/env node
// Summarizes Docker E2E timing artifacts.
// Accepts scheduler summary.json or lane-timings.json so agents can see the
// slowest lanes and phase critical path before deciding what to rerun.
import { readDockerE2eJsonArtifact } from "./lib/docker-e2e-json-artifacts.mjs";
import { parsePositiveInt } from "./lib/numeric-options.mjs";
function usage() {
return "Usage: node scripts/docker-e2e-timings.mjs <summary.json|lane-timings.json> [--limit N]";
}
function parseArgs(argv) {
const options = { file: "", help: false, limit: 12 };
const readLimit = (raw) => {
if (!raw || raw.startsWith("-")) {
throw new Error("--limit requires a value");
}
return parsePositiveInt(raw, "--limit");
};
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === "--help" || arg === "-h") {
options.help = true;
} else if (arg === "--limit") {
options.limit = readLimit(argv[(index += 1)]);
} else if (arg?.startsWith("--limit=")) {
options.limit = readLimit(arg.slice("--limit=".length));
} else if (arg?.startsWith("-")) {
throw new Error(`unknown argument: ${arg}\n${usage()}`);
} else if (!options.file) {
options.file = arg;
} else {
throw new Error(`unknown argument: ${arg}\n${usage()}`);
}
}
if (options.help) {
return options;
}
if (!options.file) {
throw new Error(usage());
}
return options;
}
function readJson(file) {
return readDockerE2eJsonArtifact(file);
}
function seconds(value) {
return typeof value === "number" && Number.isFinite(value) ? value : 0;
}
function durationBetween(startedAt, finishedAt) {
if (!startedAt || !finishedAt) {
return 0;
}
const started = Date.parse(startedAt);
const finished = Date.parse(finishedAt);
if (!Number.isFinite(started) || !Number.isFinite(finished) || finished < started) {
return 0;
}
return Math.round((finished - started) / 1000);
}
function summarizeSummary(summary, limit) {
const lanes = (Array.isArray(summary.lanes) ? summary.lanes : [])
.map((lane) => ({
imageKind: lane.imageKind ?? "",
name: lane.name,
seconds: seconds(lane.elapsedSeconds),
status: lane.status === 0 ? "pass" : `fail ${lane.status}`,
timedOut: lane.timedOut === true,
}))
.filter((lane) => lane.name)
.toSorted((left, right) => right.seconds - left.seconds || left.name.localeCompare(right.name));
const phases = (Array.isArray(summary.phases) ? summary.phases : [])
.map((phase) => ({
name: phase.name,
seconds: seconds(phase.elapsedSeconds),
status: phase.status ?? "",
}))
.filter((phase) => phase.name);
const wallSeconds = durationBetween(summary.startedAt, summary.finishedAt);
const totalLaneSeconds = lanes.reduce((total, lane) => total + lane.seconds, 0);
const criticalPathSeconds =
phases.reduce((total, phase) => total + phase.seconds, 0) ||
wallSeconds ||
lanes[0]?.seconds ||
0;
console.log(`Status: ${summary.status ?? "unknown"}`);
if (wallSeconds > 0) {
console.log(`Wall seconds: ${wallSeconds}`);
}
console.log(`Lane seconds total: ${totalLaneSeconds}`);
console.log(`Approx critical path seconds: ${criticalPathSeconds}`);
if (wallSeconds > 0 && totalLaneSeconds > 0) {
console.log(`Approx parallelism: ${(totalLaneSeconds / wallSeconds).toFixed(1)}x`);
}
if (phases.length > 0) {
console.log("");
console.log("Phases:");
for (const phase of phases.toSorted((left, right) => right.seconds - left.seconds)) {
console.log(`- ${phase.name}: ${phase.seconds}s ${phase.status}`);
}
}
console.log("");
console.log(`Slowest lanes (top ${Math.min(limit, lanes.length)}):`);
for (const lane of lanes.slice(0, limit)) {
console.log(
`- ${lane.name}: ${lane.seconds}s ${lane.status}${lane.timedOut ? " timeout" : ""}${
lane.imageKind ? ` image=${lane.imageKind}` : ""
}`,
);
}
}
function summarizeTimingStore(store, limit) {
const lanes = Object.entries(store.lanes ?? {})
.map(([name, lane]) => ({
name,
seconds: seconds(lane.durationSeconds),
status: lane.status === 0 ? "pass" : `fail ${lane.status}`,
updatedAt: lane.updatedAt ?? "",
}))
.toSorted((left, right) => right.seconds - left.seconds || left.name.localeCompare(right.name));
console.log(`Updated: ${store.updatedAt ?? "unknown"}`);
console.log(`Known lanes: ${lanes.length}`);
console.log("");
console.log(`Slowest lanes (top ${Math.min(limit, lanes.length)}):`);
for (const lane of lanes.slice(0, limit)) {
console.log(`- ${lane.name}: ${lane.seconds}s ${lane.status} ${lane.updatedAt}`.trim());
}
}
function main() {
const options = parseArgs(process.argv.slice(2));
if (options.help) {
console.log(usage());
return;
}
const payload = readJson(options.file);
if (Array.isArray(payload.lanes)) {
summarizeSummary(payload, options.limit);
} else if (payload.lanes && typeof payload.lanes === "object") {
summarizeTimingStore(payload, options.limit);
} else {
throw new Error(`Unsupported Docker E2E timing artifact: ${options.file}`);
}
}
try {
main();
} catch (error) {
console.error(error instanceof Error ? error.message : String(error));
process.exit(1);
}