Skip to content

Commit c957819

Browse files
committed
fix(package): restore root tarball budget
Exclude maintainer-only docs, shrink the Crabbox worker wallpaper, and keep installed dependency scans compatible with canonical self-contained worker bundles without changing release budgets.
1 parent a3ca846 commit c957819

6 files changed

Lines changed: 63 additions & 21 deletions

File tree

-569 KB
Loading

‎extensions/crabbox/src/crabbox-worker-provider.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,10 +333,10 @@ describe("Crabbox worker provider", () => {
333333
name: "wrong PNG dimensions",
334334
bytes: (() => {
335335
const bytes = fs.readFileSync(WORKER_WALLPAPER_PATH);
336-
bytes.writeUInt32BE(1919, 16);
336+
bytes.writeUInt32BE(1023, 16);
337337
return bytes;
338338
})(),
339-
message: "Crabbox worker wallpaper must be 1920x1080; got 1919x1080",
339+
message: "Crabbox worker wallpaper must be 1024x576; got 1023x576",
340340
},
341341
])("rejects $name during provider registration", ({ bytes, message }) => {
342342
const tempDir = tempDirs.make("openclaw-crabbox-wallpaper-");

‎extensions/crabbox/src/crabbox-worker-wallpaper.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import fs from "node:fs";
22

3-
const WORKER_WALLPAPER_WIDTH = 1920;
4-
const WORKER_WALLPAPER_HEIGHT = 1080;
3+
const WORKER_WALLPAPER_WIDTH = 1024;
4+
const WORKER_WALLPAPER_HEIGHT = 576;
55
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
66

77
export function loadCrabboxWorkerWallpaperBase64(wallpaperPath: string): string {

‎package.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,14 @@
359359
"!dist/qa-runtime-*.js",
360360
"docs/",
361361
"!docs/.generated/**",
362+
"!docs/.i18n/**",
363+
"!docs/ci.md",
362364
"!docs/channels/qa-channel.md",
363365
"!docs/assets/**",
364366
"!docs/images/**",
367+
"!docs/maturity/taxonomy.md",
368+
"!docs/refactor/**",
369+
"!docs/releases/**",
365370
"!docs/**/*.jpg",
366371
"!docs/**/*.png",
367372
"src/agents/templates/",

‎scripts/openclaw-npm-postpublish-verify.ts‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ import { pathToFileURL } from "node:url";
1919
import { expectDefined } from "../packages/normalization-core/src/expect.js";
2020
import { ALWAYS_ALLOWED_RUNTIME_DIR_NAMES } from "../src/plugin-sdk/facade-activation-contract.ts";
2121
import { BUNDLED_RUNTIME_SIDECAR_PATHS } from "../src/plugins/runtime-sidecar-paths.ts";
22+
import {
23+
WORKER_BUNDLE_ENTRY_PATH,
24+
WORKER_BUNDLE_RSYNC_RECEIVER_PATH,
25+
} from "../src/shared/worker-bundle-hash.js";
2226
import { readBoundedResponseText } from "./lib/bounded-response.mjs";
2327
import { listBundledPluginPackArtifacts } from "./lib/bundled-plugin-build-entries.mjs";
2428
import { formatErrorMessage } from "./lib/error-format.mts";
@@ -68,6 +72,12 @@ const MAX_INSTALLED_ROOT_DIST_JS_BYTES = 6 * 1024 * 1024;
6872
// Keep the dependency scan bounded while allowing headroom for generated root chunks.
6973
const MAX_INSTALLED_ROOT_DIST_JS_FILES = 10_000;
7074
const ROOT_DIST_JAVASCRIPT_MODULE_FILE_RE = /\.(?:c|m)?js$/u;
75+
// These artifacts bundle their full runtime closure and have a dedicated layout/import guard.
76+
// Keep the generic parser bound on every other installed dist file.
77+
const SELF_CONTAINED_WORKER_DEPLOY_DIST_PATHS = new Set([
78+
`worker/${WORKER_BUNDLE_ENTRY_PATH}`,
79+
`worker/${WORKER_BUNDLE_RSYNC_RECEIVER_PATH}`,
80+
]);
7181
const OPTIONAL_OR_EXTERNALIZED_RUNTIME_IMPORTS = new Set([
7282
// Optional A2UI markdown renderer. The Canvas host bundle catches the missing
7383
// package and falls back when the optional renderer is unavailable.
@@ -748,14 +758,17 @@ export function collectInstalledRootDependencyManifestErrors(packageRoot: string
748758

749759
for (const filePath of distFiles.files) {
750760
const fileStat = lstatSync(filePath);
751-
if (!fileStat.isFile() || fileStat.size > MAX_INSTALLED_ROOT_DIST_JS_BYTES) {
752-
const relativePath = relative(join(packageRoot, "dist"), filePath).replaceAll("\\", "/");
761+
const relativePath = relative(join(packageRoot, "dist"), filePath).replaceAll("\\", "/");
762+
if (
763+
!fileStat.isFile() ||
764+
(fileStat.size > MAX_INSTALLED_ROOT_DIST_JS_BYTES &&
765+
!SELF_CONTAINED_WORKER_DEPLOY_DIST_PATHS.has(relativePath))
766+
) {
753767
return [
754768
`installed package root dist file '${relativePath}' is invalid or exceeds ${MAX_INSTALLED_ROOT_DIST_JS_BYTES} bytes.`,
755769
];
756770
}
757771
const source = readFileSync(filePath, "utf8");
758-
const relativePath = relative(join(packageRoot, "dist"), filePath).replaceAll("\\", "/");
759772
const parsedSpecifiers = extractJavaScriptImportSpecifiers(source);
760773
if (!parsedSpecifiers.ok) {
761774
return [

‎test/openclaw-npm-postpublish-verify.test.ts‎

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ import {
2525
verifyNpmProvenanceAttestation,
2626
verifyNpmRegistrySignatures,
2727
} from "../scripts/openclaw-npm-postpublish-verify.ts";
28+
import {
29+
WORKER_BUNDLE_ENTRY_PATH,
30+
WORKER_BUNDLE_RSYNC_RECEIVER_PATH,
31+
} from "../src/shared/worker-bundle-hash.js";
2832
import { withEnv } from "../src/test-utils/env.js";
2933

3034
const INSTALLED_ROOT_DIST_JS_FILE_SCAN_LIMIT = 10_000;
@@ -1059,17 +1063,17 @@ describe("collectInstalledRootDependencyManifestErrors", () => {
10591063
}
10601064
});
10611065

1062-
it("flags undeclared imports from mjs and cjs root dist files", () => {
1066+
it("flags undeclared imports from nested mjs and direct cjs root dist files", () => {
10631067
const packageRoot = makeInstalledPackageRoot();
10641068

10651069
try {
10661070
writePackageFile(packageRoot, "package.json", {
10671071
version: "2026.4.22",
10681072
dependencies: {},
10691073
});
1070-
mkdirSync(join(packageRoot, "dist"), { recursive: true });
1074+
mkdirSync(join(packageRoot, "dist", "runtime"), { recursive: true });
10711075
writeFileSync(
1072-
join(packageRoot, "dist", "esm-entry.mjs"),
1076+
join(packageRoot, "dist", "runtime", "esm-entry.mjs"),
10731077
'export { value } from "mjs-only";\n',
10741078
"utf8",
10751079
);
@@ -1081,7 +1085,7 @@ describe("collectInstalledRootDependencyManifestErrors", () => {
10811085

10821086
expect(collectInstalledRootDependencyManifestErrors(packageRoot)).toEqual([
10831087
"installed package root is missing declared runtime dependency 'cjs-only' for dist importers: cjs-entry.cjs. Add it to package.json dependencies/optionalDependencies.",
1084-
"installed package root is missing declared runtime dependency 'mjs-only' for dist importers: esm-entry.mjs. Add it to package.json dependencies/optionalDependencies.",
1088+
"installed package root is missing declared runtime dependency 'mjs-only' for dist importers: runtime/esm-entry.mjs. Add it to package.json dependencies/optionalDependencies.",
10851089
]);
10861090
} finally {
10871091
rmSync(packageRoot, { recursive: true, force: true });
@@ -1155,24 +1159,44 @@ describe("collectInstalledRootDependencyManifestErrors", () => {
11551159
}
11561160
});
11571161

1158-
it("refuses oversized root dist files", () => {
1162+
it.each([
1163+
{
1164+
expected: [
1165+
"installed package root dist file 'oversized.js' is invalid or exceeds 6291456 bytes.",
1166+
],
1167+
name: "rejects oversized direct dist files",
1168+
relativePath: "oversized.js",
1169+
},
1170+
{
1171+
expected: [
1172+
"installed package root dist file 'runtime/oversized.js' is invalid or exceeds 6291456 bytes.",
1173+
],
1174+
name: "rejects oversized arbitrary nested dist files",
1175+
relativePath: "runtime/oversized.js",
1176+
},
1177+
{
1178+
expected: [],
1179+
name: "accepts the oversized worker deploy entrypoint",
1180+
relativePath: `worker/${WORKER_BUNDLE_ENTRY_PATH}`,
1181+
},
1182+
{
1183+
expected: [],
1184+
name: "accepts the oversized worker rsync receiver",
1185+
relativePath: `worker/${WORKER_BUNDLE_RSYNC_RECEIVER_PATH}`,
1186+
},
1187+
])("$name", ({ expected, relativePath }) => {
11591188
const packageRoot = makeInstalledPackageRoot();
11601189

11611190
try {
11621191
writePackageFile(packageRoot, "package.json", {
11631192
version: "2026.4.22",
11641193
dependencies: {},
11651194
});
1166-
mkdirSync(join(packageRoot, "dist"), { recursive: true });
1167-
writeFileSync(
1168-
join(packageRoot, "dist", "oversized.js"),
1169-
"x".repeat(6 * 1024 * 1024 + 1),
1170-
"utf8",
1171-
);
1195+
const filePath = join(packageRoot, "dist", relativePath);
1196+
mkdirSync(dirname(filePath), { recursive: true });
1197+
writeFileSync(filePath, `/* ${"x".repeat(6 * 1024 * 1024)} */\n`, "utf8");
11721198

1173-
expect(collectInstalledRootDependencyManifestErrors(packageRoot)).toEqual([
1174-
"installed package root dist file 'oversized.js' is invalid or exceeds 6291456 bytes.",
1175-
]);
1199+
expect(collectInstalledRootDependencyManifestErrors(packageRoot)).toEqual(expected);
11761200
} finally {
11771201
rmSync(packageRoot, { recursive: true, force: true });
11781202
}

0 commit comments

Comments
 (0)