Skip to content

test(gateway): server.test MCP 工具清单补上 route_mindmap_finalize(修 Windows app CI 持续红) - #268

Merged
21335464876 merged 1 commit into
devfrom
test/dev-server-mcp-tool-list
Sep 22, 2026
Merged

21335464876 merged 1 commit into
devfrom
test/dev-server-mcp-tool-list

Conversation

@Ewan-yuan

Copy link
Copy Markdown
Collaborator

问题

Windows app CI 在所有基于 dev 的 PR 上持续失败(#266 三个 run 连挂,#267 同样)。

根因

#264(写作路线导图/聚焦改版)在 capabilities/builtins.ts 把 route_mindmap_finalize 无条件注册进 documents 能力注册表,但 apps/gateway/tests/server.test.ts 两处硬编码的 tools/list 断言没有同步:

AssertionError: expected [ 'context_room_list', …(14) ] to deeply equal [ 'context_room_list', …(13) ]
+   "route_mindmap_finalize",

两处(REST 直连 MCP 端点 :713、SDK Client 重连 :776)都缺这一项,按实际注册顺序位于 context_room_document_comment_add 与 context_room_document_delete 之间。dev 基线自身即红,与改动内容无关。

修复

两处断言各补一行 "route_mindmap_finalize"(测试改动,2 行)。

测试

  • 本地 vitest run tests/server.test.ts:19/19 通过(修复前按 CI 同样路径复现 2 处 AssertionError)。

#264 写作路线导图(聚焦改版)把 route_mindmap_finalize 无条件注册进
documents 能力注册表(capabilities/builtins.ts),但 server.test.ts 两处
硬编码 tools/list 断言(MCP 端点直连 + SDK Client 重连)没同步,Windows
app CI 自该合入后在所有基于 dev 的 PR 上持续红(两处 AssertionError:
收到 15 项、期望 14 项,多出的正是 route_mindmap_finalize,按注册顺序
位于 context_room_document_comment_add 与 context_room_document_delete
之间)。按实际注册顺序补齐两处断言。

本地 vitest run tests/server.test.ts 19/19 通过。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查结论:✅ 无阻塞问题,可合并

仅核对改动正确性,逐点验证如下:

1. 断言插入位置与实际注册顺序一致(核心正确性)

apps/gateway/src/modules/documents/capabilities/builtins.ts:45-48 的注册顺序是 commentPlugin → routeMindmapPlugin → deletePlugin,对应工具顺序即 context_room_document_comment_add → route_mindmap_finalize → context_room_document_delete。两处断言(apps/gateway/tests/server.test.ts:727、apps/gateway/tests/server.test.ts:791)均恰好插入在这两个工具之间,与注册顺序一致(也与 CI AssertionError 中 + "route_mindmap_finalize" 的实际 diff 位置吻合)。

2. 无条件注册,不存在环境相关的顺序/出现歧义

route-mindmap-plugin.ts 的工具是无条件注册进 documents 能力注册表的(builtins.ts:46,服务经 getter 惰性取用,缺失时仅在 execute 抛 503)。因此 tools/list 恒定包含该工具,断言不会因测试环境装配差异而不稳定。

3. 覆盖完整,无遗漏的同类断言

全局检索 tools/list 硬编码清单:server.test.ts 仅这两处(本次均已修复);documents.test.ts:1381 已包含该项,且 documents.test.ts:1427 的 toHaveLength(15) 与 15 项清单自洽。无残留的红断言。

4. 风险面

纯测试改动(+2 行),不触碰运行时代码,无安全/隐私/构建/发布风险。


非阻塞建议(可留待后续)

这两处断言把全部 15 个工具名按序硬编码,每次新增文档工具都会再次打红(本次已是第二轮:#264 漏改导致 #266/#267 连挂)。后续可考虑改为「断言包含关键工具 + 相对顺序」或从注册表推导期望清单,降低维护成本。与本 PR 修复目标无关,不阻塞。

@21335464876
21335464876 merged commit 7154efc into dev Sep 22, 2026
4 checks passed
@21335464876
21335464876 deleted the test/dev-server-mcp-tool-list branch September 22, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants