fix(ci): restore local check suite
This commit is contained in:
parent
990d0d7261
commit
6bf07b5075
@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
getRequiredHookHandler,
|
||||
registerHookHandlersForTest,
|
||||
} from "../../test-utils/subagent-hooks.js";
|
||||
} from "../../../test/helpers/extensions/subagent-hooks.js";
|
||||
import { registerDiscordSubagentHooks } from "./subagent-hooks.js";
|
||||
|
||||
type ThreadBindingRecord = {
|
||||
|
||||
@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
getRequiredHookHandler,
|
||||
registerHookHandlersForTest,
|
||||
} from "../../test-utils/subagent-hooks.js";
|
||||
} from "../../../test/helpers/extensions/subagent-hooks.js";
|
||||
import { registerFeishuSubagentHooks } from "./subagent-hooks.js";
|
||||
import {
|
||||
__testing as threadBindingTesting,
|
||||
|
||||
@ -2,7 +2,10 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/googlechat";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { buildChannelSetupWizardAdapterFromSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js";
|
||||
import { createTestWizardPrompter, type WizardPrompter } from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import {
|
||||
createTestWizardPrompter,
|
||||
type WizardPrompter,
|
||||
} from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import { googlechatPlugin } from "./channel.js";
|
||||
|
||||
const googlechatConfigureAdapter = buildChannelSetupWizardAdapterFromSetupWizard({
|
||||
|
||||
@ -2,7 +2,10 @@ import type { RuntimeEnv } from "openclaw/plugin-sdk/irc";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { buildChannelSetupWizardAdapterFromSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js";
|
||||
import { createTestWizardPrompter, type WizardPrompter } from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import {
|
||||
createTestWizardPrompter,
|
||||
type WizardPrompter,
|
||||
} from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import { ircPlugin } from "./channel.js";
|
||||
import type { CoreConfig } from "./types.js";
|
||||
|
||||
|
||||
@ -7,7 +7,10 @@ import {
|
||||
resolveLineAccount,
|
||||
} from "../../../src/line/accounts.js";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js";
|
||||
import { createTestWizardPrompter, type WizardPrompter } from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import {
|
||||
createTestWizardPrompter,
|
||||
type WizardPrompter,
|
||||
} from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import { lineSetupAdapter, lineSetupWizard } from "./setup-surface.js";
|
||||
|
||||
const lineConfigureAdapter = buildChannelSetupWizardAdapterFromSetupWizard({
|
||||
|
||||
@ -2,7 +2,10 @@ import type { OpenClawConfig } from "openclaw/plugin-sdk/nostr";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { buildChannelSetupWizardAdapterFromSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js";
|
||||
import { createTestWizardPrompter, type WizardPrompter } from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import {
|
||||
createTestWizardPrompter,
|
||||
type WizardPrompter,
|
||||
} from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import { nostrPlugin } from "./channel.js";
|
||||
|
||||
const nostrConfigureAdapter = buildChannelSetupWizardAdapterFromSetupWizard({
|
||||
|
||||
@ -2,7 +2,10 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import { buildChannelSetupWizardAdapterFromSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
|
||||
import type { OpenClawConfig } from "../../../src/config/config.js";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js";
|
||||
import { createTestWizardPrompter, type WizardPrompter } from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import {
|
||||
createTestWizardPrompter,
|
||||
type WizardPrompter,
|
||||
} from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import { synologyChatPlugin } from "./channel.js";
|
||||
import { synologyChatSetupWizard } from "./setup-surface.js";
|
||||
|
||||
|
||||
@ -2,7 +2,10 @@ import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/tlon";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { buildChannelSetupWizardAdapterFromSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js";
|
||||
import { createTestWizardPrompter, type WizardPrompter } from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import {
|
||||
createTestWizardPrompter,
|
||||
type WizardPrompter,
|
||||
} from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import { tlonPlugin } from "./channel.js";
|
||||
|
||||
const tlonConfigureAdapter = buildChannelSetupWizardAdapterFromSetupWizard({
|
||||
|
||||
@ -2,7 +2,10 @@ import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/zalo";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { buildChannelSetupWizardAdapterFromSetupWizard } from "../../../src/channels/plugins/setup-wizard.js";
|
||||
import { createRuntimeEnv } from "../../../test/helpers/extensions/runtime-env.js";
|
||||
import { createTestWizardPrompter, type WizardPrompter } from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import {
|
||||
createTestWizardPrompter,
|
||||
type WizardPrompter,
|
||||
} from "../../../test/helpers/extensions/setup-wizard.js";
|
||||
import { zaloPlugin } from "./channel.js";
|
||||
|
||||
const zaloConfigureAdapter = buildChannelSetupWizardAdapterFromSetupWizard({
|
||||
|
||||
@ -25,14 +25,18 @@ function expectClearedTimeoutState(onTimeout: ReturnType<typeof vi.fn>, timedOut
|
||||
function buildAggregateTimeoutParams(
|
||||
overrides: Partial<AggregateTimeoutParams> &
|
||||
Pick<AggregateTimeoutParams, "waitForCompactionRetry">,
|
||||
): AggregateTimeoutParams & { onTimeout: ReturnType<typeof vi.fn> } {
|
||||
const onTimeout = overrides.onTimeout ?? vi.fn();
|
||||
): { params: AggregateTimeoutParams; onTimeoutSpy: ReturnType<typeof vi.fn> } {
|
||||
const onTimeoutSpy = vi.fn();
|
||||
const onTimeout = overrides.onTimeout ?? (() => onTimeoutSpy());
|
||||
return {
|
||||
waitForCompactionRetry: overrides.waitForCompactionRetry,
|
||||
abortable: overrides.abortable ?? (async (promise) => await promise),
|
||||
aggregateTimeoutMs: overrides.aggregateTimeoutMs ?? 60_000,
|
||||
isCompactionStillInFlight: overrides.isCompactionStillInFlight,
|
||||
onTimeout,
|
||||
params: {
|
||||
waitForCompactionRetry: overrides.waitForCompactionRetry,
|
||||
abortable: overrides.abortable ?? (async (promise) => await promise),
|
||||
aggregateTimeoutMs: overrides.aggregateTimeoutMs ?? 60_000,
|
||||
isCompactionStillInFlight: overrides.isCompactionStillInFlight,
|
||||
onTimeout,
|
||||
},
|
||||
onTimeoutSpy,
|
||||
};
|
||||
}
|
||||
|
||||
@ -40,7 +44,7 @@ describe("waitForCompactionRetryWithAggregateTimeout", () => {
|
||||
it("times out and fires callback when compaction retry never resolves", async () => {
|
||||
await withFakeTimers(async () => {
|
||||
const waitForCompactionRetry = vi.fn(async () => await new Promise<void>(() => {}));
|
||||
const params = buildAggregateTimeoutParams({ waitForCompactionRetry });
|
||||
const { params, onTimeoutSpy } = buildAggregateTimeoutParams({ waitForCompactionRetry });
|
||||
|
||||
const resultPromise = waitForCompactionRetryWithAggregateTimeout(params);
|
||||
|
||||
@ -48,7 +52,7 @@ describe("waitForCompactionRetryWithAggregateTimeout", () => {
|
||||
const result = await resultPromise;
|
||||
|
||||
expect(result.timedOut).toBe(true);
|
||||
expectClearedTimeoutState(params.onTimeout, true);
|
||||
expectClearedTimeoutState(onTimeoutSpy, true);
|
||||
});
|
||||
});
|
||||
|
||||
@ -68,14 +72,15 @@ describe("waitForCompactionRetryWithAggregateTimeout", () => {
|
||||
waitForCompactionRetry,
|
||||
isCompactionStillInFlight: () => compactionInFlight,
|
||||
});
|
||||
const { params: aggregateTimeoutParams, onTimeoutSpy } = params;
|
||||
|
||||
const resultPromise = waitForCompactionRetryWithAggregateTimeout(params);
|
||||
const resultPromise = waitForCompactionRetryWithAggregateTimeout(aggregateTimeoutParams);
|
||||
|
||||
await vi.advanceTimersByTimeAsync(170_000);
|
||||
const result = await resultPromise;
|
||||
|
||||
expect(result.timedOut).toBe(false);
|
||||
expectClearedTimeoutState(params.onTimeout, false);
|
||||
expectClearedTimeoutState(onTimeoutSpy, false);
|
||||
});
|
||||
});
|
||||
|
||||
@ -86,7 +91,7 @@ describe("waitForCompactionRetryWithAggregateTimeout", () => {
|
||||
setTimeout(() => {
|
||||
compactionInFlight = false;
|
||||
}, 90_000);
|
||||
const params = buildAggregateTimeoutParams({
|
||||
const { params, onTimeoutSpy } = buildAggregateTimeoutParams({
|
||||
waitForCompactionRetry,
|
||||
isCompactionStillInFlight: () => compactionInFlight,
|
||||
});
|
||||
@ -97,19 +102,19 @@ describe("waitForCompactionRetryWithAggregateTimeout", () => {
|
||||
const result = await resultPromise;
|
||||
|
||||
expect(result.timedOut).toBe(true);
|
||||
expectClearedTimeoutState(params.onTimeout, true);
|
||||
expectClearedTimeoutState(onTimeoutSpy, true);
|
||||
});
|
||||
});
|
||||
|
||||
it("does not time out when compaction retry resolves", async () => {
|
||||
await withFakeTimers(async () => {
|
||||
const waitForCompactionRetry = vi.fn(async () => {});
|
||||
const params = buildAggregateTimeoutParams({ waitForCompactionRetry });
|
||||
const { params, onTimeoutSpy } = buildAggregateTimeoutParams({ waitForCompactionRetry });
|
||||
|
||||
const result = await waitForCompactionRetryWithAggregateTimeout(params);
|
||||
|
||||
expect(result.timedOut).toBe(false);
|
||||
expectClearedTimeoutState(params.onTimeout, false);
|
||||
expectClearedTimeoutState(onTimeoutSpy, false);
|
||||
});
|
||||
});
|
||||
|
||||
@ -118,7 +123,7 @@ describe("waitForCompactionRetryWithAggregateTimeout", () => {
|
||||
const abortError = new Error("aborted");
|
||||
abortError.name = "AbortError";
|
||||
const waitForCompactionRetry = vi.fn(async () => await new Promise<void>(() => {}));
|
||||
const params = buildAggregateTimeoutParams({
|
||||
const { params, onTimeoutSpy } = buildAggregateTimeoutParams({
|
||||
waitForCompactionRetry,
|
||||
abortable: async () => {
|
||||
throw abortError;
|
||||
@ -127,7 +132,7 @@ describe("waitForCompactionRetryWithAggregateTimeout", () => {
|
||||
|
||||
await expect(waitForCompactionRetryWithAggregateTimeout(params)).rejects.toThrow("aborted");
|
||||
|
||||
expectClearedTimeoutState(params.onTimeout, false);
|
||||
expectClearedTimeoutState(onTimeoutSpy, false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -8,7 +8,7 @@ function expectArrayMessageContent(
|
||||
message: AgentMessage | undefined,
|
||||
errorMessage: string,
|
||||
): Array<{ type: string; text?: string; data?: string }> {
|
||||
if (!message || !Array.isArray(message.content)) {
|
||||
if (!message || !("content" in message) || !Array.isArray(message.content)) {
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
return message.content as Array<{ type: string; text?: string; data?: string }>;
|
||||
|
||||
@ -10,14 +10,17 @@ import {
|
||||
waitForActiveEmbeddedRuns,
|
||||
} from "./runs.js";
|
||||
|
||||
type RunHandle = Parameters<typeof setActiveEmbeddedRun>[1];
|
||||
|
||||
function createRunHandle(
|
||||
overrides: { isCompacting?: boolean; abort?: ReturnType<typeof vi.fn> } = {},
|
||||
) {
|
||||
overrides: { isCompacting?: boolean; abort?: () => void } = {},
|
||||
): RunHandle {
|
||||
const abort = overrides.abort ?? (() => {});
|
||||
return {
|
||||
queueMessage: async () => {},
|
||||
isStreaming: () => true,
|
||||
isCompacting: () => overrides.isCompacting ?? false,
|
||||
abort: overrides.abort ?? vi.fn(),
|
||||
abort,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@ import type { AgentSession } from "@mariozechner/pi-coding-agent";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { applySystemPromptOverrideToSession, createSystemPromptOverride } from "./system-prompt.js";
|
||||
|
||||
type MutableSession = AgentSession & {
|
||||
type MutableSystemPromptFields = {
|
||||
_baseSystemPrompt?: string;
|
||||
_rebuildSystemPrompt?: (toolNames: string[]) => string;
|
||||
};
|
||||
@ -21,7 +21,7 @@ function applyAndGetMutableSession(
|
||||
const { session, setSystemPrompt } = createMockSession();
|
||||
applySystemPromptOverrideToSession(session, prompt);
|
||||
return {
|
||||
mutable: session as MutableSession,
|
||||
mutable: session as unknown as MutableSystemPromptFields,
|
||||
setSystemPrompt,
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user