openclaw/test/scripts/runtime-process-package.test.ts
RoboClaw 35848cd8af
fix: restore workspace workers in npm installs (#177130)
* fix: restore workspace workers in npm installs

Keep local memory and skills subprocess outputs outside the sealed portable worker directory. Runtime launchers and build entries continue to share the manifest, while npm preserves the portable archive-only contract.

Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>

* fix: restore workspace workers in npm installs

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
OpenClaw-Publication: 837639f8-021c-49ac-8d2a-8636b8aeec13

* test(update): inject writes during final generation verification

After #177082 made the initial generation read provisional, the old fault corrupted the source before private snapshot acquisition. Wait for the private image to close, then perform a real SQLite commit between the final generation reads. Preserve all diagnostic assertions and verify the committed version.

Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>

* Publish openclaw/release-packaged-workspace-workers-20261019

Worked on by:
- @vincentkoc

Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
OpenClaw-Publication: 1a214a82-7a55-4e45-a884-c50f2d10bbe3

---------

Co-authored-by: vincentkoc <25068+vincentkoc@users.noreply.github.com>
2026-10-19 17:10:28 +08:00

40 lines
1.9 KiB
TypeScript

import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import path from "node:path";
import { afterEach, expect, it } from "vitest";
import { collectNpmPackInventory } from "../../scripts/lib/npm-pack-inventory.mts";
import { runtimeProcessCoreEntrypoints } from "../../scripts/lib/runtime-process-core-build-entries.mts";
import { WORKER_BUNDLE_ARTIFACT_PATHS } from "../../src/shared/worker-bundle-hash.js";
import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js";
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
it("packs every core runtime process without exposing the portable worker graph", () => {
const root = tempDirs.make("runtime-process-package-");
const { files } = JSON.parse(
readFileSync(new URL("../../package.json", import.meta.url), "utf8"),
) as { files: string[] };
const runtimePaths = runtimeProcessCoreEntrypoints.map((entry) => `dist/${entry.distWorkerPath}`);
const archivePath = `dist/worker-artifacts/${"a".repeat(64)}.tar.gz`;
// Only the file-selection boundary is under test; no build or lifecycle scripts run.
const fixturePaths = [
...runtimePaths,
...WORKER_BUNDLE_ARTIFACT_PATHS.map((entry) => `dist/worker/${entry}`),
"dist/worker/worker-chunk-fixture.mjs",
archivePath,
];
for (const file of fixturePaths) {
const target = path.join(root, file);
mkdirSync(path.dirname(target), { recursive: true });
writeFileSync(target, "export {};\n");
}
writeFileSync(
path.join(root, "package.json"),
JSON.stringify({ name: "runtime-process-package-fixture", version: "1.0.0", files }),
);
const inventory = collectNpmPackInventory(root, { timeoutMs: 10_000 });
const packed = new Set(inventory.files);
expect(runtimePaths.filter((file) => !packed.has(file))).toEqual([]);
expect(packed.has(archivePath)).toBe(true);
expect(inventory.files.filter((file) => file.startsWith("dist/worker/"))).toEqual([]);
});