惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园_首页
Last Week in AI
Last Week in AI
美团技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Apple Machine Learning Research
Apple Machine Learning Research
WordPress大学
WordPress大学
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
The Cloudflare Blog
罗磊的独立博客
月光博客
月光博客
N
Netflix TechBlog - Medium
C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
Jina AI
Jina AI
J
Java Code Geeks

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(imessage): surface silent group-allowlist drops at de...
omarshahine · 2026-05-08 · via Recent Commits to openclaw:main

@@ -0,0 +1,159 @@

1+

import { beforeEach, describe, expect, it } from "vitest";

2+

import {

3+

resetGroupAllowlistWarningsForTesting,

4+

warnGroupAllowlistDropPerChatOnce,

5+

warnGroupAllowlistMisconfigOnce,

6+

} from "./group-allowlist-warnings.js";

7+8+

beforeEach(() => {

9+

resetGroupAllowlistWarningsForTesting();

10+

});

11+12+

describe("warnGroupAllowlistMisconfigOnce", () => {

13+

it("fires when groupPolicy=allowlist and groups is undefined", () => {

14+

const messages: string[] = [];

15+

const fired = warnGroupAllowlistMisconfigOnce({

16+

groupPolicy: "allowlist",

17+

groups: undefined,

18+

accountId: "default",

19+

log: (m) => messages.push(m),

20+

});

21+

expect(fired).toBe(true);

22+

expect(messages).toHaveLength(1);

23+

expect(messages[0]).toContain('groupPolicy="allowlist"');

24+

expect(messages[0]).toContain("channels.imessage.groups is empty");

25+

expect(messages[0]).toContain("default");

26+

});

27+28+

it("fires when groupPolicy=allowlist and groups is empty object", () => {

29+

const messages: string[] = [];

30+

const fired = warnGroupAllowlistMisconfigOnce({

31+

groupPolicy: "allowlist",

32+

groups: {},

33+

accountId: "default",

34+

log: (m) => messages.push(m),

35+

});

36+

expect(fired).toBe(true);

37+

expect(messages).toHaveLength(1);

38+

});

39+40+

it("does not fire when groupPolicy is not allowlist", () => {

41+

const messages: string[] = [];

42+

const fired = warnGroupAllowlistMisconfigOnce({

43+

groupPolicy: "open",

44+

groups: undefined,

45+

accountId: "default",

46+

log: (m) => messages.push(m),

47+

});

48+

expect(fired).toBe(false);

49+

expect(messages).toHaveLength(0);

50+

});

51+52+

it("does not fire when groups has a wildcard entry", () => {

53+

const messages: string[] = [];

54+

const fired = warnGroupAllowlistMisconfigOnce({

55+

groupPolicy: "allowlist",

56+

groups: { "*": { requireMention: true } },

57+

accountId: "default",

58+

log: (m) => messages.push(m),

59+

});

60+

expect(fired).toBe(false);

61+

expect(messages).toHaveLength(0);

62+

});

63+64+

it("does not fire when groups has explicit chat_id entries", () => {

65+

const messages: string[] = [];

66+

const fired = warnGroupAllowlistMisconfigOnce({

67+

groupPolicy: "allowlist",

68+

groups: { "12345": {} },

69+

accountId: "default",

70+

log: (m) => messages.push(m),

71+

});

72+

expect(fired).toBe(false);

73+

expect(messages).toHaveLength(0);

74+

});

75+76+

it("only fires once per accountId", () => {

77+

const messages: string[] = [];

78+

const log = (m: string) => messages.push(m);

79+

expect(

80+

warnGroupAllowlistMisconfigOnce({

81+

groupPolicy: "allowlist",

82+

groups: undefined,

83+

accountId: "default",

84+

log,

85+

}),

86+

).toBe(true);

87+

expect(

88+

warnGroupAllowlistMisconfigOnce({

89+

groupPolicy: "allowlist",

90+

groups: undefined,

91+

accountId: "default",

92+

log,

93+

}),

94+

).toBe(false);

95+

expect(messages).toHaveLength(1);

96+

});

97+98+

it("fires separately for distinct accountIds", () => {

99+

const messages: string[] = [];

100+

const log = (m: string) => messages.push(m);

101+

warnGroupAllowlistMisconfigOnce({

102+

groupPolicy: "allowlist",

103+

groups: undefined,

104+

accountId: "primary",

105+

log,

106+

});

107+

warnGroupAllowlistMisconfigOnce({

108+

groupPolicy: "allowlist",

109+

groups: undefined,

110+

accountId: "secondary",

111+

log,

112+

});

113+

expect(messages).toHaveLength(2);

114+

});

115+

});

116+117+

describe("warnGroupAllowlistDropPerChatOnce", () => {

118+

it("fires once per accountId:chat_id pair", () => {

119+

const messages: string[] = [];

120+

const log = (m: string) => messages.push(m);

121+

expect(warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: 42, log })).toBe(true);

122+

expect(warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: 42, log })).toBe(

123+

false,

124+

);

125+

expect(messages).toHaveLength(1);

126+

expect(messages[0]).toContain("chat_id=42");

127+

expect(messages[0]).toContain("default");

128+

expect(messages[0]).toContain('channels.imessage.groups["42"]');

129+

});

130+131+

it("fires separately for distinct chat_ids on the same account", () => {

132+

const messages: string[] = [];

133+

const log = (m: string) => messages.push(m);

134+

warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: 1, log });

135+

warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: 2, log });

136+

warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: 2, log });

137+

expect(messages).toHaveLength(2);

138+

});

139+140+

it("treats numeric and string chat_ids as the same key", () => {

141+

const messages: string[] = [];

142+

const log = (m: string) => messages.push(m);

143+

warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: 42, log });

144+

warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: "42", log });

145+

expect(messages).toHaveLength(1);

146+

});

147+148+

it("skips when chat_id is undefined or empty", () => {

149+

const messages: string[] = [];

150+

const log = (m: string) => messages.push(m);

151+

expect(

152+

warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: undefined, log }),

153+

).toBe(false);

154+

expect(warnGroupAllowlistDropPerChatOnce({ accountId: "default", chatId: "", log })).toBe(

155+

false,

156+

);

157+

expect(messages).toHaveLength(0);

158+

});

159+

});