Check --keep-newer-than before the backup starts #346

Merged
clawbot merged 1 commits from issue-307-keep-newer-than-check into next 2026-10-13 09:44:44 +02:00
Collaborator

Fixes #307.

snapshot create read --keep-newer-than only in the post-backup prune. A value the duration parser rejects therefore failed the run after the snapshot had been uploaded, reported as "Snapshot creation failed", and retention never ran. Without --prune the flag was ignored.

  • snapshot create now checks the flag before it starts, through SnapshotCreateOptions.Validate, as snapshot purge checks its flags: an invalid duration or a missing --prune fails the command before the lock is taken, the local index is opened or anything is backed up.
  • A failed post-backup prune is wrapped in ErrPostBackupPruneFailed, and snapshot create reports it as "Backup completed, but post-backup prune failed: ..." instead of "Snapshot creation failed".
  • README: the --keep-newer-than entry says when the command fails.
  • The tests run the real command against a file:// destination store: the three rejected forms leave the store empty, and a prune made to fail by an undecodable manifest is reported as the prune's failure, with the new snapshot left on the store.

Judgement call: a failed post-backup prune still exits 1, so cron still reports it; the issue asked only that it be reported as the prune's failure.
Judgement call: an explicitly empty --keep-newer-than "" still counts as not given, so the prune keeps only the latest snapshot.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/307. `snapshot create` read `--keep-newer-than` only in the post-backup prune. A value the duration parser rejects therefore failed the run after the snapshot had been uploaded, reported as "Snapshot creation failed", and retention never ran. Without `--prune` the flag was ignored. - `snapshot create` now checks the flag before it starts, through `SnapshotCreateOptions.Validate`, as `snapshot purge` checks its flags: an invalid duration or a missing `--prune` fails the command before the lock is taken, the local index is opened or anything is backed up. - A failed post-backup prune is wrapped in `ErrPostBackupPruneFailed`, and `snapshot create` reports it as "Backup completed, but post-backup prune failed: ..." instead of "Snapshot creation failed". - README: the `--keep-newer-than` entry says when the command fails. - The tests run the real command against a `file://` destination store: the three rejected forms leave the store empty, and a prune made to fail by an undecodable manifest is reported as the prune's failure, with the new snapshot left on the store. Judgement call: a failed post-backup prune still exits 1, so cron still reports it; the issue asked only that it be reported as the prune's failure. Judgement call: an explicitly empty `--keep-newer-than ""` still counts as not given, so the prune keeps only the latest snapshot. Model: opus-5-5
clawbot self-assigned this 2026-10-13 08:24:03 +02:00
clawbot added 1 commit 2026-10-13 08:24:03 +02:00
snapshot create read --keep-newer-than only in the post-backup prune,
so a value the duration parser rejects failed the run after the
snapshot was uploaded: a nightly cron line added a snapshot each night,
reported it as failed, and never deleted any. Without --prune the flag
was ignored. The command now checks the flag before it starts and fails
on an invalid duration or a missing --prune.

A failed post-backup prune is now wrapped in ErrPostBackupPruneFailed
and reported as "Backup completed, but post-backup prune failed: ..."
rather than as a failed snapshot creation. The exit status stays 1.

Model: opus-5-5
clawbot added the needs-review label 2026-10-13 08:24:07 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 35eed79b1a into next 2026-10-13 09:44:44 +02:00
clawbot deleted branch issue-307-keep-newer-than-check 2026-10-13 09:44:44 +02:00
Sign in to join this conversation.