openclaw/scripts/lib/docker-e2e-json-artifacts.mts
Peter Steinberger b04bf1bb69
refactor(scripts): consolidate repeated helper flows (#168331)
Consolidate repeated CI planning, packaging, release validation, parsing, readiness, and smoke-check mechanics behind their existing owners and explicit per-variant parameters. Remove one test-only collection projection and assert the same membership, exclusions, and order at the collection owner.

Preserve features, CLI flags, configuration, protocol and persisted shapes, output text, test selection, and timing policies. Remove 862 net production lines across 43 modules after auditing all 378 eligible scripts-library modules; the PR contains the full coverage log and exclusion evidence.

Validation: independent review through P2, focused conflict tests, script types/lint, zero runtime/Madge cycles, the full 21-plan scripts Testbox run with its recorded inherited failure, and successful exact-head hosted CI. No assertions, baselines, budgets, or lint suppressions were weakened. See #168331 for exact-head proof and local failure attribution.
2026-10-10 01:33:18 -07:00

13 lines
584 B
TypeScript

import { readBoundedArtifactText } from "./bounded-artifact-text.mts";
import { parsePositiveInt } from "./numeric-options.mjs";
const JSON_ARTIFACT_MAX_BYTES_ENV = "OPENCLAW_DOCKER_E2E_JSON_ARTIFACT_MAX_BYTES";
const DEFAULT_JSON_ARTIFACT_MAX_BYTES = 16 * 1024 * 1024;
export function readDockerE2eJsonArtifact(file: string): unknown {
const maxBytes = parsePositiveInt(
process.env[JSON_ARTIFACT_MAX_BYTES_ENV] || String(DEFAULT_JSON_ARTIFACT_MAX_BYTES),
JSON_ARTIFACT_MAX_BYTES_ENV,
);
return JSON.parse(readBoundedArtifactText(file, maxBytes, "JSON artifact"));
}