mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-24 15:13:14 +00:00
fix(ci): repair node test regressions
This commit is contained in:
@@ -58,6 +58,10 @@ function buildChannelCandidates(
|
||||
normalizeMessageChannel(params.channel ?? "") ?? params.channel?.trim().toLowerCase();
|
||||
const groupId = params.groupId?.trim();
|
||||
const sessionConversation = resolveSessionConversationRef(params.parentSessionKey);
|
||||
const feishuParentOverrideFallbacks =
|
||||
normalizedChannel === "feishu"
|
||||
? buildFeishuParentOverrideCandidates(sessionConversation?.rawId)
|
||||
: [];
|
||||
const parentOverrideFallbacks =
|
||||
(normalizedChannel
|
||||
? getChannelPlugin(
|
||||
@@ -90,6 +94,7 @@ function buildChannelCandidates(
|
||||
sessionConversation?.rawId,
|
||||
...(groupConversation?.parentConversationCandidates ?? []),
|
||||
...(sessionConversation?.parentConversationCandidates ?? []),
|
||||
...feishuParentOverrideFallbacks,
|
||||
...parentOverrideFallbacks,
|
||||
),
|
||||
parentKeys: buildChannelKeyCandidates(
|
||||
@@ -103,6 +108,35 @@ function buildChannelCandidates(
|
||||
};
|
||||
}
|
||||
|
||||
function buildFeishuParentOverrideCandidates(rawId: string | undefined): string[] {
|
||||
const value = rawId?.trim();
|
||||
if (!value) {
|
||||
return [];
|
||||
}
|
||||
const topicSenderMatch = value.match(/^(.+):topic:([^:]+):sender:([^:]+)$/i);
|
||||
if (topicSenderMatch) {
|
||||
const chatId = topicSenderMatch[1]?.trim().toLowerCase();
|
||||
const topicId = topicSenderMatch[2]?.trim().toLowerCase();
|
||||
return [`${chatId}:topic:${topicId}`, chatId].filter((entry): entry is string =>
|
||||
Boolean(entry),
|
||||
);
|
||||
}
|
||||
const topicMatch = value.match(/^(.+):topic:([^:]+)$/i);
|
||||
if (topicMatch) {
|
||||
const chatId = topicMatch[1]?.trim().toLowerCase();
|
||||
const topicId = topicMatch[2]?.trim().toLowerCase();
|
||||
return [`${chatId}:topic:${topicId}`, chatId].filter((entry): entry is string =>
|
||||
Boolean(entry),
|
||||
);
|
||||
}
|
||||
const senderMatch = value.match(/^(.+):sender:([^:]+)$/i);
|
||||
if (senderMatch) {
|
||||
const chatId = senderMatch[1]?.trim().toLowerCase();
|
||||
return chatId ? [chatId] : [];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
export function resolveChannelModelOverride(
|
||||
params: ChannelModelOverrideParams,
|
||||
): ChannelModelOverride | null {
|
||||
|
||||
@@ -255,6 +255,12 @@ function createChatContext(): Pick<
|
||||
removeChatRun: vi.fn(),
|
||||
dedupe: new Map(),
|
||||
loadGatewayModelCatalog: async () => [
|
||||
{
|
||||
provider: "openai",
|
||||
id: "gpt-5.4",
|
||||
name: "GPT-5.4",
|
||||
input: ["text", "image"],
|
||||
},
|
||||
{
|
||||
provider: "anthropic",
|
||||
id: "claude-opus-4-6",
|
||||
|
||||
@@ -3,7 +3,7 @@ import {
|
||||
ZAI_CODING_CN_BASE_URL,
|
||||
ZAI_CODING_GLOBAL_BASE_URL,
|
||||
ZAI_GLOBAL_BASE_URL,
|
||||
} from "../../extensions/zai/api.js";
|
||||
} from "../plugin-sdk/zai.js";
|
||||
import { fetchWithTimeout } from "../utils/fetch-timeout.js";
|
||||
|
||||
export type ZaiEndpointId = "global" | "cn" | "coding-global" | "coding-cn";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { bundledPluginFile } from "./helpers/bundled-plugin-paths.js";
|
||||
|
||||
describe("isUnitConfigTestFile", () => {
|
||||
it("accepts unit-config src tests", () => {
|
||||
expect(isUnitConfigTestFile("src/infra/git-commit.test.ts")).toBe(true);
|
||||
expect(isUnitConfigTestFile("ui/src/ui/views/channels.test.ts")).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects files excluded from the unit config", () => {
|
||||
@@ -31,8 +31,8 @@ describe("isUnitConfigTestFile", () => {
|
||||
expect(isUnitConfigTestFile("test/extension-test-boundary.test.ts")).toBe(false);
|
||||
expect(isUnitConfigTestFile("src/agents/pi-embedded-runner.test.ts")).toBe(false);
|
||||
expect(isUnitConfigTestFile("src/commands/onboard.test.ts")).toBe(false);
|
||||
expect(isUnitConfigTestFile("ui/src/ui/views/channels.test.ts")).toBe(false);
|
||||
expect(isUnitConfigTestFile("ui/src/ui/views/chat.test.ts")).toBe(false);
|
||||
expect(isUnitConfigTestFile("ui/src/ui/views/channels.test.ts")).toBe(true);
|
||||
expect(isUnitConfigTestFile("ui/src/ui/views/chat.test.ts")).toBe(true);
|
||||
expect(isUnitConfigTestFile("ui/src/ui/views/other.test.ts")).toBe(false);
|
||||
expect(isUnitConfigTestFile("src/infra/git-commit.live.test.ts")).toBe(false);
|
||||
expect(isUnitConfigTestFile("src/infra/git-commit.e2e.test.ts")).toBe(false);
|
||||
|
||||
Reference in New Issue
Block a user