Skip to content

Add read-after-write verification for task mutations#12

Open
partymola wants to merge 1 commit into
jen6:mainfrom
partymola:feature/read-after-write-verification
Open

Add read-after-write verification for task mutations#12
partymola wants to merge 1 commit into
jen6:mainfrom
partymola:feature/read-after-write-verification

Conversation

@partymola
Copy link
Copy Markdown

@partymola partymola commented Mar 21, 2026

Summary

  • Adds verification.py with verify_mutation() helper that compares API responses against expected fields
  • Integrates into ticktick_create_task, update_task, and ticktick_complete_task
  • On mismatch, response includes _verification_warnings list so the caller can detect data loss
  • Includes 24 unit tests covering exact-match fields, presence-check fields, and edge cases
  • Also includes fixes for create_task dropping dates/reminders (builder workaround) and update_task wiping unmodified fields (exclude_unset)

Motivation

Three bugs caused silent data loss: update wiped dates when only changing priority, create dropped dates/reminders via builder(), and None state crashed get_by_id. All are now patched. This verification layer catches any future regressions at write time.

Test plan

  • pytest tests/test_verify_mutation.py - 24 tests pass
  • Manual testing: created/updated tasks via MCP, verified no false-positive warnings
  • Bug reproduction tests confirm all 3 historical issues would be caught

Verify API responses after create, update, and complete operations.
If the returned task doesn't match what was sent (e.g. missing dates,
wrong priority), a _verification_warnings field is added to the
response so the caller can detect and report the issue.

Also includes prior local patches: create_task now preserves dates/
reminders that builder() drops, and update_task uses exclude_unset
to avoid wiping unmodified fields.
@partymola partymola force-pushed the feature/read-after-write-verification branch from 9ad7cf6 to 91d368a Compare March 21, 2026 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant