fix(schedule): the daily prune prunes, and plans run on their schedule without a scheduled jobs table #57

Merged
james.maes merged 1 commits from fix/scheduled-prune into develop 2026-11-24 11:20:42 +00:00
Owner

What changes

Two things a host should never have had to notice or build.

The daily prune prunes. The daily schedule was on "Prune per retention" (backupPrune), an action for a person: it needs plans selected and shows a review. Started by a scheduler it answered No records were selected for running this process, the scheduler logged a warning and went on. No old backup was ever deleted by the schedule, in any host, so the retention a plan promises (7 daily, 4 weekly and so on) was never enforced and storage only grew.

  • New backupPruneScheduled (BackupScheduledPruneProcess): prunes every active plan to its retention with nobody selecting anything, once a day on the qbit's scheduler.
  • A plan that cannot be pruned raises the new alert backups.prune.failed (cleared by its next good prune) and does not stop the others. A plan that is switched off is left alone.
  • backupPrune has no schedule now. It stays the action a person runs.

Plans run on their schedule without a scheduled jobs table. A plan's schedule is synced to a QQQ scheduled job. In an application without that table the sync logged "ScheduledJob table not found, skipping scheduled job sync" and no plan ever ran on its schedule, unless the host built a scheduler of its own (one did).

  • New backupRunDuePlans (BackupDuePlansProcess): once a minute on the qbit's scheduler, starts every active plan whose cron has come due since it last started (or was created) and every verification that has come due. Missed times collapse into one run; a failed run counts as a start, so an outage is not followed by a retry every minute.
  • Where the application has the scheduled jobs table it starts nothing: no backup runs twice.
  • Only the scheduler may run it.

How it was tested

./mvnw verify: 233 tests, guardrails, help coverage and code coverage pass. New:

  • The prune started exactly as the scheduler starts it (SchedulerUtils.runProcess, nothing selected): the old runs are deleted, two daily backups are kept, a switched-off plan is not touched. The same test against the old schedule deleted nothing, which is how the defect was confirmed.
  • One plan whose storage has gone away does not stop the others, and raises backups.prune.failed for that plan only.
  • BackupDuePlansProcessTest (6): cron and zone boundaries, a person refused, a due plan started once and not again a minute later, three missed nights are one run, a switched-off plan and a plan with no cron never start, a due verification, standing aside where scheduled jobs exist, and its schedule.

For hosts

  • A host that built its own plan scheduler because it has no scheduled jobs table should remove it: the qbit now starts due plans itself, and both would run every backup twice.
  • Nothing else to do. The first scheduled prune runs an hour after start and then daily.

Written by an AI agent (Claude Code) working through the repository owner's access.

🤖 Generated with Claude Code

## What changes Two things a host should never have had to notice or build. **The daily prune prunes.** The daily schedule was on "Prune per retention" (`backupPrune`), an action for a person: it needs plans selected and shows a review. Started by a scheduler it answered `No records were selected for running this process`, the scheduler logged a warning and went on. No old backup was ever deleted by the schedule, in any host, so the retention a plan promises (7 daily, 4 weekly and so on) was never enforced and storage only grew. - New `backupPruneScheduled` (`BackupScheduledPruneProcess`): prunes every active plan to its retention with nobody selecting anything, once a day on the qbit's scheduler. - A plan that cannot be pruned raises the new alert `backups.prune.failed` (cleared by its next good prune) and does not stop the others. A plan that is switched off is left alone. - `backupPrune` has no schedule now. It stays the action a person runs. **Plans run on their schedule without a scheduled jobs table.** A plan's schedule is synced to a QQQ scheduled job. In an application without that table the sync logged "ScheduledJob table not found, skipping scheduled job sync" and no plan ever ran on its schedule, unless the host built a scheduler of its own (one did). - New `backupRunDuePlans` (`BackupDuePlansProcess`): once a minute on the qbit's scheduler, starts every active plan whose cron has come due since it last started (or was created) and every verification that has come due. Missed times collapse into one run; a failed run counts as a start, so an outage is not followed by a retry every minute. - Where the application has the scheduled jobs table it starts nothing: no backup runs twice. - Only the scheduler may run it. ## How it was tested `./mvnw verify`: 233 tests, guardrails, help coverage and code coverage pass. New: - The prune started exactly as the scheduler starts it (`SchedulerUtils.runProcess`, nothing selected): the old runs are deleted, two daily backups are kept, a switched-off plan is not touched. The same test against the old schedule deleted nothing, which is how the defect was confirmed. - One plan whose storage has gone away does not stop the others, and raises `backups.prune.failed` for that plan only. - `BackupDuePlansProcessTest` (6): cron and zone boundaries, a person refused, a due plan started once and not again a minute later, three missed nights are one run, a switched-off plan and a plan with no cron never start, a due verification, standing aside where scheduled jobs exist, and its schedule. ## For hosts - A host that built its own plan scheduler because it has no scheduled jobs table should remove it: the qbit now starts due plans itself, and both would run every backup twice. - Nothing else to do. The first scheduled prune runs an hour after start and then daily. Written by an AI agent (Claude Code) working through the repository owner's access. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
james.maes added 1 commit 2026-11-24 11:19:07 +00:00
fix(schedule): the daily prune prunes, and plans run on their schedule without a scheduled jobs table
maven / build (push) Successful in 1m25s
build / maven (push) Successful in 1m25s
2be9fc21db
The daily prune never deleted anything. Its schedule was on "Prune per
retention" (backupPrune), an action for a person that needs plans selected
and a review; a scheduler that started it was told "No records were
selected", logged a warning and went on, every day, in every host.

- backupPruneScheduled (BackupScheduledPruneProcess) prunes every active
  plan to its retention with nobody selecting anything, once a day
- a plan that cannot be pruned raises backups.prune.failed, cleared by its
  next good prune, and does not stop the others
- backupPrune has no schedule now

Plans did not run on their schedule in an application with no scheduled
jobs table: the sync to scheduled jobs logged "ScheduledJob table not
found" and did nothing, so such a host had to build a scheduler itself.

- backupRunDuePlans (BackupDuePlansProcess), once a minute on the qbit's
  scheduler, starts every active plan whose cron has come due since it
  last started and every verification that has come due; missed times
  collapse into one run
- where the application has scheduled jobs it starts nothing
- only the scheduler may run it

Tests: the prune started as the scheduler starts it deletes what the
retention no longer keeps (the same call on the old schedule deleted
nothing); one plan's trouble does not stop the others; six tests of the
due-plans process. ./mvnw verify: 233 tests, guardrails, help coverage
and code coverage pass.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
james.maes merged commit 730c93d3e6 into develop 2026-11-24 11:20:42 +00:00
Sign in to join this conversation.