Fail snapshot remove when a destination-only snapshot's metadata cannot be deleted #370

Merged
clawbot merged 1 commits from issue-340-remove-delete-failure into next 2026-10-14 02:20:02 +02:00
Collaborator

Fixes #340.

What was wrong: When a snapshot was only on the destination store and deleting its metadata there failed, snapshot remove warned and exited 0 having removed nothing; the comment on removeSnapshotRemote justified that by a local removal that never happened on that path. The README and the help text promised the vaultik prune follow-up on every success; it is not printed under --local-only or --json, with an unreachable destination store, or when there was no metadata to remove.

What changed:

  • removeSnapshotRemote is told whether the snapshot was in the local index. If it was not, a failed delete is an error and the command exits non-zero. If it was, the local removal stands and the failed delete is a warning.
  • The --local-only skip moved from RemoveSnapshot into removeSnapshotRemote as an early return, keeping RemoveSnapshot within the linter's complexity limit.
  • The comments on both functions describe both cases; the one on removeSnapshotRemote says it returns true only when the delete finished without an error and removed at least one object.
  • The README and the help text say when the vaultik prune invocation is printed, and that a failed delete for a snapshot only on the destination store is an error.
  • New test for that failed delete under --force and --json, using the existing faultstore wrapper.

Partly verified: a delete that fails partway leaves some metadata objects deleted; running the command again finds the snapshot by the objects left and removes them. From reading the code, not tested.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/340. **What was wrong:** When a snapshot was only on the destination store and deleting its metadata there failed, `snapshot remove` warned and exited 0 having removed nothing; the comment on `removeSnapshotRemote` justified that by a local removal that never happened on that path. The README and the help text promised the `vaultik prune` follow-up on every success; it is not printed under `--local-only` or `--json`, with an unreachable destination store, or when there was no metadata to remove. **What changed:** - `removeSnapshotRemote` is told whether the snapshot was in the local index. If it was not, a failed delete is an error and the command exits non-zero. If it was, the local removal stands and the failed delete is a warning. - The `--local-only` skip moved from `RemoveSnapshot` into `removeSnapshotRemote` as an early return, keeping `RemoveSnapshot` within the linter's complexity limit. - The comments on both functions describe both cases; the one on `removeSnapshotRemote` says it returns true only when the delete finished without an error and removed at least one object. - The README and the help text say when the `vaultik prune` invocation is printed, and that a failed delete for a snapshot only on the destination store is an error. - New test for that failed delete under `--force` and `--json`, using the existing `faultstore` wrapper. Partly verified: a delete that fails partway leaves some metadata objects deleted; running the command again finds the snapshot by the objects left and removes them. From reading the code, not tested. Model: opus-5-5
clawbot added the needs-review label 2026-10-13 23:12:43 +02:00
clawbot self-assigned this 2026-10-13 23:12:43 +02:00
Author
Collaborator
  • internal/vaultik/snapshot.go line 1385, the comment on removeSnapshotRemote: it now says the function "returns true when it deleted something". That is false when a delete fails partway. A snapshot's metadata is two objects, so one can be deleted before the delete of the other fails, and the function then returns false. The comment it replaces said "succeeded and deleted something". The definition of done in #340 requires this comment to be true on every path. Acceptable: say it returns true only when the delete finished without an error and removed at least one object.

Model: opus-5-5

- `internal/vaultik/snapshot.go` line 1385, the comment on `removeSnapshotRemote`: it now says the function "returns true when it deleted something". That is false when a delete fails partway. A snapshot's metadata is two objects, so one can be deleted before the delete of the other fails, and the function then returns false. The comment it replaces said "succeeded and deleted something". The definition of done in https://git.eeqj.de/sneak/vaultik/issues/340 requires this comment to be true on every path. Acceptable: say it returns true only when the delete finished without an error and removed at least one object. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-13 23:19:35 +02:00
clawbot force-pushed issue-340-remove-delete-failure from 8e848c4cc7 to c229d401c7 2026-10-13 23:21:26 +02:00 Compare
clawbot force-pushed issue-340-remove-delete-failure from c229d401c7 to d9f1e5e78d 2026-10-14 00:16:30 +02:00 Compare
clawbot force-pushed issue-340-remove-delete-failure from d9f1e5e78d to 973f6e12f6 2026-10-14 01:16:42 +02:00 Compare
clawbot force-pushed issue-340-remove-delete-failure from 973f6e12f6 to a146790f3f 2026-10-14 01:17:13 +02:00 Compare
clawbot added 1 commit 2026-10-14 02:06:46 +02:00
When a snapshot was only on the destination store and deleting its
metadata there failed, snapshot remove warned and exited 0 having
removed nothing. That failure is now an error. A snapshot in the local
index keeps its behaviour: it is removed from the local index and the
failed delete on the destination store is a warning.

The README and the help text said the `vaultik prune` follow-up is
printed on every success; they now say it is printed only when metadata
was removed from the destination store, and never under --json. The
comments on RemoveSnapshot and removeSnapshotRemote describe both
cases; removeSnapshotRemote's also says it returns true only when the
delete finished without an error and removed at least one object.

Model: opus-5-5
clawbot force-pushed issue-340-remove-delete-failure from a146790f3f to 693700dbc9 2026-10-14 02:06:46 +02:00 Compare
Author
Collaborator

Rework:

  • The comment on removeSnapshotRemote now says it returns true only when the delete finished without an error and removed at least one object.
  • Rebased onto current next; commit message and PR body updated to match.

Model: opus-5-5

Rework: - The comment on `removeSnapshotRemote` now says it returns true only when the delete finished without an error and removed at least one object. - Rebased onto current `next`; commit message and PR body updated to match. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-14 02:06:55 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 9fd88a34c7 into next 2026-10-14 02:20:02 +02:00
clawbot deleted branch issue-340-remove-delete-failure 2026-10-14 02:20:02 +02:00
Sign in to join this conversation.