refactor: delete dead infra and config exports (#106019)

* refactor: delete dead infra and config exports

* refactor: preserve live infra and config contracts

* refactor(config): remove obsolete file-store lifecycle APIs

* refactor(infra): finish current-main dead export cleanup
This commit is contained in:
Peter Steinberger
2026-07-13 12:00:47 -07:00
committed by GitHub
parent 8dd57279cd
commit d1684f48a3
444 changed files with 3161 additions and 14814 deletions
+46
View File
@@ -1,6 +1,9 @@
// Daemon program argument tests cover CLI argument construction for services.
import path from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import { withMockedWindowsPlatform } from "../test-utils/vitest-spies.js";
const execFileSyncMock = vi.hoisted(() => vi.fn());
const fsMocks = vi.hoisted(() => ({
access: vi.fn(),
@@ -24,12 +27,19 @@ vi.mock("node:fs/promises", async () => {
};
});
vi.mock("node:child_process", async () => {
const actual = await vi.importActual<typeof import("node:child_process")>("node:child_process");
return { ...actual, execFileSync: execFileSyncMock };
});
import { resolveGatewayProgramArguments, resolveNodeProgramArguments } from "./program-args.js";
const originalArgv = [...process.argv];
const originalExecPath = process.execPath;
afterEach(() => {
process.argv = [...originalArgv];
process.execPath = originalExecPath;
vi.resetAllMocks();
vi.unstubAllEnvs();
});
@@ -170,6 +180,42 @@ describe("resolveGatewayProgramArguments", () => {
expect(result.workingDirectory).toBe(path.resolve("/repo"));
});
it("uses trusted Windows where.exe when resolving the Node runtime", async () => {
const repoIndexPath = path.resolve("/repo/src/index.ts");
const repoEntryPath = path.resolve("/repo/src/entry.ts");
const launcherPath = String.raw`D:\OpenClaw\openclaw.exe`;
process.argv = [launcherPath, repoIndexPath];
process.execPath = launcherPath;
vi.stubEnv("SystemRoot", String.raw`D:\Windows`);
fsMocks.realpath.mockResolvedValue(repoIndexPath);
fsMocks.access.mockResolvedValue(undefined);
execFileSyncMock.mockReturnValue(String.raw`D:\Tools\node.exe` + "\r\n");
let result: Awaited<ReturnType<typeof resolveGatewayProgramArguments>> | undefined;
await withMockedWindowsPlatform(async () => {
result = await resolveGatewayProgramArguments({
dev: true,
port: 18789,
runtime: "node",
});
});
expect(execFileSyncMock).toHaveBeenCalledWith(
path.win32.join(String.raw`D:\Windows`, "System32", "where.exe"),
["node"],
{ encoding: "utf8" },
);
expect(result?.programArguments).toEqual([
String.raw`D:\Tools\node.exe`,
"--import",
"tsx",
repoEntryPath,
"gateway",
"--port",
"18789",
]);
});
it("uses an executable wrapper when provided", async () => {
const wrapperPath = path.resolve("/usr/local/bin/openclaw-doppler");
fsMocks.stat.mockResolvedValue({ isFile: () => true } as never);