Commit 1e11f26
fix: Critical bug fixes for write operations (v0.4.1-v0.4.7) (#48)
This PR includes 7 critical bug fixes discovered through end-to-end testing
of write operations, plus comprehensive documentation updates.
## Bug Fixes
### v0.4.1 - Push Payload Structure
- Fixed Worker API payload structure mismatch
- Changed `tasks` → `operations` array
- Changed `vectorClock` → `clientVectorClock`
- Added `type` field to all operations
- Changed `id` → `taskId`
- Impact: Write operations were 100% non-functional due to 400 errors
### v0.4.2 - JWT Schema Mismatch
- Fixed JWT payload schema to match Worker
- Changed `user_id` → `sub` (RFC 7519 standard)
- Changed `device_id` → `deviceId` (camelCase)
- Added `email` and `jti` fields
- Added `getUserIdFromToken()` helper
- Impact: JWT parsing failed preventing all operations
### v0.4.3 - Missing Checksum
- Added SHA-256 checksum calculation for write operations
- Added `hash()` method to CryptoManager
- Worker requires checksum but schema marked optional
- Impact: Tasks silently rejected by Worker (appeared successful)
### v0.4.4 - Rejection Checking
- Added validation of Worker's `rejected` array
- Tasks could be rejected with HTTP 200 OK
- Now throws detailed errors with rejection reasons
- Impact: Silent failures without error messages
### v0.4.5 - Field Name Mismatches
- Changed `quadrantId` → `quadrant` (frontend uses 'quadrant')
- Changed `createdAt: number` → `createdAt: string` (ISO)
- Changed `updatedAt: number` → `updatedAt: string` (ISO)
- Renamed `deriveQuadrantId()` → `deriveQuadrant()`
- Impact: Zod validation errors in webapp ("unrecognized key 'quadrantId'")
### v0.4.6 - Type Mismatches
- Changed `dueDate: number | null` → `dueDate?: string` (optional ISO)
- Changed `subtasks[].text` → `subtasks[].title`
- Added `completedAt?: string` field
- Added `vectorClock?: Record<string, number>` field
- Impact: "Expected string, received null" errors for dueDate
### v0.4.7 - MCP Tool Schemas
- Fixed MCP tool input schemas to match internal types
- Updated `dueDate` from `type: 'number'` → `type: 'string'`
- Updated subtasks from `text` → `title` field
- Impact: Claude Desktop sent wrong data types
## Documentation Updates
- Updated README to reflect v0.4.7 production-ready status
- Fixed all schema examples (quadrant, subtasks.title, ISO datetimes)
- Updated tool documentation with correct parameter types
- Added comprehensive bug fix history to README
- Updated status section with all 7 bug fixes
## Testing Results
All write operations tested end-to-end and working:
- ✅ Create task (simple)
- ✅ Create task with due date
- ✅ Create task with subtasks
- ✅ Update task
- ✅ Complete task
- ✅ Delete task
## Files Changed
- CHANGELOG.md - Full bug fix history
- README.md - Updated docs and examples
- package.json - Version 0.4.7
- src/index.ts - MCP tool schemas, version
- src/tools.ts - Schema interfaces (quadrant, dueDate, subtasks)
- src/write-ops.ts - All write operation types
- src/analytics.ts - Date handling for ISO strings
- src/crypto.ts - Added hash() method
- src/jwt.ts - Fixed JWT payload schema
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>1 parent 54945fb commit 1e11f26
File tree
11 files changed
+523
-89
lines changed- packages/mcp-server
- src
11 files changed
+523
-89
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
8 | 121 | | |
9 | 122 | | |
10 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
| 78 | + | |
84 | 79 | | |
85 | 80 | | |
86 | 81 | | |
| |||
366 | 361 | | |
367 | 362 | | |
368 | 363 | | |
369 | | - | |
| 364 | + | |
370 | 365 | | |
371 | | - | |
| 366 | + | |
372 | 367 | | |
373 | 368 | | |
374 | | - | |
375 | | - | |
| 369 | + | |
| 370 | + | |
376 | 371 | | |
377 | 372 | | |
378 | 373 | | |
379 | | - | |
380 | | - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
381 | 377 | | |
382 | 378 | | |
383 | 379 | | |
| |||
539 | 535 | | |
540 | 536 | | |
541 | 537 | | |
542 | | - | |
| 538 | + | |
543 | 539 | | |
544 | | - | |
| 540 | + | |
545 | 541 | | |
546 | 542 | | |
547 | 543 | | |
| |||
566 | 562 | | |
567 | 563 | | |
568 | 564 | | |
569 | | - | |
| 565 | + | |
570 | 566 | | |
571 | | - | |
| 567 | + | |
572 | 568 | | |
573 | 569 | | |
574 | 570 | | |
| |||
627 | 623 | | |
628 | 624 | | |
629 | 625 | | |
630 | | - | |
| 626 | + | |
631 | 627 | | |
632 | 628 | | |
633 | 629 | | |
| |||
753 | 749 | | |
754 | 750 | | |
755 | 751 | | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | 752 | | |
765 | 753 | | |
766 | 754 | | |
767 | 755 | | |
768 | 756 | | |
769 | 757 | | |
770 | 758 | | |
| 759 | + | |
| 760 | + | |
771 | 761 | | |
772 | 762 | | |
773 | 763 | | |
| |||
827 | 817 | | |
828 | 818 | | |
829 | 819 | | |
830 | | - | |
831 | | - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
832 | 823 | | |
833 | | - | |
| 824 | + | |
834 | 825 | | |
835 | 826 | | |
836 | 827 | | |
837 | | - | |
838 | | - | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
839 | 842 | | |
840 | 843 | | |
841 | 844 | | |
842 | 845 | | |
843 | 846 | | |
844 | 847 | | |
845 | 848 | | |
846 | | - | |
847 | | - | |
| 849 | + | |
| 850 | + | |
0 commit comments