fix: The commit introduces imports from `src/channels/plugins/dm-acces

This commit is contained in:
openclaw-clawsweeper[bot]
2026-04-29 15:59:56 +00:00
committed by Peter Steinberger
parent 5e384fed6d
commit a512b5dde9
2 changed files with 37 additions and 1 deletions

View File

@@ -720,7 +720,7 @@ describe("whatsapp inbound dispatch", () => {
warn: vi.fn(),
error: vi.fn(),
debug: vi.fn(),
} as BufferedReplyParams["replyLogger"];
} as unknown as BufferedReplyParams["replyLogger"];
const error = new Error("send failed");
await dispatchBufferedReply({

View File

@@ -14,10 +14,14 @@ import {
createHybridChannelConfigBase,
ensureOpenDmPolicyAllowFromWildcard,
mapAllowFromEntries,
normalizeChannelDmPolicy,
normalizeLegacyDmAliases,
resolveChannelDmAccess,
resolveChannelDmAllowFrom,
resolveChannelDmPolicy,
resolveChannelConfigWrites,
resolveOptionalConfigString,
setCanonicalDmAllowFrom,
} from "./channel-config-helpers.js";
const resolveDefaultAccountId = () => DEFAULT_ACCOUNT_ID;
@@ -123,6 +127,38 @@ describe("resolveOptionalConfigString", () => {
});
describe("channel DM access helpers", () => {
it("re-exports centralized DM access helpers from the SDK entrypoint", () => {
const entry = { dm: { policy: "allowlist", allowFrom: ["U1"] } };
const changes: string[] = [];
expect(normalizeChannelDmPolicy("allowlist")).toBe("allowlist");
expect(
resolveChannelDmPolicy({
account: entry,
}),
).toBe("allowlist");
expect(
resolveChannelDmAllowFrom({
account: entry,
}),
).toEqual(["U1"]);
setCanonicalDmAllowFrom({
entry,
mode: "topOnly",
allowFrom: ["U2"],
pathPrefix: "channels.demo",
changes,
reason: "normalized by SDK helper",
});
expect(entry).toEqual({ dm: { policy: "allowlist" }, allowFrom: ["U2"] });
expect(changes).toEqual([
"- channels.demo.dm.allowFrom: removed after moving allowlist to channels.demo.allowFrom",
"- channels.demo.allowFrom: normalized by SDK helper",
]);
});
it("resolves account legacy allowFrom before inherited root allowFrom", () => {
expect(
resolveChannelDmAccess({