feat(history): add automatic transcription history clearing (#463)#504
feat(history): add automatic transcription history clearing (#463)#504devzahirul wants to merge 4 commits into
Conversation
…v#463) Adds an 'Automatically Clear History' retention setting with Never, End of Day, After 7 Days, After 30 Days, and After 90 Days options. Expired entries and their saved audio are pruned at store load, before each new entry, at midnight via NSCalendarDayChanged, and immediately (behind a confirmation alert) when the user tightens the interval. Cutoffs are anchored to start-of-day so a retained day never partially expires.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49c4977e9d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Adds historyAutoClearInterval to SettingsBackupPayload as an optional field so restoring a backup preserves the retention policy instead of silently falling back to Never. Older backups without the key decode as nil and leave the current setting untouched.
|
@devzahirul Can you update the PR description to match the current accepted format: https://github.com/altic-dev/FluidVoice/blob/main/.github/pull_request_template.md |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e8405ff33
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| self.audioHistoryBudgetGB = audioHistoryBudgetGB | ||
| } | ||
| if let historyAutoClearInterval = payload.historyAutoClearInterval { | ||
| self.historyAutoClearInterval = historyAutoClearInterval |
There was a problem hiding this comment.
Prune restored history after applying retention settings
When a backup carries a non-never interval, this restores the retention policy before BackupService.restore loads document.transcriptionHistory (BackupService.swift:169), and TranscriptionHistoryStore.restore(from:) only sorts and saves the payload without calling pruneExpiredEntries(). Importing a backup can therefore immediately expose entries older than the selected window, including saved audio, until the next day-change/new dictation/app relaunch; apply the cutoff after restoring the history payload.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 2f43c35 — TranscriptionHistoryStore.restore(from:) now calls pruneExpiredEntries() after saving the restored payload, so a backup carrying a non-never interval prunes expired entries (and their saved audio) immediately on import instead of waiting for the next dictation, day change, or relaunch. Settings are restored before history in BackupService.restore, so the cutoff already reflects the imported policy at that point. Lint and the full test suite pass.
|
@grohith327 Done — the description now follows the template, with screenshots of the new settings row in the Screenshots section. Also resolved the merge conflict with main and addressed the latest Codex review comment in the meantime. |
Description
Adds an Automatically Clear History setting so users who dictate sensitive content don't have to remember to clear transcription history manually. Options: Never (default, current behavior), End of Day, After 7 Days, After 30 Days, After 90 Days.
Implemented as retention-based pruning rather than a scheduled wipe (the app can't rely on being awake at a scheduled moment): entries older than the selected window are deleted at store load, before each new entry is added, at midnight while running (via
NSCalendarDayChanged), and immediately when the user tightens the interval. Cutoffs are anchored tostartOfDay, so a retained day never partially expires ("After 7 Days" keeps 7 full calendar days plus today). Pruned entries also delete their saved dictation audio viaDictationAudioHistoryStore, and the sidebar selection is repaired if the selected entry expires.Changes:
SettingsStore— newHistoryAutoClearIntervalenum (display name, help text,cutoffDate) and persistedhistoryAutoClearIntervalsetting, included in backup export/restore as an optionalSettingsBackupPayloadfield.TranscriptionHistoryStore— newpruneExpiredEntries(); called frominit,addEntry, and a calendar-day-change observer.SettingsView— picker row under the history toggles. If changing the setting would immediately delete existing entries, a confirmation alert (matching the existing audio-budget prune flow) states how many entries are affected; Cancel leaves the setting untouched. The row is disabled while Save Transcription History is off.HistoryAutoClearIntervalTests: no-cutoff case, end-of-day boundary (today survives, yesterday expires), start-of-day anchoring for the rolling windows, and raw-value fallback.Default is Never, so there is zero behavior change unless the user opts in; unknown persisted values fall back to Never.
Type of Change
Related Issue or Discussion
Closes #463
Testing
swiftlint --strict --config .swiftlint.yml Sources— 0 violationsswiftformat --config .swiftformat Sources— code added by this PR is clean (the only lint hit in touched files is pre-existing code atSettingsStore.swift:3466)xcodebuild test(Fluid scheme), including the 5 new testsScreenshots / Video
The new Automatically Clear History row in Settings, below the existing history toggles. The help text updates with the selected interval:
Never (default):
After 90 Days:
Notes
niland leave the current setting untouched, matching the existing pattern foraudioHistoryBudgetGBandnotifyAIProcessingFailures.