borg-backup-ui icon indicating copy to clipboard operation
borg-backup-ui copied to clipboard

Extend job retention policies and allow automatic prune to be disabled

Open borg-codex-bot opened this issue 3 months ago • 0 comments

Summary

Job retention is currently limited to daily, weekly, monthly, and yearly counts, and every successful backup automatically runs prune. There is no explicit way to keep every archive for a job or to disable automatic prune while continuing to create backups.

Extend the job-level retention model with useful Borg 1.4 retention controls and an explicit safe keep-all mode.

Current behavior

After borg create completes with exit code 0 or 1, the scriptless wizard runner always starts this maintenance sequence:

prune -> compact -> check

Prune is restricted to the job's archive prefix and uses the four configured retention tiers. The same job policy is used by manual prune under Repository Maintenance.

Entering 0 is not a keep-all mechanism. It means that the corresponding retention rule keeps nothing.

Goals

  • Add an explicit per-job mode for keeping all archives by skipping automatic prune.
  • Preserve the current pruning behavior for every existing job after upgrade.
  • Support additional Borg 1.4 retention controls that cover multiple backups per day without forcing users to disable pruning completely.
  • Keep automatic backup maintenance and manual Repository Maintenance consistent and safe.

Proposed model

Provide two clearly named modes:

  1. Managed retention

    • Automatic prune remains enabled.
    • Existing daily, weekly, monthly, and yearly tiers remain available.
    • Add advanced controls such as:
      • keep all archives within a recent interval (--keep-within),
      • hourly restore points (--keep-hourly),
      • a number of most recent archives (--keep-last).
    • Exact supported inputs must match the bundled Borg 1.4 runtime and be validated before save.
  2. Keep all archives (automatic prune disabled)

    • Successful backups do not run automatic prune for this job.
    • The UI clearly warns that repository usage will continue to grow.
    • This must be represented by an explicit policy field, not by overloading 0 or -1.

Maintenance behavior

The implementation must define the current combined maintenance sequence explicitly:

  • When automatic prune is disabled, borg create still runs normally.
  • Integrity-check scheduling must remain active and must not be disabled as a side effect.
  • Compact behavior must be decided explicitly because compact after a skipped prune normally has no retention deletions to reclaim.
  • Manual prune under Repositories must show the selected job and its effective policy.
  • A job configured to keep all archives must not be pruned silently through Repository Maintenance. The action should be disabled for that retention source or require an explicit, clearly described policy change before pruning.
  • Shared repositories must remain scoped to the selected job's archive filters so another job's archives are not affected.

Compatibility and migration

  • Existing jobs must migrate to Managed retention with their current values unchanged.
  • New fields must have backward-compatible defaults.
  • Legacy job metadata without the new mode must retain today's automatic-prune behavior.
  • Job import/export, support bundles, and configuration backup/restore must preserve the extended policy.
  • The immutable job identity work in #447 must be considered when choosing the persistent schema and references.

Acceptance criteria

  • A job can explicitly disable automatic prune and keep all matching archives.
  • Disabling prune does not disable scheduled repository integrity checks.
  • Existing jobs continue to prune with exactly their previous effective daily, weekly, monthly, and yearly policy.
  • Users can configure at least hourly or recent-all retention suitable for multiple backups per day.
  • Invalid and contradictory Borg retention combinations are rejected before execution.
  • The effective Borg prune policy is shown in the Wizard preview and Repository Maintenance confirmation.
  • Manual Repository Maintenance cannot silently violate a job's keep-all selection.
  • German and English UI text and both manuals document the new modes and storage-growth warning.
  • Tests cover migration defaults, keep-all behavior, extended command construction, shared repositories, and manual prune safeguards.

User impact

Users can choose between controlled pruning, multiple restore points per day, and keeping every archive without relying on ambiguous numeric values.

Release note

Yes. This adds user-visible retention controls and changes the available backup-maintenance behavior.

borg-codex-bot avatar Sep 04 '26 08:09 borg-codex-bot