Skip to content

feat: Implement Speech History Auto-Pruning / Retention Policy - #1162

Merged
itzzavdhesh merged 3 commits into
itzzavdhesh:mainfrom
Kritika200520:feat/speech-history-retention
Aug 12, 2026
Merged

feat: Implement Speech History Auto-Pruning / Retention Policy#1162
itzzavdhesh merged 3 commits into
itzzavdhesh:mainfrom
Kritika200520:feat/speech-history-retention

Conversation

@Kritika200520

@Kritika200520 Kritika200520 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

🚀 Program

GSSoC

📝 Description

Implement a Speech History Retention Policy setting that automatically prunes older synthesized messages from local storage after a user-defined period (7 days, 30 days, or on session close), while exempting pinned/favorite messages.

🔗 Related Issue

Closes #764

🔄 Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🔍 SEO improvement
  • 🎨 Style / UI improvement
  • ♿ Accessibility improvement
  • 📝 Documentation
  • ⚙️ CI / configuration
  • 🧹 Refactor / cleanup

🧪 How to Test

  1. Start the local server.
  2. Open Settings, navigate to the new Privacy & Retention card, and change the history retention policy.
  3. Verify that old items are pruned on mount according to the policy (7 or 30 days), and that favorite/pinned items are correctly preserved.
  4. Set the policy to "Clear on session close" and verify that closing/reopening the tab removes non-pinned items.
  5. Alternatively, run the new unit test suite using npm run test -w client.

✅ Checklist

  • I am contributing under GSSoC, NSOC, SSOC, or ELUSOC
  • My code follows the project's existing style
  • I have tested my changes in a browser
  • I have linked the related issue above
  • My PR title follows Conventional Commits format (e.g. feat: Implement Speech History Auto-Pruning / Retention Policy)

Summary by cubic

Implements a speech history retention policy with auto‑pruning to limit local storage growth. Previously history persisted indefinitely; now users can keep it forever, for 7 or 30 days, or clear it on session close. Pinned/favorite items are always preserved.

  • Adds a “Privacy & Retention” setting in Settings that writes vf_history_retention, shows a toast, and dispatches voiceforge:retentionPolicyChanged.
  • On load, useSpeechHistory prunes via pruneHistory; for the “session” policy it clears non‑pinned items at new session start (tracked by vf_session_active) and on tab close (beforeunload).
  • Extracts pruneHistory utility with unit tests; tests also cover favorite handling utilities.
  • Retention policy is included in backup/restore so imports reapply the selected policy.
  • No migration required; existing history remains unless a non‑forever policy is selected.

Written for commit d3e7333. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added Privacy & Retention settings for controlling how long speech history is stored.
    • Added retention options for session-only, 7-day, 30-day, or indefinite storage.
    • Favorites are preserved when older history is automatically removed.
    • History retention settings are included in exported and imported backups.
    • Added feedback notifications when retention settings change.
  • Bug Fixes

    • History now updates correctly when retention preferences change.
    • Session-only history is cleared when starting a new session.

@vercel

vercel Bot commented Jul 26, 2026

Copy link
Copy Markdown

@Kritika200520 is attempting to deploy a commit to the itzzavdhesh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown

✍️ DCO Sign-off Needed

Hey @Kritika200520! 👋 One or more commits in this PR are missing a Signed-off-by: line.

Warning

  • efd0a1d feat: Implement Speech History Auto-Pruning / Retention Policy
  • 733df79 Merge branch 'origin/main' into feat/speech-history-retention
  • d3e7333 Merge branch 'main' into feat/speech-history-retention

How to fix:

For the latest commit:

git commit --amend --signoff
git push --force-with-lease

For multiple commits, replace N with the number to update:

git rebase --signoff HEAD~N
git push --force-with-lease

This comment will update automatically after you push.


🤖 VoiceForge Automation · Updates automatically on edits

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@itzzavdhesh, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 54 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c2e6f72-9482-464b-9e3c-ba0940af5fea

📥 Commits

Reviewing files that changed from the base of the PR and between 733df79 and d3e7333.

📒 Files selected for processing (3)
  • client/src/hooks/useSpeechHistory.js
  • client/src/hooks/useSpeechHistory.test.js
  • client/src/pages/Settings.jsx
📝 Walkthrough

Walkthrough

Adds configurable speech-history retention for forever, session, 7-day, and 30-day policies. The implementation prunes history while preserving favorites, handles policy changes and session close, and includes backup import/export support and tests.

Changes

Speech history retention policy

Layer / File(s) Summary
Retention policy configuration
client/src/pages/Settings.jsx
Settings persist and display the retention policy. Backup export and import include the policy.
History pruning and initialization
client/src/hooks/useSpeechHistory.js
History initialization applies session and age-based pruning while preserving favorites.
Policy changes, session cleanup, and validation
client/src/hooks/useSpeechHistory.js, client/src/hooks/useSpeechHistory.test.js
Policy changes trigger pruning. Session close persists favorites only. Tests cover thresholds and favorite preservation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Settings
  participant LocalStorage
  participant useSpeechHistory
  participant pruneHistory

  Settings->>LocalStorage: Save retention policy
  Settings->>useSpeechHistory: Dispatch policy change
  useSpeechHistory->>LocalStorage: Read history and policy
  useSpeechHistory->>pruneHistory: Apply retention rules
  pruneHistory-->>useSpeechHistory: Return retained entries
  useSpeechHistory->>LocalStorage: Persist pruned history
Loading

Possibly related PRs

Suggested labels: type:feature, level:intermediate, quality:clean

Suggested reviewers: hrshjswniii, vivek0028, itzzavdhesh

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the speech history auto-pruning and retention policy feature.
Linked Issues check ✅ Passed The changes implement the linked issue requirements, including retention options, persistence, startup pruning, session cleanup, and favorite preservation [#764].
Out of Scope Changes check ✅ Passed The changes remain within scope and support the linked retention-policy objectives across settings, history handling, persistence, and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 26, 2026

Copy link
Copy Markdown

🎉 PR Ready for Mentor Review

Hey @Kritika200520! 👋 Your PR passed all checks and is now in the GSSoC review queue.

Note

🔗 Closing: #764 · 📐 486 lines across 3 file(s) · 📬 Already requested or no eligible reviewer found

@sabeenaviklar @Anushreebasics @itsdakshjain @snehkris @Mrigakshi-Rathore @Itzzavdheshh @Nitya-003 @4f4d @lovestaco, this PR is ready for your review — please confirm scope, check behavior and tests, then approve or request changes.

Important

This is not an approval. Please wait for mentor feedback before expecting a merge. If changes are requested, push them to this same branch and keep the PR focused on the linked issue.


🤖 VoiceForge Automation · Updates automatically on edits

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread client/src/hooks/useSpeechHistory.js
Comment thread client/src/pages/Settings.jsx
@itsdakshjain itsdakshjain added the mentor:itsdakshjain GSSoC: Mentor-@itsdakshjain label Jul 29, 2026

@sabeenaviklar sabeenaviklar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kritika200520 resolve merge conflicts

@itzzavdhesh
itzzavdhesh merged commit c44921f into itzzavdhesh:main Aug 12, 2026
6 of 8 checks passed
@github-actions

Copy link
Copy Markdown

🎊 PR Merged Successfully

Hey @Kritika200520! 👋 Congratulations and thank you for your contribution to VoiceForge!

Note

🔗 Linked issue(s): #764 · ✅ Marked as merged and complete

Maintainers may still handle final cleanup, release notes, or follow-up tracking after the merge.


🤖 VoiceForge Automation · Updates automatically on edits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Speech History Auto-Pruning / Retention Policy

5 participants