Problem
From verification of #3, #4:
「MCP 層的測試只驗 schema,沒有驗 handler 行為。ServerDumpChatToolTests.swift:71 只確認 get_chat_history 有六個欄位,沒有驗證 from_message_id == 0 時是否真的自動把 max_messages = limit,也沒有驗證 since_date / until_date / max_messages 是否真的傳進 TDLibClient」
— Sources: codex + team:regression
目前 get_chat_history 的 MCP 層只有 schema shape test,沒有 handler 行為 test。#3 的核心 fix(fromMsgId==0 時自動帶 maxMessages=limit)完全沒有 unit test 保護,只靠間接的 E2E test。
Type
enhancement
Expected
加入 unit tests 驗證 MCP handler 行為(至少不依賴真實 TDLib 連線):
fromMsgId == 0 且無 max_messages → TDLibClient.getChatHistory 被呼叫時帶 maxMessages == limit
fromMsgId > 0 且無 max_messages → maxMessages == nil(backward-compat path)
- 傳入
since_date / until_date → 正確解析為 Date 並傳入
- 傳入
max_messages → 覆蓋上面的隱式默認
Actual
只有 testGetChatHistoryProperties 驗證 schema 有 6 個 properties。
Impact
Technical Approach
可能需要 mock 或 fake TDLibClient 來驗證 handler 傳給 library 層的參數。參考 TDLibClientBackwardCompatTests 的 pattern(pure compilation + signature tests)。
Code Reference
- Handler:
Sources/CheTelegramAllMCPCore/Server.swift:345-363
- Existing schema test:
Tests/CheTelegramAllMCPTests/ServerDumpChatToolTests.swift:71-82
Related: #3, #4
Current Status
Phase: closed
Last updated: 2026-04-26 by idd-close
Key Decisions
Scope Changes
(none)
Follow-up
Commits
Problem
目前
get_chat_history的 MCP 層只有 schema shape test,沒有 handler 行為 test。#3 的核心 fix(fromMsgId==0時自動帶maxMessages=limit)完全沒有 unit test 保護,只靠間接的 E2E test。Type
enhancement
Expected
加入 unit tests 驗證 MCP handler 行為(至少不依賴真實 TDLib 連線):
fromMsgId == 0且無max_messages→TDLibClient.getChatHistory被呼叫時帶maxMessages == limitfromMsgId > 0且無max_messages→maxMessages == nil(backward-compat path)since_date/until_date→ 正確解析為Date並傳入max_messages→ 覆蓋上面的隱式默認Actual
只有
testGetChatHistoryProperties驗證 schema 有 6 個 properties。Impact
fromMsgId == 0 ? limit : nil移除),沒有 unit test 會 failTechnical Approach
可能需要 mock 或 fake TDLibClient 來驗證 handler 傳給 library 層的參數。參考
TDLibClientBackwardCompatTests的 pattern(pure compilation + signature tests)。Code Reference
Sources/CheTelegramAllMCPCore/Server.swift:345-363Tests/CheTelegramAllMCPTests/ServerDumpChatToolTests.swift:71-82Related: #3, #4
Current Status
Phase: closed
Last updated: 2026-04-26 by idd-close
Key Decisions
Scope Changes
(none)
Follow-up
Commits
f8a7d51refactor: extract parseGetChatHistoryArgs pure function + handler tests (MCP 層補 handler 行為 unit test(get_chat_history) #7)