Data loss: No backup before import — importAllData destroys data with no rollback #8
Labels
No labels
blocked:depends-p1
blocked:gate-research
blocked:lint-failed
blocked:needs-decision
blocked:needs-human
blocked:verify-failed
bug
data-loss
documentation
enhancement
feature-request
in-progress
needs-decompose
needs-triage
pwa
quickfix
security
security/high
security/medium
test
test-coverage
triage-approved
vault
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/kimi_agent_kin_app_sync#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: HIGH (data loss)
Location
src/lib/db.ts:273-298—importAllData()functionDescription
Before importing,
importAllData()immediately clears ALL IndexedDB tables, then bulk-adds the new data. There is no snapshot, no backup, no rollback:Impact
.clear()runs, old data is gone even if the import fails mid-waybulkAdd()fails partway through (disk full, corrupted JSON), some tables are empty while others have partial dataRecommendation
Before clearing, serialize the full DB state as a backup. On failure or cancellation, restore from the snapshot. Dexie supports this pattern natively via transaction rollback — but only if the validation happens before the clear.
Code context
src/lib/db.ts:273-298— entire importAllData functionFixed in commit. Closing.