Commit d1346bd
authored
Fix tasks disappearing on Dashboard click (empty API guard) (#5815)
## Summary
- **Root cause**: Rust backend's `get_action_items` Firestore query
silently swallowed errors (`break` instead of `return Err`), returning
`Ok(vec![])`. The handler's HTTP 500 fix (commit 35a8d4d) was bypassed
because it only caught `Err` results.
- When user clicked Dashboard, `refreshTasksIfNeeded()` and
`reconcileWithAPIIfNeeded()` ran reconciliation against the empty
response, hard-deleting all synced tasks from SQLite.
- Same `break` pattern existed in `get_memories_filtered`.
## Changes
1. **Rust backend** (`firestore.rs`): Changed `break` to `return
Err(...)` on Firestore query failures in `get_action_items` and
`get_memories_filtered`, so errors propagate to handlers and result in
HTTP 500
2. **Swift** (`TasksStore.swift`): Added `!response.items.isEmpty` guard
to `refreshTasksIfNeeded()` and `allApiIds.isEmpty` guard to
`reconcileWithAPIIfNeeded()` — matches existing guard in
`forceReconcileOnLoad()`
3. **Swift** (`ActionItemStorage.swift`): Added empty-set guards to
`hardDeleteAbsentTasks()` and `markAbsentTasksAsStaged()` as last line
of defense
## Test plan
- [x] Swift app builds clean
- [x] Rust backend compiles clean
- [x] Verified affected user (Salman, UID
`6HbrDL1WZ4PYqwa6O7N4uWT0nPj1`) has 17 incomplete tasks in Firestore and
macOS FCM token
- [ ] After release, verify Salman's tasks persist across Dashboard
navigation
🤖 Generated with [Claude Code](https://claude.com/claude-code)4 files changed
Lines changed: 26 additions & 6 deletions
File tree
- desktop
- Backend-Rust/src/services
- Desktop/Sources
- Rewind/Core
- Stores
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1072 | 1072 | | |
1073 | 1073 | | |
1074 | 1074 | | |
1075 | | - | |
1076 | | - | |
| 1075 | + | |
| 1076 | + | |
1077 | 1077 | | |
1078 | 1078 | | |
1079 | 1079 | | |
| |||
1997 | 1997 | | |
1998 | 1998 | | |
1999 | 1999 | | |
2000 | | - | |
2001 | | - | |
| 2000 | + | |
| 2001 | + | |
2002 | 2002 | | |
2003 | 2003 | | |
2004 | 2004 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
613 | 619 | | |
614 | 620 | | |
615 | 621 | | |
| |||
640 | 646 | | |
641 | 647 | | |
642 | 648 | | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
643 | 655 | | |
644 | 656 | | |
645 | 657 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
| 207 | + | |
207 | 208 | | |
208 | 209 | | |
209 | 210 | | |
| |||
341 | 342 | | |
342 | 343 | | |
343 | 344 | | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
344 | 351 | | |
345 | 352 | | |
346 | 353 | | |
| |||
0 commit comments