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

推荐订阅源

V
V2EX
aimingoo的专栏
aimingoo的专栏
S
SegmentFault 最新的问题
博客园_首页
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
博客园 - 【当耐特】
月光博客
月光博客
C
Check Point Blog
T
The Blog of Author Tim Ferriss
罗磊的独立博客
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
Microsoft Security Blog
Microsoft Security Blog
B
Blog
阮一峰的网络日志
阮一峰的网络日志
腾讯CDC
美团技术团队
N
Netflix TechBlog - Medium
Stack Overflow Blog
Stack Overflow Blog
Y
Y Combinator Blog
L
LangChain Blog
The Cloudflare Blog

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(discord): consume component panels once · openclaw/op...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -118,6 +118,41 @@ describe("discord component registry", () => {

118118

expect(resolveDiscordComponentEntry({ id: "btn_1" })).toBeNull();

119119

});

120120121+

it("consumes sibling entries from the same non-reusable component message", () => {

122+

const result = buildDiscordComponentMessage({

123+

spec: {

124+

text: "Confirm action",

125+

blocks: [

126+

{

127+

type: "actions",

128+

buttons: [

129+

{ label: "Confirm", callbackData: "confirm" },

130+

{ label: "Cancel", callbackData: "cancel" },

131+

],

132+

},

133+

],

134+

},

135+

});

136+

const confirm = result.entries.find((entry) => entry.label === "Confirm");

137+

const cancel = result.entries.find((entry) => entry.label === "Cancel");

138+

expect(confirm?.consumptionGroupId).toBeTruthy();

139+

expect(cancel?.consumptionGroupId).toBe(confirm?.consumptionGroupId);

140+

expect(confirm?.consumptionGroupEntryIds).toEqual(

141+

expect.arrayContaining([confirm?.id, cancel?.id]),

142+

);

143+144+

registerDiscordComponentEntries({

145+

entries: result.entries,

146+

modals: [],

147+

messageId: "msg_1",

148+

ttlMs: 1000,

149+

});

150+151+

const consumed = resolveDiscordComponentEntry({ id: confirm?.id ?? "" });

152+

expect(consumed?.label).toBe("Confirm");

153+

expect(resolveDiscordComponentEntry({ id: cancel?.id ?? "", consume: false })).toBeNull();

154+

});

155+121156

it("shares registry state across duplicate module instances", async () => {

122157

const first = (await import(

123158

`${componentsRegistryModuleUrl}?t=first-${Date.now()}`

@@ -208,6 +243,49 @@ describe("discord component registry", () => {

208243

expect(openKeyedStore).toHaveBeenCalledTimes(4);

209244

});

210245246+

it("deletes sibling persistent component entries when a group entry is consumed", async () => {

247+

const componentDelete = vi.fn().mockResolvedValue(true);

248+

const componentStore = {

249+

register: vi.fn(),

250+

lookup: vi.fn(),

251+

consume: vi.fn().mockResolvedValue({

252+

version: 1,

253+

entry: {

254+

id: "btn_confirm",

255+

kind: "button",

256+

label: "Confirm",

257+

consumptionGroupId: "grp_1",

258+

consumptionGroupEntryIds: ["btn_confirm", "btn_cancel"],

259+

},

260+

}),

261+

delete: componentDelete,

262+

};

263+

const modalStore = {

264+

register: vi.fn(),

265+

lookup: vi.fn(),

266+

consume: vi.fn(),

267+

delete: vi.fn(),

268+

};

269+

const openKeyedStore = vi.fn((opts: { namespace: string }) =>

270+

opts.namespace === "discord.components" ? componentStore : modalStore,

271+

);

272+

const { setDiscordRuntime } = await import("./runtime.js");

273+

setDiscordRuntime({

274+

state: { openKeyedStore },

275+

logging: { getChildLogger: () => ({ warn: vi.fn() }) },

276+

} as never);

277+278+

clearDiscordComponentEntries();

279+

await expect(

280+

resolveDiscordComponentEntryWithPersistence({ id: "btn_confirm" }),

281+

).resolves.toMatchObject({

282+

id: "btn_confirm",

283+

});

284+285+

await vi.waitFor(() => expect(componentDelete).toHaveBeenCalledWith("btn_cancel"));

286+

expect(componentDelete).toHaveBeenCalledWith("btn_confirm");

287+

});

288+211289

it("falls back to the in-memory registry when persistent state cannot open", async () => {

212290

const warn = vi.fn();

213291

const { setDiscordRuntime } = await import("./runtime.js");