fix(prune): a plan with an unfinished backup is pruned on real storage #59

Merged
james.maes merged 1 commits from fix/prune-undated-debris into develop 2026-11-24 11:46:08 +00:00
Owner

What changes

A plan with one unfinished backup could not be pruned on real storage.

  • ObjectStorageBackupStorage.list dropped each object's modification time (it passed null), although the object-storage qbit's listing has it.
  • The pruner finds backups that never finished and are older than 7 days by comparing those times. With one failed run under a plan, Comparator.naturalOrder() met a null and every prune of that plan threw a NullPointerException: the interactive action showed "plan could not be pruned: null", and the daily prune failed for that plan every day. A plan is at its most in need of pruning exactly when a run has failed.

Now:

  • the listing carries the modification time;
  • the pruner dates an unfinished backup by its run record (its end, else its start) where a storage lists no times, and never deletes as old what it cannot date at all;
  • the daily prune logs the stack trace of an unexpected failure (a defect, with no data in it), and still only the class of a storage failure.

How it was found

By a host's live check that runs the daily prune on a real bucket after 0.1.0-RC.14. The qbit's own tests use the in-memory storage, which supplies times, so none of them saw it.

How it was tested

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

  • BackupPrunerTest.testDebrisIsDatedByItsRunWhenTheStorageListsNoTimes: with a storage that lists no times, a plan with a failed run is pruned; the debris is kept 6 days after the run ended and deleted after 8; a prefix with no times and no run record is not old.
  • The MinIO adapter test asserts that a listing gives every object's modification time.

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

🤖 Generated with Claude Code

## What changes A plan with one unfinished backup could not be pruned on real storage. - `ObjectStorageBackupStorage.list` dropped each object's modification time (it passed `null`), although the object-storage qbit's listing has it. - The pruner finds backups that never finished and are older than 7 days by comparing those times. With one failed run under a plan, `Comparator.naturalOrder()` met a `null` and every prune of that plan threw a `NullPointerException`: the interactive action showed "plan could not be pruned: null", and the daily prune failed for that plan every day. A plan is at its most in need of pruning exactly when a run has failed. Now: - the listing carries the modification time; - the pruner dates an unfinished backup by its run record (its end, else its start) where a storage lists no times, and never deletes as old what it cannot date at all; - the daily prune logs the stack trace of an unexpected failure (a defect, with no data in it), and still only the class of a storage failure. ## How it was found By a host's live check that runs the daily prune on a real bucket after `0.1.0-RC.14`. The qbit's own tests use the in-memory storage, which supplies times, so none of them saw it. ## How it was tested `./mvnw verify`: 234 tests, guardrails, help coverage and code coverage pass. New: - `BackupPrunerTest.testDebrisIsDatedByItsRunWhenTheStorageListsNoTimes`: with a storage that lists no times, a plan with a failed run is pruned; the debris is kept 6 days after the run ended and deleted after 8; a prefix with no times and no run record is not old. - The MinIO adapter test asserts that a listing gives every object's modification time. 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:42:56 +00:00
fix(prune): a plan with an unfinished backup is pruned on real storage
maven / build (push) Successful in 2m59s
build / maven (push) Successful in 2m59s
f972d42403
A listing through the object-storage qbit dropped each object's
modification time, and the pruner compared those times to find backups
that never finished and are older than 7 days. With one failed run under
a plan every prune of that plan threw a NullPointerException, by hand and
on the daily schedule.

- the listing carries the modification time
- the pruner dates an unfinished backup by its run record where a storage
  lists no times, and never deletes as old what it cannot date
- the daily prune logs the stack trace of an unexpected failure

Found by a host's live check on a real bucket; the in-memory storage of
the tests supplies times. Tests: a storage that lists no times, in
BackupPrunerTest; the MinIO adapter test asserts the listing's times.
./mvnw verify: 234 tests, guardrails, help coverage and coverage pass.

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