mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix(sync): validate state before saving snapshot in hydrator
The snapshot was being saved before validation ran. If validation found corruption and repaired it, the snapshot was stale/wrong. This fix moves validation (CHECKPOINT C) BEFORE saving snapshot in both: - Tail replay path (after replaying ops following a snapshot) - Full replay path (when no snapshot exists) Now the snapshot contains validated/repaired state. Includes regression tests that verify validation happens before snapshot save in both code paths.
This commit is contained in:
parent
c185a784ad
commit
e6025b4178
4 changed files with 93 additions and 24 deletions
|
|
@ -151,14 +151,15 @@ The `take(1)` operator ensures the observable completes after receiving one valu
|
|||
|
||||
## High Priority Issues
|
||||
|
||||
### 1. Snapshot Saved Before Validation
|
||||
### 1. ~~Snapshot Saved Before Validation~~ - FIXED
|
||||
|
||||
**File:** `src/app/core/persistence/operation-log/store/operation-log-hydrator.service.ts`
|
||||
**Lines:** 167-176
|
||||
**Lines:** 166-179
|
||||
**Status:** Fixed on 2025-12-08
|
||||
|
||||
Snapshot saved at line 171, validation runs at line 176. If validation finds corruption and repairs, the snapshot is stale.
|
||||
**Original Issue:** Snapshot was saved before validation ran. If validation found corruption and repaired it, the snapshot was stale.
|
||||
|
||||
**Fix:** Move validation (Checkpoint C) BEFORE saving snapshot.
|
||||
**Fix Applied:** Moved validation (CHECKPOINT C) BEFORE saving snapshot in both tail replay and full replay code paths. Snapshot now contains validated/repaired state.
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -377,12 +378,12 @@ Checks `!task.projectId` but doesn't verify project still exists (could be delet
|
|||
|
||||
### Phase 2: High Priority (Current)
|
||||
|
||||
| # | Issue | File |
|
||||
| --- | ------------------------------ | ----------------------------------------- |
|
||||
| 1 | Snapshot timing | operation-log-hydrator.service.ts:167-176 |
|
||||
| 2 | Subtask orphan detection | tag-shared.reducer.ts |
|
||||
| 3 | Race conditions | task-due.effects.ts:40-65 |
|
||||
| 4 | Error handling standardization | Multiple effects |
|
||||
| # | Issue | Status |
|
||||
| --- | ------------------------------ | ------------------------- |
|
||||
| 1 | Snapshot timing | **FIXED** (2025-12-08) |
|
||||
| 2 | Subtask orphan detection | tag-shared.reducer.ts |
|
||||
| 3 | Race conditions | task-due.effects.ts:40-65 |
|
||||
| 4 | Error handling standardization | Multiple effects |
|
||||
|
||||
### Phase 3: Add Tests
|
||||
|
||||
|
|
|
|||
|
|
@ -96,13 +96,14 @@ if (!cache) {
|
|||
|
||||
When tags deleted, orphan detection only runs on parent tasks. Subtasks of surviving parents that lose all tags become orphaned but aren't cleaned up.
|
||||
|
||||
### 3. Snapshot Saved Before Validation
|
||||
### 3. ~~Snapshot Saved Before Validation~~ - FIXED
|
||||
|
||||
**File:** `src/app/core/persistence/operation-log/store/operation-log-hydrator.service.ts:167-176`
|
||||
**File:** `src/app/core/persistence/operation-log/store/operation-log-hydrator.service.ts:166-179`
|
||||
**Status:** Fixed on 2025-12-08
|
||||
|
||||
Snapshot saved at line 171, validation runs at line 176. If validation finds corruption and repairs, the snapshot is now stale/wrong.
|
||||
**Original Issue:** Snapshot was saved before validation ran. If validation found corruption, the snapshot was stale.
|
||||
|
||||
**Fix:** Move validation (Checkpoint C) BEFORE saving snapshot.
|
||||
**Fix Applied:** Moved validation (CHECKPOINT C) BEFORE saving snapshot in both tail replay and full replay code paths.
|
||||
|
||||
### 4. No Error Handling in applyShortSyntax Sub-Functions
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue