fix: Implement tiered backup retention classification (refs #6) #21

Merged
egullickson merged 1 commits from issue-6-tiered-backup-retention into main 2026-01-11 04:07:27 +00:00
Owner

Summary

  • Implement tiered backup retention classification to fix backups being deleted prematurely
  • Backups are now classified by timestamp into categories (hourly/daily/weekly/monthly)
  • A backup can belong to multiple categories and is only deleted when ALL quotas are exceeded
  • Add Expires column to desktop and mobile backup UI

Changes

Backend:

  • Add backup-classification.service.ts with pure classification functions
  • Rewrite backup-retention.service.ts with tiered logic
  • Add migration for categories and expires_at columns
  • Add 22 unit tests for classification logic

Frontend:

  • Add Expires column to desktop backup table
  • Add Expires display to mobile backup cards

Retention Logic

Category Qualification Retention
hourly All backups 8
daily Midnight UTC 7
weekly Sunday midnight UTC 4
monthly 1st of month midnight UTC 12

Test plan

  • Type-check passes (backend + frontend)
  • 22 unit tests pass for classification logic
  • Quality agent review: APPROVED
  • Manual test: Create backup and verify categories/expiration assigned
  • Manual test: Verify Expires column displays on desktop
  • Manual test: Verify Expires displays on mobile

Closes #6

🤖 Generated with Claude Code

## Summary - Implement tiered backup retention classification to fix backups being deleted prematurely - Backups are now classified by timestamp into categories (hourly/daily/weekly/monthly) - A backup can belong to multiple categories and is only deleted when ALL quotas are exceeded - Add Expires column to desktop and mobile backup UI ## Changes **Backend:** - Add `backup-classification.service.ts` with pure classification functions - Rewrite `backup-retention.service.ts` with tiered logic - Add migration for `categories` and `expires_at` columns - Add 22 unit tests for classification logic **Frontend:** - Add Expires column to desktop backup table - Add Expires display to mobile backup cards ## Retention Logic | Category | Qualification | Retention | |----------|--------------|-----------| | hourly | All backups | 8 | | daily | Midnight UTC | 7 | | weekly | Sunday midnight UTC | 4 | | monthly | 1st of month midnight UTC | 12 | ## Test plan - [x] Type-check passes (backend + frontend) - [x] 22 unit tests pass for classification logic - [x] Quality agent review: APPROVED - [ ] Manual test: Create backup and verify categories/expiration assigned - [ ] Manual test: Verify Expires column displays on desktop - [ ] Manual test: Verify Expires displays on mobile Closes #6 🤖 Generated with [Claude Code](https://claude.com/claude-code)
egullickson added 1 commit 2026-01-11 03:57:38 +00:00
fix: Implement tiered backup retention classification (refs #6)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 6m15s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 28s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 6s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
19ece562ed
Replace per-schedule count-based retention with unified tiered classification.
Backups are now classified by timestamp into categories (hourly/daily/weekly/monthly)
and are only deleted when they exceed ALL applicable category quotas.

Changes:
- Add backup-classification.service.ts for timestamp-based classification
- Rewrite backup-retention.service.ts with tiered logic
- Add categories and expires_at columns to backup_history
- Add Expires column to desktop and mobile backup UI
- Add unit tests for classification logic (22 tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson merged commit 8c7de98a9a into main 2026-01-11 04:07:27 +00:00
egullickson deleted branch issue-6-tiered-backup-retention 2026-01-11 04:07:27 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#21