snapshot remove reports success for a snapshot that does not exist #293

Closed
opened 2026-10-13 00:29:21 +02:00 by clawbot · 1 comment
Collaborator

Found by the defect hunt in #288 (part 4).

What is wrong: RemoveSnapshot (internal/vaultik/snapshot.go) never checks that the snapshot ID exists. deleteSnapshotFromLocalDB deletes zero rows without error, and deleteRemoteSnapshotByKey finds nothing to delete.

How it was shown: snapshot remove --force hunt_home_1999-01-01T00:00:00Z printed "Removed snapshot ... from local database" and "Removed snapshot metadata from remote storage", and exited 0; --json gave "remote_removed": true, and --dry-run printed "Would remove snapshot". Passing the remote key that snapshot list prints for a snapshot gave the same two success lines and left that metadata/KEY/ untouched.

Definition of done

  • An ID that names no snapshot in the local index and none on the destination is an error with a non-zero exit, under --force, --json, --dry-run and --local-only alike, and nothing claims a removal that did not happen (remote_removed is true only when something was deleted).
  • Accepting a remote key in snapshot remove is not part of this issue.
  • A test covers an unknown ID.

Model: opus-5-5

Found by the defect hunt in https://git.eeqj.de/sneak/vaultik/issues/288 (part 4). **What is wrong:** `RemoveSnapshot` (`internal/vaultik/snapshot.go`) never checks that the snapshot ID exists. `deleteSnapshotFromLocalDB` deletes zero rows without error, and `deleteRemoteSnapshotByKey` finds nothing to delete. **How it was shown:** `snapshot remove --force hunt_home_1999-01-01T00:00:00Z` printed "Removed snapshot ... from local database" and "Removed snapshot metadata from remote storage", and exited 0; `--json` gave `"remote_removed": true`, and `--dry-run` printed "Would remove snapshot". Passing the remote key that `snapshot list` prints for a snapshot gave the same two success lines and left that `metadata/KEY/` untouched. **Definition of done** - An ID that names no snapshot in the local index and none on the destination is an error with a non-zero exit, under `--force`, `--json`, `--dry-run` and `--local-only` alike, and nothing claims a removal that did not happen (`remote_removed` is true only when something was deleted). - Accepting a remote key in `snapshot remove` is not part of this issue. - A test covers an unknown ID. Model: opus-5-5
clawbot self-assigned this 2026-10-13 00:29:21 +02:00
Author
Collaborator

Implemented in #339.

Model: opus-5-5

Implemented in https://git.eeqj.de/sneak/vaultik/pulls/339. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#293