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
+2 -1
View File
@@ -4,7 +4,6 @@ import { EventEmitter } from "node:events";
import process from "node:process";
import { describe, expect, it, vi } from "vitest";
import { setVerbose } from "../global-state.js";
import { OPENCLAW_CLI_ENV_VALUE } from "../infra/openclaw-exec-env.js";
import { attachChildProcessBridge } from "./child-process-bridge.js";
import {
resolveCommandEnv,
@@ -15,6 +14,8 @@ import {
shouldSpawnWithShell,
} from "./exec.js";
const OPENCLAW_CLI_ENV_VALUE = "1";
describe("runCommandWithTimeout", () => {
it("never enables shell execution (Windows cmd.exe injection hardening)", () => {
expect(
+13 -8
View File
@@ -3,12 +3,7 @@ import { EventEmitter } from "node:events";
import fs from "node:fs";
import path from "node:path";
import { PassThrough } from "node:stream";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import {
getWindowsInstallRoots,
getWindowsSystem32ExePath,
resetWindowsInstallRootsForTests,
} from "../infra/windows-install-roots.js";
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { withTempDir } from "../test-utils/temp-dir.js";
import { withMockedWindowsPlatform } from "../test-utils/vitest-spies.js";
@@ -133,10 +128,19 @@ function expectCmdWrappedInvocation(call: ExecaCall, commandFragment = "pnpm.cmd
let runCommandWithTimeout: typeof import("./exec.js").runCommandWithTimeout;
let runExec: typeof import("./exec.js").runExec;
let spawnCommand: typeof import("./exec.js").spawnCommand;
let getWindowsInstallRoots: typeof import("../infra/windows-install-roots.js").getWindowsInstallRoots;
let getWindowsSystem32ExePath: typeof import("../infra/windows-install-roots.js").getWindowsSystem32ExePath;
describe("Windows command execution", () => {
beforeAll(async () => {
beforeEach(async () => {
vi.resetModules();
const accessSync = fs.accessSync.bind(fs);
vi.spyOn(fs, "accessSync").mockImplementation((filePath, mode) => {
if (String(filePath).toLowerCase() === "c:\\windows\\system32\\reg.exe") {
throw new Error("registry lookup disabled for test");
}
return accessSync(filePath, mode);
});
vi.doMock("execa", () => ({ execa: execaMock }));
vi.doMock("../infra/executable-path.js", async () => {
const actual = await vi.importActual<typeof import("../infra/executable-path.js")>(
@@ -154,6 +158,8 @@ describe("Windows command execution", () => {
await vi.importActual<typeof import("node:child_process")>("node:child_process");
return { ...actual, spawnSync: spawnSyncMock };
});
({ getWindowsInstallRoots, getWindowsSystem32ExePath } =
await import("../infra/windows-install-roots.js"));
({ runCommandWithTimeout, runExec, spawnCommand } = await import("./exec.js"));
});
@@ -165,7 +171,6 @@ describe("Windows command execution", () => {
});
beforeEach(() => {
resetWindowsInstallRootsForTests({ queryRegistryValue: () => null });
execaMock.mockReset();
execaMock.mockImplementation(() => createMockSubprocess());
isRegularFileMock.mockReset();
+14 -10
View File
@@ -1,15 +1,12 @@
// Child adapter tests cover adapting child processes to supervisor runs.
import type { ChildProcess } from "node:child_process";
import { EventEmitter } from "node:events";
import fs from "node:fs";
import { mkdir, writeFile } from "node:fs/promises";
import path from "node:path";
import { PassThrough } from "node:stream";
import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { afterAll, afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { useAutoCleanupTempDirTracker } from "../../../../test/helpers/temp-dir.js";
import {
getWindowsInstallRoots,
resetWindowsInstallRootsForTests,
} from "../../../infra/windows-install-roots.js";
import {
expectRealExitWinsOverSigkillFallback,
expectWaitStaysPendingUntilSigkillFallback,
@@ -39,6 +36,7 @@ vi.mock("../../../infra/windows-encoding.js", () => ({
}));
let createChildAdapter: typeof import("./child.js").createChildAdapter;
let getWindowsInstallRoots: typeof import("../../../infra/windows-install-roots.js").getWindowsInstallRoots;
const tempDirs = useAutoCleanupTempDirTracker(afterEach);
function createStubChild(pid = 1234) {
@@ -132,12 +130,17 @@ describe("createChildAdapter", () => {
});
};
beforeAll(async () => {
beforeEach(async () => {
vi.resetModules();
const accessSync = fs.accessSync.bind(fs);
vi.spyOn(fs, "accessSync").mockImplementation((filePath, mode) => {
if (String(filePath).toLowerCase() === "c:\\windows\\system32\\reg.exe") {
throw new Error("registry lookup disabled for test");
}
return accessSync(filePath, mode);
});
({ getWindowsInstallRoots } = await import("../../../infra/windows-install-roots.js"));
({ createChildAdapter } = await import("./child.js"));
});
beforeEach(() => {
resetWindowsInstallRootsForTests({ queryRegistryValue: () => null });
spawnWithFallbackMock.mockClear();
signalProcessTreeMock.mockClear();
createWindowsOutputDecoderMock.mockClear();
@@ -158,6 +161,7 @@ describe("createChildAdapter", () => {
});
afterEach(() => {
vi.restoreAllMocks();
if (originalPlatformDescriptor) {
Object.defineProperty(process, "platform", originalPlatformDescriptor);
}