Skip to content

Honour the export and delete promises for everything the app now stores - #189

Merged
mapgie merged 2 commits into
mainfrom
claude/export-delete-completeness
Sep 8, 2026
Merged

Honour the export and delete promises for everything the app now stores#189
mapgie merged 2 commits into
mainfrom
claude/export-delete-completeness

Conversation

@mapgie

@mapgie mapgie commented Sep 8, 2026

Copy link
Copy Markdown
Owner

The in-app promises are explicit: the privacy disclaimer says you can "export a copy of all your data" and delete everything via Settings, Data, Delete All Data; the backup dialog says a full backup is for "transferring to a new phone". An audit of the export builder, the importer, and the delete paths against the current schema (post logging redesign) and the full preferences list found gaps on all three surfaces. This PR closes them.

What was broken

Export/restore lost data

  • The groups table (added in the redesign) was never exported: a restore lost all grouping and group membership, and any category set to inherit its group's colour rendered neutral grey afterwards.
  • loggedAt was not exported and the importer called saveLog with defaults, so time-tracked history lost every timestamp and a day with several allow-multiple entries collapsed to its last entry.
  • Colour profiles dropped their lightBackgroundArgb/darkBackgroundArgb columns.
  • Seven settings were missing from the backup, including the period gap tolerance (which shapes episode derivation on import), period tracking on/off, and custom theme backgrounds/name.

Deletion left data behind

  • User-named groups (names like "Pain" can be sensitive) survived both "Delete All Data" and "Reset category settings".
  • The saved pregnancy date survived "Delete All Data".
  • Exported JSON files accumulated in the app cache indefinitely: the filename embeds the date, so the code's "overwritten on every export" comment was only true within a single day.

What changed

  • Full backup format v4 to v5: adds a groups array and a per-category groupName (name-matched on import, since row ids change across a restore; backups without the key leave existing filing untouched), per-log loggedAt, colour-profile background columns, and the missing settings. Old backups still import; old app versions ignore the new keys.
  • Importer: new importGroups (replace mode clears groups first, never their member categories) runs before category config; log import now passes allowMultiple and loggedAt through to saveLog; periodGapToleranceDays is range-validated (0..3) before applying.
  • Deletion: "Reset category settings" also deletes groups (members unfiled first; two additive DAO queries). "Delete All Data" also clears the pregnancy date and the export cache, and its dialog says so.
  • Export cache: every export clears the directory before writing, and DataExporter.clearExportCache is shared with the delete path.
  • Copy: backup description now mentions groups; both delete dialogs updated to match behaviour; fixed three pre-existing en/em dashes in user-facing strings in the touched dialogs (custom range separator, Merge/Replace descriptions).

Verification

  • a11y_check.py clean, wcag_check.py passes, semantics-import sweep clean, changelog fragment validates (minor).
  • Every new symbol call checked against its declaration (setter signatures, saveLog's allowMultiple/loggedAt parameters, ColorProfile constructor, group repository methods).
  • LESSONS.md records the transferable lesson: a "keep this in sync" comment on the delete method did not survive the next table; schema/preference PRs need an explicit export/import/delete sweep.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PZJLynVBkgLtehJFXffnfg


Generated by Claude Code

The disclaimer promises "export a copy of all your data" and deletion via
Delete All Data, and the backup dialog promises phone-transfer fidelity.
An audit against the current schema and preferences found gaps on all
three surfaces (export, import, delete); this closes them.

Export (full backup v4 to v5):
- Groups exported (name, colorRole, defaultInputType, in display order)
  plus a per-category groupName, matched by name on import since row ids
  change across a restore. Without this, restores lost all grouping and
  turned inherit-coloured categories neutral.
- Per-log loggedAt exported so time-tracked history keeps its times.
- Colour profiles now carry lightBackgroundArgb/darkBackgroundArgb.
- Settings now carry customLight/DarkBackgroundArgb, customThemeName,
  periodTrackingEnabled, periodGapToleranceDays (validated 0..3 on
  import), dailyCheckEnabled, and flowLevelRestoreDone.

Import:
- New importGroups (replace mode clears existing groups first, never
  their member categories) runs before category config; categories are
  filed via the exported groupName; backups without the key leave
  existing filing untouched.
- Log import passes the category's allowMultiple and the exported
  loggedAt to saveLog. Previously a day with several entries collapsed
  to its last entry and every timestamp was dropped on restore.

Delete:
- Reset category settings also deletes groups (user-entered group names
  can be sensitive), unfiling members first; new additive DAO queries
  clearAllGroupAssignments and deleteAllGroups.
- Delete All Data also clears the saved pregnancy date and the cached
  export files, and the dialog copy now says so.
- Export cache no longer accumulates: date-stamped files meant the old
  "overwritten every export" comment was wrong, so each export clears
  the directory first and clearExportCache is shared with delete.

Copy: full-backup description mentions groups; fixed pre-existing en/em
dashes in the custom range separator and the Merge/Replace dialog text.
LESSONS.md gains the transferable lesson; subsystem map 02 updated.

Claude-Session: https://claude.ai/code/session_01PZJLynVBkgLtehJFXffnfg

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PZJLynVBkgLtehJFXffnfg
@mapgie
mapgie marked this pull request as ready for review September 8, 2026 18:56
@mapgie
mapgie merged commit f3618a2 into main Sep 8, 2026
4 checks passed
@mapgie
mapgie deleted the claude/export-delete-completeness branch September 8, 2026 19:26
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.

2 participants