Skip to content

feat: backup and trust - export/import with preview, typed delete, reminder (UX-12) - #216

Merged
bri-b-dev merged 2 commits into
mainfrom
b/backup-trust
Oct 11, 2026
Merged

bri-b-dev merged 2 commits into
mainfrom
b/backup-trust

Conversation

@bri-b-dev

Copy link
Copy Markdown
Owner

Summary

  • Daten & Backup panel in the settings: "Deine Daten liegen nur auf diesem Gerät", what is stored ("312 Sessions, 12 Runden, 3 Sammlungen - über 14 Monate"), last backup, export, import, replay introduction, delete everything
  • Backup file (v2, src/backup) now contains rounds and course templates (IndexedDB), achievements and focus points as well - the old export missed rounds, templates and achievements, and "reset" did not delete the rounds. Version 1 files are still read (marked as an older backup); every section is cleaned with the stores' own sanitizers, unusable entries become warnings. Format documented in docs/DATA_MODEL.md
  • Import dialog with preview: what is in the file (counts, date, app version, warnings), Zusammenführen (default: device data stays, new entries come in - shows "1 Session, 1 Runde kommen neu dazu", repeatable: importing the same file twice adds nothing) or Ersetzen (shows what will be lost, asks again, optional safety backup of the current data first; no backup -> no replacing). Broken, foreign and too-new files are refused with a plain message and nothing is touched
  • Delete everything needs the typed word LÖSCHEN, lists what goes, offers "Zuerst Backup exportieren" inside the dialog and now also clears the rounds/templates and the reminder bookkeeping. ConfirmModal gained title, danger style, typed phrase, details and a secondary action (plain confirmations behave as before)
  • Backup reminder on Heute: first backup once there are 5 entries, then after 10 new sessions/rounds or after 30 days with changes; "Später" snoozes for 7 days; "Jetzt sichern" exports directly
  • Export moved out of the settings sheet (src/backup/download.ts: web download or native share sheet; bookkeeping is only written after the file was handed over)

Acceptance

Export -> delete -> import restores the identical state: tests/backup/roundtrip.test.ts goes through a real file (JSON text), clearAllData, then applyData('replace') and compares everything (settings, favorites, sessions with notes/timer/focus, HCP history, collections, focus, achievements, rounds incl. course data, course templates) with toEqual.

Also fixed

  • Test isolation: the persistence adapter's debounced writes from one test could land in the next test's storage (flaky counts); cancelAllPendingWrites() runs after every test. The suite was run 5 times in a row green

Numbers

Start chunk 150.8 KB, tests 452 -> 491, lint 0 errors; axe now also audits the import dialog, the typed-delete dialog and the reminder.

Test plan

  • npm test (491, 5 repeated runs), npm run lint, npm run typecheck, npm run build (local)
  • CI
  • Manual (web): export, delete everything (typed word), import the file (merge and replace), reminder on Heute after 5+ sessions
  • Manual (Android): export opens the share sheet and the file can be saved/sent; import via the file picker; handicap rounds are back in /handicap
  • A backup made with the previous app version imports (marked "Ältere Sicherung")

🤖 Generated with Claude Code

bri-b-dev and others added 2 commits October 11, 2026 11:18
…minder (UX-12)

- DataPanel in the settings: "data only on this device" note, what is stored, last backup, export,
  import, replay introduction, delete everything
- versioned backup file (src/backup): now includes rounds and course templates (IndexedDB), achievements
  and focus; version 1 files are still read; sections are cleaned, unusable entries become warnings
- ImportDialog: preview, merge (default, repeatable) or replace (confirmation, shows what is lost,
  optional safety backup); broken, foreign or too new files get plain messages
- delete everything needs the typed word LÖSCHEN and offers a backup first; it now also clears the rounds
- ConfirmModal/service: title, danger, typed phrase, details, secondary action
- backup reminder on Today (5 entries, 10 new entries, 30 days; "Später" = 7 days)
- test: export -> delete -> import restores the identical state; merge/replace/reminder/UI tests
- test infra: debounced store writes no longer leak between tests
- tests (491)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@bri-b-dev
bri-b-dev merged commit 4deb565 into main Oct 11, 2026
1 check passed
@bri-b-dev
bri-b-dev deleted the b/backup-trust branch October 11, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant