Skip to content

TZ symmetric mutation guard for testUntilDateUsesEndOfDay (parity with #16) #19

@kiki830621

Description

@kiki830621

Problem

From verification of #13 by devils-advocate (LOW):
「testDumpUntilDateUsesEndOfDay(lines 267-289)是直接複製 testUntilDateUsesEndOfDay(lines 123-142)的 pattern:用 Calendar.current.dateComponents(...) 拆解 parsed.untilDate,斷言 year=2026 / month=4 / day=17 / hour=23 / min=59 / sec=59。

Symmetric mutation gap

  • parseUntilDate 內部用 Calendar.current + TimeZone.current 把 "2026-04-17" 轉成 wall-clock 23:59:59(DateParsing.swift:60-66)
  • Test 又用 Calendar.current.dateComponents(...) 把 Date 拆回去
  • 兩邊都用同一個 Calendar.current → 即使 parseUntilDate 內部把 timezone 設錯,test 仍會看到 wall-clock 是 23:59:59

#15 Devil's Advocate 已經點出這是 testUntilDateUsesEndOfDay 的盲點,本 commit f4ea946 的 commit message 寫『symmetric downward parity with #15 DA finding』,但 #15 DA 的 TZ symmetric gap 並沒有被本次解決——只是被忠實複製到 dump 版。」
— Source: team:devils-advocate

這是 #15 的 follow-up #16 的延續:dump 版 testUntilDateUsesEndOfDay 繼承同樣的 round-trip 對稱 gap。

Type

enhancement

Expected

  • 用 timeIntervalSince1970 加上明確 TZ-aware Date 做 ground-truth 比較
  • 對 testUntilDateUsesEndOfDay 與 testDumpUntilDateUsesEndOfDay 兩個 test 同時修復
  • 範例:
    let formatter = ISO8601DateFormatter()
    formatter.timeZone = TimeZone.current
    let expected = formatter.date(from: "2026-04-17T23:59:59...")!
    XCTAssertEqual(parsed.untilDate!.timeIntervalSince1970, expected.timeIntervalSince1970, accuracy: 1.0)

Code Reference

  • Sources/CheTelegramAllMCPCore/DateParsing.swift:60-66 (parseUntilDate)
  • Tests/CheTelegramAllMCPTests/ServerHandlerLogicTests.swift:123-142 (testUntilDateUsesEndOfDay)
  • Tests/CheTelegramAllMCPTests/ServerHandlerLogicTests.swift:267-289 (testDumpUntilDateUsesEndOfDay)

Related: #13, #15, #16

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions