mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:50:45 +00:00
fix: centralize source reply delivery mode
This commit is contained in:
@@ -141,6 +141,78 @@ describe("scripts/test-projects changed-target routing", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("routes group visible reply config changes through channel delivery regressions", () => {
|
||||
expect(
|
||||
resolveChangedTestTargetPlan([
|
||||
"src/config/types.messages.ts",
|
||||
"src/config/zod-schema.core.ts",
|
||||
]),
|
||||
).toEqual({
|
||||
mode: "targets",
|
||||
targets: [
|
||||
"src/auto-reply/reply/dispatch-acp.test.ts",
|
||||
"src/auto-reply/reply/dispatch-from-config.test.ts",
|
||||
"src/auto-reply/reply/followup-runner.test.ts",
|
||||
"src/auto-reply/reply/groups.test.ts",
|
||||
"extensions/discord/src/monitor/message-handler.process.test.ts",
|
||||
"extensions/slack/src/monitor.tool-result.test.ts",
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("routes source reply prompt changes through prompt and channel delivery regressions", () => {
|
||||
expect(resolveChangedTestTargetPlan(["src/agents/system-prompt.ts"])).toEqual({
|
||||
mode: "targets",
|
||||
targets: [
|
||||
"src/agents/system-prompt.test.ts",
|
||||
"src/auto-reply/reply/dispatch-acp.test.ts",
|
||||
"src/auto-reply/reply/dispatch-from-config.test.ts",
|
||||
"src/auto-reply/reply/followup-runner.test.ts",
|
||||
"src/auto-reply/reply/groups.test.ts",
|
||||
"extensions/discord/src/monitor/message-handler.process.test.ts",
|
||||
"extensions/slack/src/monitor.tool-result.test.ts",
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("routes source reply delivery mode changes through channel delivery regressions", () => {
|
||||
expect(
|
||||
resolveChangedTestTargetPlan(["src/auto-reply/reply/source-reply-delivery-mode.ts"]),
|
||||
).toEqual({
|
||||
mode: "targets",
|
||||
targets: [
|
||||
"src/auto-reply/reply/dispatch-acp.test.ts",
|
||||
"src/auto-reply/reply/dispatch-from-config.test.ts",
|
||||
"src/auto-reply/reply/followup-runner.test.ts",
|
||||
"src/auto-reply/reply/groups.test.ts",
|
||||
"extensions/discord/src/monitor/message-handler.process.test.ts",
|
||||
"extensions/slack/src/monitor.tool-result.test.ts",
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("routes channel reply pipeline SDK changes through SDK and channel delivery regressions", () => {
|
||||
expect(resolveChangedTestTargetPlan(["src/plugin-sdk/channel-reply-pipeline.ts"])).toEqual({
|
||||
mode: "targets",
|
||||
targets: [
|
||||
"src/plugins/contracts/plugin-sdk-subpaths.test.ts",
|
||||
"src/auto-reply/reply/dispatch-acp.test.ts",
|
||||
"src/auto-reply/reply/dispatch-from-config.test.ts",
|
||||
"src/auto-reply/reply/followup-runner.test.ts",
|
||||
"src/auto-reply/reply/groups.test.ts",
|
||||
"extensions/discord/src/monitor/message-handler.process.test.ts",
|
||||
"extensions/slack/src/monitor.tool-result.test.ts",
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("routes reply runtime SDK exports through plugin SDK contract tests", () => {
|
||||
expect(resolveChangedTestTargetPlan(["src/plugin-sdk/reply-runtime.ts"])).toEqual({
|
||||
mode: "targets",
|
||||
targets: ["src/plugins/contracts/plugin-sdk-subpaths.test.ts"],
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps extension batch runner edits on extension script tests", () => {
|
||||
expect(resolveChangedTestTargetPlan(["scripts/test-extension-batch.mjs"])).toEqual({
|
||||
mode: "targets",
|
||||
@@ -465,7 +537,12 @@ describe("scripts/test-projects changed-target routing", () => {
|
||||
).toEqual({
|
||||
mode: "targets",
|
||||
targets: [
|
||||
"src/auto-reply/reply/dispatch-acp.test.ts",
|
||||
"src/auto-reply/reply/dispatch-from-config.test.ts",
|
||||
"src/auto-reply/reply/followup-runner.test.ts",
|
||||
"src/auto-reply/reply/groups.test.ts",
|
||||
"extensions/discord/src/monitor/message-handler.process.test.ts",
|
||||
"extensions/slack/src/monitor.tool-result.test.ts",
|
||||
"src/auto-reply/reply/effective-reply-route.test.ts",
|
||||
],
|
||||
});
|
||||
|
||||
76
test/scripts/testbox-sync-sanity.test.ts
Normal file
76
test/scripts/testbox-sync-sanity.test.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import path from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
evaluateTestboxSyncSanity,
|
||||
parseGitShortStatus,
|
||||
} from "../../scripts/testbox-sync-sanity.mjs";
|
||||
|
||||
describe("testbox sync sanity", () => {
|
||||
it("parses tracked deletions from git short status", () => {
|
||||
expect(
|
||||
parseGitShortStatus(
|
||||
" D pnpm-lock.yaml\nD package.json\n?? scratch.txt\nR old.ts -> new.ts\n",
|
||||
),
|
||||
).toEqual([
|
||||
{
|
||||
line: " D pnpm-lock.yaml",
|
||||
path: "pnpm-lock.yaml",
|
||||
status: " D",
|
||||
trackedDeletion: true,
|
||||
},
|
||||
{
|
||||
line: "D package.json",
|
||||
path: "package.json",
|
||||
status: "D ",
|
||||
trackedDeletion: true,
|
||||
},
|
||||
{
|
||||
line: "?? scratch.txt",
|
||||
path: "scratch.txt",
|
||||
status: "??",
|
||||
trackedDeletion: false,
|
||||
},
|
||||
{
|
||||
line: "R old.ts -> new.ts",
|
||||
path: "new.ts",
|
||||
status: "R ",
|
||||
trackedDeletion: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("fails before a gate when critical repo files disappeared", () => {
|
||||
const result = evaluateTestboxSyncSanity({
|
||||
cwd: "/repo",
|
||||
statusRaw: "",
|
||||
exists: (file) => path.basename(file) !== "pnpm-lock.yaml",
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(false);
|
||||
expect(result.problems).toContain("missing required root files: pnpm-lock.yaml");
|
||||
});
|
||||
|
||||
it("fails on mass tracked deletions unless explicitly allowed", () => {
|
||||
const statusRaw = Array.from({ length: 3 }, (_, index) => ` D file-${index}.ts`).join("\n");
|
||||
const result = evaluateTestboxSyncSanity({
|
||||
cwd: "/repo",
|
||||
statusRaw,
|
||||
deletionThreshold: 3,
|
||||
exists: () => true,
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(false);
|
||||
expect(result.trackedDeletionCount).toBe(3);
|
||||
expect(result.problems[0]).toContain("remote git status has 3 tracked deletions");
|
||||
|
||||
expect(
|
||||
evaluateTestboxSyncSanity({
|
||||
cwd: "/repo",
|
||||
statusRaw,
|
||||
deletionThreshold: 3,
|
||||
allowMassDeletions: true,
|
||||
exists: () => true,
|
||||
}).ok,
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user