restore and verify report an unknown snapshot ID as not found (closes #426) #446

Merged
clawbot merged 1 commits from issue-426-unknown-snapshot-message into next 2026-11-11 04:40:19 +01:00
Collaborator

Fixes #426.

snapshot restore, snapshot verify and snapshot verify --deep given an ID that names no snapshot in the local index or on the destination store now fail with snapshot not found in the local index or on the destination store: <id>, as snapshot remove does. Verify prints nothing before that error.

  • resolveSnapshotRemoteKey checks a snapshot ID with the look-up snapshot remove uses. That look-up is renamed from findSnapshotToRemove to checkSnapshotExists and takes the --local-only flag as a plain bool. Its bool result, inLocalIndex, is false for a snapshot found only on the destination store.
  • Restore and deep verify resolve the ID before anything else, so the error is no longer wrapped as a download failure. Shallow verify drops the resolving snapshot identifier: prefix, in --json too.
  • An ID in the local index whose metadata is missing from the destination still fails on the missing object, which is accurate.

Judgement call: for an ID not in the local index, restore and verify now list metadata/<key>/ on the destination first. Credentials that can read objects but not list them would now fail there. Restoring by remote key already needed listing.

Rule suppressed: nonamedreturns, on checkSnapshotExists only, so its signature names the bool.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/426. `snapshot restore`, `snapshot verify` and `snapshot verify --deep` given an ID that names no snapshot in the local index or on the destination store now fail with `snapshot not found in the local index or on the destination store: <id>`, as `snapshot remove` does. Verify prints nothing before that error. - `resolveSnapshotRemoteKey` checks a snapshot ID with the look-up `snapshot remove` uses. That look-up is renamed from `findSnapshotToRemove` to `checkSnapshotExists` and takes the `--local-only` flag as a plain bool. Its bool result, `inLocalIndex`, is false for a snapshot found only on the destination store. - Restore and deep verify resolve the ID before anything else, so the error is no longer wrapped as a download failure. Shallow verify drops the `resolving snapshot identifier:` prefix, in `--json` too. - An ID in the local index whose metadata is missing from the destination still fails on the missing object, which is accurate. Judgement call: for an ID not in the local index, restore and verify now list `metadata/<key>/` on the destination first. Credentials that can read objects but not list them would now fail there. Restoring by remote key already needed listing. Rule suppressed: `nonamedreturns`, on `checkSnapshotExists` only, so its signature names the bool. Model: opus-5-5
clawbot added the needs-review label 2026-11-11 02:19:12 +01:00
clawbot self-assigned this 2026-11-11 02:19:12 +01:00
Author
Collaborator

FAIL: needs-rework

  1. internal/vaultik/snapshot.go, findSnapshot, called from RemoveSnapshot and from resolveSnapshotRemoteKey in internal/vaultik/snapshot_identifier.go: the new name does not say what the function returns or that a missing snapshot is an error. Its bool means "the local index has a row", so it returns false, nil for a snapshot it did find on the destination store. The package's other find* functions return what they find, so a new caller will read that bool as found or not found. Acceptable: a name that says a missing snapshot is an error, as checkDestinationMarker does for the marker, with the bool named in the signature. For example: checkSnapshotExists(snapshotID string, localOnly bool) (inLocalIndex bool, err error).

Model: opus-5-5

**FAIL: needs-rework** 1. `internal/vaultik/snapshot.go`, `findSnapshot`, called from `RemoveSnapshot` and from `resolveSnapshotRemoteKey` in `internal/vaultik/snapshot_identifier.go`: the new name does not say what the function returns or that a missing snapshot is an error. Its bool means "the local index has a row", so it returns `false, nil` for a snapshot it did find on the destination store. The package's other `find*` functions return what they find, so a new caller will read that bool as found or not found. Acceptable: a name that says a missing snapshot is an error, as `checkDestinationMarker` does for the marker, with the bool named in the signature. For example: `checkSnapshotExists(snapshotID string, localOnly bool) (inLocalIndex bool, err error)`. Model: opus-5-5
Author
Collaborator

For the reworker: fix the finding of #446 (comment) as its "Acceptable" line says, and change nothing else. Rebase onto current origin/next, run make fmt and make check, push with --force-with-lease, and reply here with one line.

For the next reviewer: check that finding against the rework, and anything the rework broke.

Model: opus-5-5

For the reworker: fix the finding of https://git.eeqj.de/sneak/vaultik/pulls/446#issuecomment-177017 as its "Acceptable" line says, and change nothing else. Rebase onto current `origin/next`, run `make fmt` and `make check`, push with `--force-with-lease`, and reply here with one line. For the next reviewer: check that finding against the rework, and anything the rework broke. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-11-11 03:13:10 +01:00
clawbot force-pushed issue-426-unknown-snapshot-message from 2564116149 to 5682918723 2026-11-11 03:23:53 +01:00 Compare
clawbot added 1 commit 2026-11-11 03:32:28 +01:00
A snapshot ID that names no snapshot in the local index or on the
destination store made restore and verify fail on a missing object at
a hashed path, and verify printed a header for it first. Resolving a
snapshot ID now uses the look-up `snapshot remove` already does, so
all three commands give the same error, and verify prints its header
only after the snapshot is found.

Model: opus-5-5
clawbot force-pushed issue-426-unknown-snapshot-message from 5682918723 to 30bcb8f4db 2026-11-11 03:32:28 +01:00 Compare
Author
Collaborator
  1. Fixed as suggested: checkSnapshotExists(snapshotID string, localOnly bool) (inLocalIndex bool, err error). Rule suppressed: nonamedreturns, on that function only, since the linter rejects the named bool otherwise.

Model: opus-5-5

1. Fixed as suggested: `checkSnapshotExists(snapshotID string, localOnly bool) (inLocalIndex bool, err error)`. Rule suppressed: `nonamedreturns`, on that function only, since the linter rejects the named bool otherwise. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-11-11 04:10:30 +01:00
Author
Collaborator

PASS: restore, verify and deep verify now refuse an ID that names no snapshot in the local index or on the destination store with the error snapshot remove gives, before printing anything, and checkSnapshotExists with its named inLocalIndex result settles the earlier naming finding.

Model: opus-5-5

**PASS**: restore, verify and deep verify now refuse an ID that names no snapshot in the local index or on the destination store with the error `snapshot remove` gives, before printing anything, and `checkSnapshotExists` with its named `inLocalIndex` result settles the earlier naming finding. Model: opus-5-5
clawbot merged commit 1df1d23094 into next 2026-11-11 04:40:19 +01:00
clawbot deleted branch issue-426-unknown-snapshot-message 2026-11-11 04:40:19 +01:00
Sign in to join this conversation.