mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
refactor: burn cross-directory export name collisions (#121893)
* refactor: name subsystem logger exports * refactor(test): distinguish exported test doubles * refactor: consolidate canonical owner helpers * refactor: give cross-domain helpers distinct names * chore(lint): ratchet collision debt baselines * fix(test): complete collision rename consumers * fix(test): update remaining collision mock consumers * fix(test): update transcript reader mock export * refactor: keep embedded logger name at its owner * fix(test): align embedded logger mock with owner * refactor: name shared assistant phase extraction * fix(ui): update assistant phase extractor import * chore(generated): refresh collision and SDK baselines * style(test): format merged plugin mocks * chore(sdk): refresh API content hashes
This commit is contained in:
committed by
GitHub
parent
97c2eab77c
commit
e390781534
@@ -2,7 +2,7 @@
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { createIosNodeListResponse } from "./program.nodes-test-helpers.js";
|
||||
import { callGateway, runtime } from "./program.test-mocks.js";
|
||||
import { programGatewayCallMock, runtime } from "./program.test-mocks.js";
|
||||
|
||||
let registerNodesCli: typeof import("./nodes-cli.js").registerNodesCli;
|
||||
|
||||
@@ -54,7 +54,7 @@ describe("cli program (nodes basics)", () => {
|
||||
}
|
||||
|
||||
function gatewayRequests(): GatewayCallRequest[] {
|
||||
return callGateway.mock.calls.map(([request]) => request as GatewayCallRequest);
|
||||
return programGatewayCallMock.mock.calls.map(([request]) => request as GatewayCallRequest);
|
||||
}
|
||||
|
||||
function writeJsonArgAt(index: number): unknown {
|
||||
@@ -75,7 +75,7 @@ describe("cli program (nodes basics)", () => {
|
||||
}
|
||||
|
||||
function mockGatewayWithIosNodeListAnd(method: "node.describe" | "node.invoke", result: unknown) {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.list") {
|
||||
return createIosNodeListResponse();
|
||||
@@ -95,7 +95,7 @@ describe("cli program (nodes basics)", () => {
|
||||
|
||||
it("runs nodes list with the effective paired node view while preserving paired metadata", async () => {
|
||||
const now = Date.now();
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.pair.list") {
|
||||
return {
|
||||
@@ -204,7 +204,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("runs unfiltered nodes list with pairing data when node.list is unavailable", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.pair.list") {
|
||||
return {
|
||||
@@ -233,7 +233,7 @@ describe("cli program (nodes basics)", () => {
|
||||
|
||||
it("sanitizes untrusted nodes list table fields while preserving JSON values", async () => {
|
||||
const now = Date.now();
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.pair.list") {
|
||||
return {
|
||||
@@ -286,7 +286,7 @@ describe("cli program (nodes basics)", () => {
|
||||
|
||||
it("runs nodes list --connected and filters to connected nodes", async () => {
|
||||
const now = Date.now();
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.pair.list") {
|
||||
return {
|
||||
@@ -326,7 +326,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("counts catalog-only paired nodes in the filtered list total", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.pair.list") {
|
||||
return {
|
||||
@@ -360,7 +360,7 @@ describe("cli program (nodes basics)", () => {
|
||||
|
||||
it("runs nodes status --last-connected and filters by age", async () => {
|
||||
const now = Date.now();
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.list") {
|
||||
return {
|
||||
@@ -487,7 +487,7 @@ describe("cli program (nodes basics)", () => {
|
||||
],
|
||||
},
|
||||
])("runs nodes status and renders $label", async ({ node, expectedOutput }) => {
|
||||
callGateway.mockResolvedValue({
|
||||
programGatewayCallMock.mockResolvedValue({
|
||||
ts: Date.now(),
|
||||
nodes: [node],
|
||||
});
|
||||
@@ -524,7 +524,7 @@ describe("cli program (nodes basics)", () => {
|
||||
rejectedPath: "path: /one:/two:/three:/four",
|
||||
},
|
||||
])("renders $platform node PATH entries with their platform delimiter", async (fixture) => {
|
||||
callGateway.mockResolvedValue({
|
||||
programGatewayCallMock.mockResolvedValue({
|
||||
ts: Date.now(),
|
||||
nodes: [
|
||||
{
|
||||
@@ -546,7 +546,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("keeps connection age adjacent to connection status before pending approval", async () => {
|
||||
callGateway.mockResolvedValue({
|
||||
programGatewayCallMock.mockResolvedValue({
|
||||
ts: Date.now(),
|
||||
nodes: [
|
||||
{
|
||||
@@ -609,7 +609,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("keeps explicit gateway options in node reapproval guidance without leaking auth", async () => {
|
||||
callGateway.mockResolvedValue({
|
||||
programGatewayCallMock.mockResolvedValue({
|
||||
ts: Date.now(),
|
||||
nodes: [
|
||||
{
|
||||
@@ -644,7 +644,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("falls back to read-only node status when pairing diagnostics are unavailable", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as {
|
||||
method?: string;
|
||||
scopes?: string[];
|
||||
@@ -698,7 +698,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("keeps remote explicit diagnostic credentials on the read-only path", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as {
|
||||
method?: string;
|
||||
requireLocalBackendSharedAuth?: boolean;
|
||||
@@ -751,7 +751,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("does not retry node diagnostics after a transport failure", async () => {
|
||||
callGateway.mockRejectedValue(new Error("gateway timed out"));
|
||||
programGatewayCallMock.mockRejectedValue(new Error("gateway timed out"));
|
||||
|
||||
await expect(runProgram(["nodes", "status"])).rejects.toThrow("exit");
|
||||
|
||||
@@ -761,7 +761,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("falls back to configured auth after stored device auth is rejected", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string; useStoredDeviceAuth?: boolean };
|
||||
if (opts.method === "node.list" && opts.useStoredDeviceAuth) {
|
||||
throw Object.assign(new Error("unauthorized: device token mismatch"), {
|
||||
@@ -795,7 +795,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("falls back to configured auth when stored device auth lacks read scope", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as {
|
||||
method?: string;
|
||||
scopes?: string[];
|
||||
@@ -839,7 +839,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("describes pending-only nodes through the pairing diagnostics view", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as {
|
||||
method?: string;
|
||||
params?: { nodeId?: string };
|
||||
@@ -883,7 +883,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("describes nodes through the paired-node fallback on older gateways", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as {
|
||||
method?: string;
|
||||
params?: { nodeId?: string };
|
||||
@@ -937,7 +937,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("runs nodes approve with the pending request approval scopes", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.pair.list") {
|
||||
return {
|
||||
@@ -978,7 +978,7 @@ describe("cli program (nodes basics)", () => {
|
||||
});
|
||||
|
||||
it("falls back to command-derived nodes approve scopes", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.pair.list") {
|
||||
return {
|
||||
@@ -1021,11 +1021,11 @@ describe("cli program (nodes basics)", () => {
|
||||
{ scopes: ["operator.admin"] },
|
||||
),
|
||||
).rejects.toThrow("unsupported node pair approval gateway method: node.invoke");
|
||||
expect(callGateway).not.toHaveBeenCalled();
|
||||
expect(programGatewayCallMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("runs nodes remove and calls node.pair.remove", async () => {
|
||||
callGateway.mockImplementation(async (...args: unknown[]) => {
|
||||
programGatewayCallMock.mockImplementation(async (...args: unknown[]) => {
|
||||
const opts = (args[0] ?? {}) as { method?: string };
|
||||
if (opts.method === "node.list") {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user