Skip to content

fix(canopy): select restore snapshot by id alone, not the canopy-type tag#657

Open
passcod wants to merge 2 commits into
mainfrom
canopy-restore-by-id-only
Open

fix(canopy): select restore snapshot by id alone, not the canopy-type tag#657
passcod wants to merge 2 commits into
mainfrom
canopy-restore-by-id-only

Conversation

@passcod

@passcod passcod commented Jul 4, 2026

Copy link
Copy Markdown
Member

🤖 Restoring a snapshot by a valid, correct id failed with no snapshot matching id '<id>' in the repository, even on the server that took the backup, in the right group, with a live restore credential.

The cause: select_snapshot matched on s.id.starts_with(id) && s.tags.get("canopy-type") == Some(type). But kopia's snapshot list output does not echo the tags set at snapshot-create time (it stores them as manifest labels), so every listed snapshot deserialises with no tags. The tag half of the condition was therefore always false, and selection rejected every snapshot regardless of the id. The unit tests passed only because they hand-constructed tags maps that real kopia output never contains.

This matches by id alone. The backup type still selects the def, method, and credential scope in the caller; it no longer gates snapshot selection. When no id matches, the error now lists the ids the connected repository actually holds (id, source server, taken-at), rather than leaving the operator to guess.

Also updates the restore spec to the current shape (positional <type> <id>, id-only selection, not scoped to the issuing server).

Also: the same bug in the generic snapshot filter

SnapshotFilter filtered listings by .tags read back from the same tagless snapshot list output, so bestool kopia list --tag and the --tag snapshot picker (restore/mount) matched nothing too. Tag filtering now passes --tags KEY:VALUE to kopia, which filters against the manifest labels; the in-process filter no longer carries tags.

passcod added 2 commits July 5, 2026 06:41
… tag

kopia's snapshot list output does not echo the user tags set at
snapshot-create time, so the snapshot's canopy-type tag was always
absent when selecting. Gating selection on it rejected every snapshot,
so restoring by a valid, correct id failed with 'no snapshot matching
id'. Match on the id alone; the backup type still selects the def,
method, and credentials.
…cess

kopia's snapshot list does not echo the tags set at snapshot-create
time, so the parsed snapshots carried no tags and the in-process tag
filter matched nothing. Pass --tags to kopia so it filters against the
manifest labels, and drop the tag field from the in-process filter.
Affects 'bestool kopia list --tag' and the --tag snapshot picker used by
restore/mount.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant