Fix ISO8601 date parsing crash for task and project date fields#25
Fix ISO8601 date parsing crash for task and project date fields#25Lumenbeing wants to merge 2 commits into
Conversation
The bridge plugin returns dates from OmniFocus in formats that Swift's built-in .iso8601 JSONDecoder strategy cannot parse (e.g., dates without fractional seconds, date-only strings, or timestamps without timezone). This caused "Expected date string to be ISO8601-formatted" errors and 45-second bridge timeouts when requesting any date field (dueDate, plannedDate, deferDate, completionDate, lastReviewDate, nextReviewDate) on list-tasks or list-projects. Replace the strict .iso8601 decoder with a .custom strategy that tries multiple formats in order: 1. ISO8601 with fractional seconds 2. ISO8601 standard (withInternetDateTime) 3. Date-only (yyyy-MM-dd) 4. ISO8601 without timezone Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
This would fix my issue (#26). I'm on a European locale (DD/MM/YYYY) and every date field query crashes with the same ISO8601 error. Happy to test if helpful. |
|
Follow-up on the direction of this fix: After reviewing the bridge contract more closely, I narrowed the implementation to match the formats the bridge actually emits instead of broadly accepting multiple unrelated date variants. The bridge plugin serializes OmniFocus Date values with toISOString(), so the practical formats we need to support are:
Based on that, the branch has been adjusted to:
This keeps the fix aligned with the real transport format, avoids broadening the parsing contract without evidence, and removes the per-date formatter allocation from the original patch shape. Manual validation I recommend on a machine that can operate OmniFocus correctly:
Expected result:
|
|
@mikehohnen-web @Lumenbeing unfortunately I can't reproduce this error. I tried to narrow this down and made another commit. Can you confirm if the fix works? |
|
Thanks for the quick response. I'm happy to test when a new release is available via Homebrew. My issue is #25— European locale (DD/MM/YYYY) on macOS, every date field query fails. |
|
I added a follow-up diagnostic request on issue #26 so we can gather more concrete environment/runtime details from the reporter. The main thing I was trying to separate is:
On my Tahoe 26.4.1 machine, I still could not reproduce the failure even after switching to an Once they reply, we should have a much better sense of whether the PR is fixing a runtime-specific decode issue or whether there is a separate repro condition we have not captured yet. |
|
@Lumenbeing were you able to test the fix I created? Can you confirm what macOS version you are running on? |
Summary
Requesting any date field (
dueDate,plannedDate,deferDate,completionDate,lastReviewDate,nextReviewDate) onlist-tasksorlist-projectscauses a bridge timeout with:The root cause is that the
JSONDecoderinBridgeClientuses Swift's strict.iso8601date decoding strategy, which only acceptsyyyy-MM-dd'T'HH:mm:ssZ. OmniFocus's bridge plugin can return dates in other valid ISO 8601 variants (with fractional seconds, without timezone, or date-only).Fix
Replace the single-format
.iso8601decoder with a.customstrategy that tries multiple formats in order:2026-04-04T12:00:00.000Z)2026-04-04T12:00:00Z)2026-04-04)2026-04-04T12:00:00)Only
BridgeClient.swiftis changed — one-line replacement of the decoder strategy.Test plan
swift buildpassesfocusrelay list-projects --fields id,name,lastReviewDate,nextReviewDate,completionDatereturns dates correctly (previously crashed)focusrelay list-tasks --fields id,name,dueDate,plannedDate,deferDate,completionDatereturns dates correctly (previously crashed)