refactor: route channel contract tests through public barrels

This commit is contained in:
Peter Steinberger
2026-03-27 04:25:02 +00:00
parent 051d6f9342
commit 8d39fe5a76
7 changed files with 22 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ export * from "./src/actions/runtime.shared.js";
export * from "./src/channel-actions.js";
export * from "./src/directory-live.js";
export * from "./src/monitor.js";
export { __testing as discordMonitorTesting } from "./src/monitor/provider.js";
export * from "./src/monitor/gateway-plugin.js";
export * from "./src/monitor/gateway-registry.js";
export * from "./src/monitor/presence-cache.js";

View File

@@ -22,5 +22,6 @@ export {
export { monitorIMessageProvider } from "./src/monitor.js";
export type { MonitorIMessageOpts } from "./src/monitor.js";
export { __testing as imessageMonitorTesting } from "./src/monitor/monitor-provider.js";
export { probeIMessage } from "./src/probe.js";
export { sendMessageIMessage } from "./src/send.js";

View File

@@ -1,5 +1,6 @@
export * from "./src/action-runtime.js";
export * from "./src/directory-live.js";
export * from "./src/index.js";
export { __testing as slackMonitorTesting } from "./src/monitor/provider.js";
export * from "./src/resolve-channels.js";
export * from "./src/resolve-users.js";

View File

@@ -53,6 +53,7 @@ export {
} from "openclaw/plugin-sdk/telegram-core";
export type { TelegramProbe } from "./src/probe.js";
export { auditTelegramGroupMembership, collectTelegramUnmentionedGroupIds } from "./src/audit.js";
export { resolveTelegramRuntimeGroupPolicy } from "./src/group-access.js";
export {
buildTelegramExecApprovalPendingPayload,
shouldSuppressTelegramExecApprovalForwardingFallback,

View File

@@ -14,3 +14,4 @@ export {
normalizeWhatsAppTarget,
} from "./src/normalize-target.js";
export { resolveWhatsAppGroupIntroHint } from "./src/runtime-api.js";
export { __testing as whatsappAccessControlTesting } from "./src/inbound/access-control.js";

View File

@@ -1,2 +1,3 @@
export * from "./src/setup-core.js";
export * from "./src/setup-surface.js";
export { evaluateZaloGroupAccess, resolveZaloRuntimeGroupPolicy } from "./src/group-access.js";

View File

@@ -1,16 +1,19 @@
import { describe, expect, it } from "vitest";
import { __testing as discordTesting } from "../../../../extensions/discord/src/monitor/provider.js";
import { __testing as imessageTesting } from "../../../../extensions/imessage/src/monitor/monitor-provider.js";
import { __testing as slackTesting } from "../../../../extensions/slack/src/monitor/provider.js";
import { resolveTelegramRuntimeGroupPolicy } from "../../../../extensions/telegram/src/group-access.js";
import { __testing as whatsappTesting } from "../../../../extensions/whatsapp/src/inbound/access-control.js";
import { __testing as zaloTesting } from "../../../../extensions/zalo/src/monitor.js";
import { discordMonitorTesting } from "../../../../extensions/discord/runtime-api.js";
import { imessageMonitorTesting } from "../../../../extensions/imessage/runtime-api.js";
import { slackMonitorTesting } from "../../../../extensions/slack/runtime-api.js";
import { resolveTelegramRuntimeGroupPolicy } from "../../../../extensions/telegram/runtime-api.js";
import { whatsappAccessControlTesting } from "../../../../extensions/whatsapp/api.js";
import {
evaluateZaloGroupAccess,
resolveZaloRuntimeGroupPolicy,
} from "../../../../extensions/zalo/api.js";
import { installChannelRuntimeGroupPolicyFallbackSuite } from "./suites.js";
describe("channel runtime group policy contract", () => {
describe("slack", () => {
installChannelRuntimeGroupPolicyFallbackSuite({
resolve: slackTesting.resolveSlackRuntimeGroupPolicy,
resolve: slackMonitorTesting.resolveSlackRuntimeGroupPolicy,
configuredLabel: "keeps open default when channels.slack is configured",
defaultGroupPolicyUnderTest: "open",
missingConfigLabel: "fails closed when channels.slack is missing and no defaults are set",
@@ -30,7 +33,7 @@ describe("channel runtime group policy contract", () => {
describe("whatsapp", () => {
installChannelRuntimeGroupPolicyFallbackSuite({
resolve: whatsappTesting.resolveWhatsAppRuntimeGroupPolicy,
resolve: whatsappAccessControlTesting.resolveWhatsAppRuntimeGroupPolicy,
configuredLabel: "keeps open fallback when channels.whatsapp is configured",
defaultGroupPolicyUnderTest: "disabled",
missingConfigLabel: "fails closed when channels.whatsapp is missing and no defaults are set",
@@ -40,7 +43,7 @@ describe("channel runtime group policy contract", () => {
describe("imessage", () => {
installChannelRuntimeGroupPolicyFallbackSuite({
resolve: imessageTesting.resolveIMessageRuntimeGroupPolicy,
resolve: imessageMonitorTesting.resolveIMessageRuntimeGroupPolicy,
configuredLabel: "keeps open fallback when channels.imessage is configured",
defaultGroupPolicyUnderTest: "disabled",
missingConfigLabel: "fails closed when channels.imessage is missing and no defaults are set",
@@ -50,7 +53,7 @@ describe("channel runtime group policy contract", () => {
describe("discord", () => {
installChannelRuntimeGroupPolicyFallbackSuite({
resolve: discordTesting.resolveDiscordRuntimeGroupPolicy,
resolve: discordMonitorTesting.resolveDiscordRuntimeGroupPolicy,
configuredLabel: "keeps open default when channels.discord is configured",
defaultGroupPolicyUnderTest: "open",
missingConfigLabel: "fails closed when channels.discord is missing and no defaults are set",
@@ -58,7 +61,7 @@ describe("channel runtime group policy contract", () => {
});
it("respects explicit provider policy", () => {
const resolved = discordTesting.resolveDiscordRuntimeGroupPolicy({
const resolved = discordMonitorTesting.resolveDiscordRuntimeGroupPolicy({
providerConfigPresent: false,
groupPolicy: "disabled",
});
@@ -69,7 +72,7 @@ describe("channel runtime group policy contract", () => {
describe("zalo", () => {
installChannelRuntimeGroupPolicyFallbackSuite({
resolve: zaloTesting.resolveZaloRuntimeGroupPolicy,
resolve: resolveZaloRuntimeGroupPolicy,
configuredLabel: "keeps open fallback when channels.zalo is configured",
defaultGroupPolicyUnderTest: "open",
missingConfigLabel: "fails closed when channels.zalo is missing and no defaults are set",
@@ -77,7 +80,7 @@ describe("channel runtime group policy contract", () => {
});
it("keeps provider-owned group access evaluation", () => {
const decision = zaloTesting.evaluateZaloGroupAccess({
const decision = evaluateZaloGroupAccess({
providerConfigPresent: true,
configuredGroupPolicy: "allowlist",
defaultGroupPolicy: "open",