|
3 | 3 | ## Completed |
4 | 4 |
|
5 | 5 | - [x] Push optimization: inline content in tree (O(n) → O(1)) |
6 | | -- [x] Pull optimization: raw.githubusercontent.com (0 API calls) |
| 6 | +- [x] **Pull optimization: GraphQL batch fetch (O(n) → O(1))** |
| 7 | + - Uses GitHub GraphQL API with aliases to fetch multiple files in 1 request |
| 8 | + - 100 files = 1 API call (vs 100+ REST API calls before) |
| 9 | + - Replaced CDN + Blob API fallback with reliable GraphQL approach |
7 | 10 | - [x] Rate limit detection and backoff |
8 | 11 | - [x] Skip push when no changes |
| 12 | +- [x] **Timestamp-based sync** - replaced vector clocks with simple lastModified comparison |
| 13 | + - Removed vectorClock from LocalSyncState, Manifest, and all category types |
| 14 | + - Replaced compareVectorClocks with compareTimestamps (lastSyncedAt vs updatedAt) |
| 15 | + - Removed concurrent state detection (now uses last-write-wins) |
| 16 | + - Bumped manifest schema to 3.0 |
| 17 | +- [x] Checksum-based change detection |
| 18 | +- [x] Manifest structure for tracking files |
| 19 | +- [x] Tombstones for deletion tracking |
| 20 | +- [x] Per-file granularity (not repo-level overwrite) |
| 21 | +- [x] Pull-then-push flow (when remote is newer, pull first then push local changes) |
9 | 22 |
|
10 | | -## Future |
| 23 | +## In Progress: Safety & Observability |
| 24 | + |
| 25 | +- [ ] Log when local files are overwritten by remote |
| 26 | +- [ ] Log when remote files are overwritten by local |
| 27 | +- [ ] Add --force-local and --force-remote CLI flags for manual resolution |
| 28 | +- [ ] Show warning on config file overwrites |
| 29 | +- [ ] Add conflict counter to sync summary |
| 30 | + |
| 31 | +## Backlog: Rate Limit Improvements |
| 32 | + |
| 33 | +- [x] Add exponential backoff retry logic for GitHub API calls (already implemented in fetch.ts) |
| 34 | +- [x] Batch file fetches to reduce API call frequency (GraphQL batch fetch) |
| 35 | + |
| 36 | +## Future Enhancements |
11 | 37 |
|
12 | 38 | - [ ] ETag caching for manifest fetch (saves bandwidth, not API calls) |
13 | 39 | - [ ] GitHub webhook for push notifications (eliminate polling) |
14 | 40 | - [ ] Compression improvements for large messages |
15 | 41 | - [ ] Parallel category processing during sync |
| 42 | + |
| 43 | +## Design Notes |
| 44 | + |
| 45 | +### Timestamp-Based Sync Trade-offs (Research-Backed) |
| 46 | + |
| 47 | +- **Clock skew risk**: NTP drift 1-50ms (cloud), 100-500ms (geo-distributed) |
| 48 | + - Source: "Clock Skew Conflict in Distributed Systems" (2026) |
| 49 | + - Mitigation: Modern OS auto-sync via NTP (atomic clock: 1s in 3M years) |
| 50 | + - Impact: Very low - machines rarely drift years apart |
| 51 | + - Real-world: CockroachDB uses 500ms max offset tolerance successfully |
| 52 | +- **Concurrent edit data loss**: Last-write-wins on same file from 2 machines |
| 53 | + - Source: "Beyond Timestamps: Conflict Resolution" (2025) |
| 54 | + - Likelihood: Very low for CLI tool (one session at a time) |
| 55 | + - Impact: One edit lost, logged for manual recovery |
| 56 | + - Mitigation: Sessions/messages are mostly append-only (different files) |
| 57 | +- **Config overwrites**: Settings changes on both machines = last wins |
| 58 | + - Mitigation: Show warning, allow manual merge via flags |
| 59 | + - Frequency: Low - settings changed infrequently |
| 60 | + - Precedent: VS Code Settings Sync (4M+ users) uses simple last-write-wins |
0 commit comments