You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: select and bulk delete backups, and keep them by count, size or age - #22
Backups piled up with no way to clean them up except one Delete at a time, and the server always kept a hardcoded 10. Now you can select backups and delete them together, and set a retention rule per server: keep the last N, up to X GB in total, up to N days old. Past any limit the oldest BeaconSync backups go first and the newest always stays. Backups written by mods like FTB Backups are left to the mod.
The rule lives on the server in .beacon/backup-retention.json. It's left out of backups, so restoring an old backup doesn't bring back an old rule. It applies after every new backup, when the agent starts and when it's saved. The default is the old "last 10", so nothing changes until you set one.
Saving a rule that would delete backups asks first ("Delete 5 backups now? 3.6 GB"). Invalid limits get a red border; the hub also rejects zero limits.
CLI: beacon server backups keep --last 5 --max-gb 5 --max-days 10, and beacon server backups shows the current rule.
Older agents can't read the new action, so the app only shows the retention row once the server reports a rule, and the hub refuses it otherwise. The hub keeps this in memory, so it now asks the agent to send its backups and rule again after a hub restart (before, the backup list stayed empty until the server's next action).
Deploy order: the hub at beaconsync.realdoc06.it needs this build before the app can save rules; servers pick it up with "Update beacon".
Tested end to end in the dev app against a local hub and a local agent (not production): bulk deleting 2 rows removed exactly those 2 archives; saving 2 GB / 5 days asked to delete 3 and the agent pruned exactly those 3; restarting the hub brought the backup list and rule back in about 40 s without touching the agent. New tests cover the pruning rule, the rule surviving a restore, and the hub's old-agent, zero-limit and resync handling.
Screenshots (Backups tab, macOS dev app)
Before
After
Selected
Bulk delete
Rule would delete backups
After saving 2 GB / 5 days
Council review
Rounds: 4
Delegate
Round 1
Round 2
Round 3
Round 4
Claude Opus
8.5/10
9/10
9.5/10
9.5/10
Muse Wonder
8/10
9/10
9/10
10/10
Created with Claude Opus 5.5 in Claude Code (T3 Code). Reviewed by Claude Opus 5.5 and Muse Wonder 1.0.
Summary by CodeRabbit
New Features
Configure server backup retention by count, total size, or age in the app or CLI. Retention changes can prune older backups, while the newest backup is kept.
Select and delete multiple backups, with selected backup count and total size shown in the app.
Backup listings show the configured retention policy when available.
Documentation
Added guidance and examples for setting backup retention limits.
The pull request adds per-server backup retention limits by count, total size, or age. It stores and applies those limits on the server, relays retention state through the hub, and adds configuration controls to the CLI and desktop app.
Changes: Backup retention
Layer / File(s)
Summary
Retention contract and hub relay crates/core/src/api.rs, crates/hub/src/routes.rs, crates/hub/src/tests.rs, apps/desktop/src/lib/types.ts
The API adds retention data and actions. The hub reports agent state, requests resynchronization when backups have not been reported, and validates retention actions. Tests cover resynchronization and retention action relaying.
Persisted rules and backup pruning crates/cli/src/backups.rs, crates/cli/src/server.rs
The CLI stores retention rules separately from backups and prunes according to count, size, and age limits. Startup pruning and tests cover configured limits, immediate pruning, and restore behavior.
CLI configuration and agent synchronization crates/cli/src/server.rs, crates/cli/src/tui.rs, README.md, docs/ARCHITECTURE.md
The CLI adds the keep command and handles retention actions. Agent state reports retention, polling can trigger a state resync, and backup listings show the configured policy. The documentation describes the command and retention behavior.
Desktop backup and retention controls apps/desktop/src/lib/types.ts, apps/desktop/src/views/pack/ServerPanel.tsx
The desktop app receives retention data, supports selecting and deleting multiple backups, and adds a validated retention editor with confirmation when proposed limits would prune backups.
sequenceDiagram
participant BackupCmd
participant Hub
participant AgentLoop
participant BackupStore
BackupCmd->>Hub: Send SetRetention action
Hub->>AgentLoop: Deliver queued action during polling
AgentLoop->>BackupStore: Save rule and prune backups
Loading
Possibly related PRs
RealDoc06/beaconsync#1: Adds the agent update path that the pull request describes for rolling out agent builds to existing servers.
Merge Risk: Moderate · up to 30d56
Backup retention can occasionally delete the wrong backup, such as the newest one when two finish in the same second. Pruning failures are also not reported, and the app can show an outdated retention rule after a failed upload. These edge cases involve deleting backups, so they should be fixed or consciously accepted before merge.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backups piled up with no way to clean them up except one Delete at a time, and the server always kept a hardcoded 10. Now you can select backups and delete them together, and set a retention rule per server: keep the last N, up to X GB in total, up to N days old. Past any limit the oldest BeaconSync backups go first and the newest always stays. Backups written by mods like FTB Backups are left to the mod.
.beacon/backup-retention.json. It's left out of backups, so restoring an old backup doesn't bring back an old rule. It applies after every new backup, when the agent starts and when it's saved. The default is the old "last 10", so nothing changes until you set one.beacon server backups keep --last 5 --max-gb 5 --max-days 10, andbeacon server backupsshows the current rule.Tested end to end in the dev app against a local hub and a local agent (not production): bulk deleting 2 rows removed exactly those 2 archives; saving 2 GB / 5 days asked to delete 3 and the agent pruned exactly those 3; restarting the hub brought the backup list and rule back in about 40 s without touching the agent. New tests cover the pruning rule, the rule surviving a restore, and the hub's old-agent, zero-limit and resync handling.
Screenshots (Backups tab, macOS dev app)
Council review
Rounds: 4
Created with Claude Opus 5.5 in Claude Code (T3 Code). Reviewed by Claude Opus 5.5 and Muse Wonder 1.0.
Summary by CodeRabbit
New Features
Documentation