Problem
Issue #7 抽 parseGetChatHistoryArgs pure function 重構了 get_chat_history handler,但 dump_chat_to_markdown handler (Server.swift:466-499) 保留同樣的 inline 驗證邏輯:
chat_id guard
max_messages 0/10_000 cap (一字不差)
parseISODate + parseUntilDate with DateParseError catch
errorResult 轉換
From verification of #7 by devils-advocate (HIGH):
「若未來改 HandlerArgs.swift 的 cap policy,dump_chat_to_markdown 會 silently drift。commit message 和 code comment 都沒提這 exception,test file 名稱 ServerHandlerLogicTests 又泛化,下個 reviewer 容易誤以為『all handlers covered』」
Type
refactor
Expected
- 抽
DumpChatToMarkdownArgs struct + parseDumpChatToMarkdownArgs(_ args:) throws -> ... pure function
- 或 generalize:
parseGetChatHistoryArgs → parseChatHistoryArgs(帶 isDumpMode: Bool 或 output context),兩個 handler 共用
- 對應 unit tests 覆蓋 dump_chat_to_markdown 的 validation 路徑
Code Reference
Sources/CheTelegramAllMCPCore/Server.swift:466-499(被忽略的 handler)
Sources/CheTelegramAllMCPCore/HandlerArgs.swift(可 extend 的模組)
Related: #7
Current Status
Phase: closed
Last updated: 2026-04-26 by idd-close
Key Decisions
Scope Changes
- 增補:
testDumpExplicitSelfLabel(scope+1,default vs explicit override 對稱覆蓋,已透明標註)
- 增補:CHANGELOG
10 new tests → 11 new tests in-scope fix(commit ac306ba)
Blocking
(none)
Follow-up
Test counts
- 139 → 150 (+11), 0 failures
- Codex 獨立驗證 24 tests pass
Commits
Problem
Issue #7 抽
parseGetChatHistoryArgspure function 重構了get_chat_historyhandler,但dump_chat_to_markdownhandler (Server.swift:466-499) 保留同樣的 inline 驗證邏輯:chat_idguardmax_messages0/10_000 cap (一字不差)parseISODate+parseUntilDatewith DateParseError catcherrorResult轉換Type
refactor
Expected
DumpChatToMarkdownArgsstruct +parseDumpChatToMarkdownArgs(_ args:) throws -> ...pure functionparseGetChatHistoryArgs→parseChatHistoryArgs(帶isDumpMode: Bool或 output context),兩個 handler 共用Code Reference
Sources/CheTelegramAllMCPCore/Server.swift:466-499(被忽略的 handler)Sources/CheTelegramAllMCPCore/HandlerArgs.swift(可 extend 的模組)Related: #7
Current Status
Phase: closed
Last updated: 2026-04-26 by idd-close
Key Decisions
validateMaxMessagesCapshared helper:兩個 parser 共用 0/10_000 cap invariant10 → 11)+ 4 follow-ups + 2 won't-fix(理由透明)Scope Changes
testDumpExplicitSelfLabel(scope+1,default vs explicit override 對稱覆蓋,已透明標註)10 new tests→11 new testsin-scope fix(commitac306ba)Blocking
(none)
Follow-up
max_messages.string/.doublesilently bypass cap(pre-existing parity bug)output_pathtraversal hardening(pre-existing security MEDIUM)Test counts
Commits
a834e88refactor: extract validateMaxMessagesCap shared helper (Refactor dump_chat_to_markdown handler to use parseGetChatHistoryArgs pattern #13)f4ea946refactor: extract parseDumpChatToMarkdownArgs pure function (Refactor dump_chat_to_markdown handler to use parseGetChatHistoryArgs pattern #13)ac306badocs: fix CHANGELOG test count 10 → 11 (Refactor dump_chat_to_markdown handler to use parseGetChatHistoryArgs pattern #13)