super-productivity/e2e/fixtures/test-backup-with-archives.json
Johannes Millan 6c3f183fb7 fix(backup): persist archive data to IndexedDB on local import
When importing a backup file locally, archive data (archiveYoung and
archiveOld) was not being persisted to IndexedDB. This caused archived
tasks to be lost after page reload.

Root cause: ArchiveOperationHandler._handleLoadAllData() returns early
for local imports (isRemote=false), expecting the archive to be written
by the backup import flow - but this code never existed.

Fix: Add _writeArchivesToIndexedDB() to BackupService.importCompleteBackup()
that explicitly writes archive data to IndexedDB after dispatching the
loadAllData action.

- Add ArchiveDbAdapter injection to BackupService
- Add _writeArchivesToIndexedDB() private method
- Update misleading comment in ArchiveOperationHandler
- Add unit tests for archive persistence (7 tests)
- Add E2E tests for archive import persistence (3 tests)
- Add test fixture with archive data
2026-01-08 16:12:13 +01:00

370 lines
10 KiB
JSON

{
"timestamp": 1733000000000,
"lastUpdate": 1733000000000,
"crossModelVersion": 4.5,
"data": {
"project": {
"ids": ["INBOX_PROJECT"],
"entities": {
"INBOX_PROJECT": {
"id": "INBOX_PROJECT",
"title": "Inbox",
"isHiddenFromMenu": false,
"taskIds": ["active-task-1"],
"backlogTaskIds": [],
"noteIds": [],
"theme": {
"primary": "#607d8b",
"accent": "#ff4081",
"warn": "#e91e63",
"isAutoContrast": true
},
"icon": "inbox",
"workStart": {},
"workEnd": {},
"breakNr": {},
"breakTime": {},
"isArchived": false,
"advancedCfg": {
"worklogExportSettings": {
"cols": ["DATE", "START", "END", "TIME_CLOCK", "TITLES_INCLUDING_SUB"],
"roundWorkTimeTo": null,
"roundStartTimeTo": null,
"roundEndTimeTo": null,
"groupBy": "DATE",
"separateTasksBy": ""
}
}
}
}
},
"menuTree": {
"tagTree": [],
"projectTree": []
},
"globalConfig": {
"misc": {
"isConfirmBeforeExit": false,
"isConfirmBeforeExitWithoutFinishDay": true,
"isNotifyWhenTimeEstimateExceeded": false,
"isAutMarkParentAsDone": true,
"isAutoStartNextTask": true,
"isTurnOffMarkdown": false,
"isAutoAddWorkedOnToToday": true,
"isDisableInitialDialog": true,
"firstDayOfWeek": 1,
"startOfNextDay": 0,
"daysToShowForPastDates": 14,
"isMinimizeToTray": false,
"isEnableAdvanced": false,
"isTrayShowCurrentTask": true,
"taskNotesTpl": "",
"isDisableAnimations": false
},
"appFeatures": {
"isTimeTrackingEnabled": true,
"isFocusModeEnabled": true,
"isSchedulerEnabled": true,
"isPlannerEnabled": true,
"isBoardsEnabled": true,
"isScheduleDayPanelEnabled": true,
"isIssuesPanelEnabled": true,
"isProjectNotesEnabled": true,
"isSyncIconEnabled": true,
"isDonatePageEnabled": true,
"isEnableUserProfiles": false
},
"localization": {},
"evaluation": {
"isHideEvaluationSheet": false
},
"idle": {
"isEnableIdleTimeTracking": false,
"isUnTrackedIdleResetsBreakTimer": false,
"minIdleTime": 60000,
"isOnlyOpenIdleWhenCurrentTask": false
},
"takeABreak": {
"isTakeABreakEnabled": false,
"takeABreakMinWorkingTime": 60,
"takeABreakSnoozeTime": 15,
"motivationalImgs": [],
"isLockScreen": false,
"isTimedFullScreenBlocker": false,
"timedFullScreenBlockerDuration": 8000,
"isFocusWindow": false,
"takeABreakMessage": "Take a break!"
},
"pomodoro": {
"isEnabled": false,
"duration": 1500000,
"breakDuration": 300000,
"longerBreakDuration": 900000,
"cyclesBeforeLongerBreak": 4,
"isStopTrackingOnBreak": true,
"isStopTrackingOnLongBreak": true,
"isManualContinue": false,
"isPlaySound": true,
"isPlaySoundAfterBreak": false,
"isEnabled2": false
},
"keyboard": {},
"localBackup": {
"isEnabled": false
},
"lang": {},
"sync": {
"isEnabled": false,
"isCompressionEnabled": true,
"syncInterval": 0,
"isEncryptionEnabled": false,
"syncProvider": null
},
"timeline": {
"isWorkStartEndEnabled": false,
"workStart": "9:00",
"workEnd": "17:00"
},
"reminder": {
"isCountdownBannerEnabled": true,
"countdownDuration": 600000
},
"focusMode": {
"isAlwaysUseFocusMode": false,
"isSkipPreparation": false
},
"sound": {
"volume": 70,
"isPlayDoneSound": true,
"doneSound": "done2.mp3",
"isPlayTickSound": false,
"isIncreaseDoneSoundPitch": true,
"breakReminderSound": null
},
"timeTracking": {
"trackingInterval": 1000,
"defaultEstimate": 0,
"defaultEstimateSubTasks": 0,
"isNotifyWhenTimeEstimateExceeded": true,
"isAutoStartNextTask": false,
"isTrackingReminderEnabled": false,
"isTrackingReminderShowOnMobile": false,
"trackingReminderMinTime": 300000
},
"quickNotes": {},
"dominaMode": {
"isEnabled": false,
"text": "Your current task is: ${currentTaskTitle}",
"interval": 300000,
"volume": 75
},
"shortSyntax": {
"isEnableProject": true,
"isEnableDue": true,
"isEnableTag": true
},
"schedule": {
"isWorkStartEndEnabled": true,
"workStart": "9:00",
"workEnd": "17:00",
"isLunchBreakEnabled": false,
"lunchBreakStart": "13:00",
"lunchBreakEnd": "14:00"
}
},
"task": {
"ids": ["active-task-1"],
"entities": {
"active-task-1": {
"id": "active-task-1",
"title": "E2E Archive Import - Active Task",
"subTaskIds": [],
"timeSpentOnDay": {},
"timeSpent": 0,
"timeEstimate": 3600000,
"isDone": false,
"notes": "",
"tagIds": [],
"created": 1733000000000,
"attachments": [],
"projectId": "INBOX_PROJECT"
}
},
"currentTaskId": null,
"selectedTaskId": null,
"lastCurrentTaskId": null,
"isDataLoaded": false
},
"tag": {
"ids": ["TODAY"],
"entities": {
"TODAY": {
"id": "TODAY",
"title": "Today",
"taskIds": [],
"icon": "wb_sunny",
"created": 1733000000000,
"theme": {
"primary": "#ffa726",
"accent": "#ff4081",
"warn": "#e91e63",
"isAutoContrast": true
},
"workStart": {},
"workEnd": {},
"breakNr": {},
"breakTime": {},
"advancedCfg": {
"worklogExportSettings": {
"cols": ["DATE", "START", "END", "TIME_CLOCK", "TITLES_INCLUDING_SUB"],
"roundWorkTimeTo": null,
"roundStartTimeTo": null,
"roundEndTimeTo": null,
"groupBy": "DATE",
"separateTasksBy": ""
}
}
}
}
},
"simpleCounter": {
"ids": [],
"entities": {}
},
"taskRepeatCfg": {
"ids": [],
"entities": {}
},
"reminders": [],
"note": {
"ids": [],
"entities": {},
"todayOrder": []
},
"metric": {
"ids": [],
"entities": {}
},
"planner": {
"days": {}
},
"issueProvider": {
"ids": [],
"entities": {}
},
"boards": {
"boardCfgs": []
},
"timeTracking": {
"project": {
"INBOX_PROJECT": {
"2024-11-25": {
"s": 32400000,
"e": 61200000
},
"2024-11-26": {
"s": 32400000,
"e": 61200000
}
}
},
"tag": {}
},
"archiveYoung": {
"task": {
"ids": ["archived-young-task-1", "archived-young-task-2"],
"entities": {
"archived-young-task-1": {
"id": "archived-young-task-1",
"title": "E2E Archive Import - Young Archived Task 1",
"subTaskIds": [],
"timeSpentOnDay": {
"2024-11-25": 3600000,
"2024-11-26": 1800000
},
"timeSpent": 5400000,
"timeEstimate": 3600000,
"isDone": true,
"doneOn": 1732665600000,
"notes": "This task was completed and archived recently",
"tagIds": [],
"created": 1732492800000,
"attachments": [],
"projectId": "INBOX_PROJECT"
},
"archived-young-task-2": {
"id": "archived-young-task-2",
"title": "E2E Archive Import - Young Archived Task 2",
"subTaskIds": [],
"timeSpentOnDay": {
"2024-11-26": 7200000
},
"timeSpent": 7200000,
"timeEstimate": 7200000,
"isDone": true,
"doneOn": 1732752000000,
"notes": "Another recently archived task",
"tagIds": [],
"created": 1732579200000,
"attachments": [],
"projectId": "INBOX_PROJECT"
}
}
},
"timeTracking": {
"project": {
"INBOX_PROJECT": {
"2024-11-25": {
"s": 32400000,
"e": 61200000
},
"2024-11-26": {
"s": 32400000,
"e": 64800000
}
}
},
"tag": {}
},
"lastTimeTrackingFlush": 1732752000000
},
"archiveOld": {
"task": {
"ids": ["archived-old-task-1"],
"entities": {
"archived-old-task-1": {
"id": "archived-old-task-1",
"title": "E2E Archive Import - Old Archived Task",
"subTaskIds": [],
"timeSpentOnDay": {
"2024-10-15": 3600000
},
"timeSpent": 3600000,
"timeEstimate": 3600000,
"isDone": true,
"doneOn": 1729036800000,
"notes": "This task was archived more than 21 days ago",
"tagIds": [],
"created": 1728950400000,
"attachments": [],
"projectId": "INBOX_PROJECT"
}
}
},
"timeTracking": {
"project": {
"INBOX_PROJECT": {
"2024-10-15": {
"s": 32400000,
"e": 50400000
}
}
},
"tag": {}
},
"lastTimeTrackingFlush": 1729036800000
},
"pluginMetadata": [],
"pluginUserData": []
}
}