Fix create_task silently dropping dates, reminders, and priority#11
Open
partymola wants to merge 1 commit into
Open
Fix create_task silently dropping dates, reminders, and priority#11partymola wants to merge 1 commit into
partymola wants to merge 1 commit into
Conversation
Problem ------- ticktick_create_task delegates to client.task.builder() from the ticktick-py library to construct the task dict, then passes it to client.task.create(). However, builder() silently drops fields it does not handle -- the values are accepted as parameters but never appear in the returned dict. Failure scenarios: - User creates a task with dueDate='2026-04-01T20:45:00+00:00'. The task is created successfully but with no due date -- it does not appear in TickTick's today/upcoming views and no reminder fires. - User creates a task with reminders=['TRIGGER:PT0S']. The task is created but without reminders, so no notification is sent. - User creates a task with priority=5 (high). The task is created with no priority set (appears as priority 0/none in TickTick). - User provides timeZone='Europe/London'. The timezone is not stored, so date display may be wrong for users not in the server's local tz. All of these fail silently -- the API returns success and the task exists, but the missing fields make it effectively invisible or misconfigured. The caller has no indication that anything went wrong. Fix --- After calling builder(), check whether each user-provided field is present in the resulting dict. If the builder omitted it, add it directly using the same conversion functions (convert_date_to_tick_tick_ format for dates, raw values for reminders/priority/timeZone). Fields already set by the builder are not overwritten, so this is safe even if a future version of ticktick-py fixes the builder. Add unit tests covering builder field gaps, preservation of existing builder output, timezone fallback, and error handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ticktick_create_taskdelegates toclient.task.builder()from the ticktick-py library to construct the task dict, then passes it toclient.task.create(). However,builder()silently drops fields it does not handle -- the values are accepted as parameters but never appear in the returned dict.Failure scenarios
dueDate='2026-04-01T20:45:00+00:00'. The task is created successfully but with no due date -- it does not appear in TickTick's today/upcoming views and no reminder fires.reminders=['TRIGGER:PT0S']. The task is created but without reminders, so no notification is sent at the due time.priority=5(high). The task is created with no priority set (appears as priority 0/none in TickTick).timeZone='Europe/London'. The timezone is not stored, so date display may be wrong for users not in the server's local timezone.All of these fail silently -- the API returns success and the task exists, but the missing fields make it effectively invisible or misconfigured. The caller has no indication that anything went wrong.
Fix
After calling
builder(), check whether each user-provided field is present in the resulting dict. If the builder omitted it, add it directly using the same conversion functions (convert_date_to_tick_tick_formatfor dates, raw values for reminders/priority/timeZone).Fields already set by the builder are not overwritten, so this is safe even if a future version of ticktick-py fixes the builder.
Tests
14 unit tests added covering:
priority=0)priority=None(default) does not trigger fallback