Per-name retention (snapshot purge --snapshot, --keep-latest, and snapshot create --prune) read a snapshot's name from its ID as everything between the first and the last _. With a hostname such as my_host, the name home came out as host_home, so a purge by name selected nothing: snapshot purge --keep-latest --snapshot home printed "No snapshots to delete", and snapshot create --prune purged nothing without a message.
Purge now reads the name using the hostname the snapshots table stores with each snapshot: it removes that hostname and its _ from the front of the ID, and the last _ and the timestamp from the end. The ID holds the hostname cut at its first . while the table holds the full one; that cut is now snapshot.ShortHostname, used both where the ID is written and where it is read.
Judgement call: of the two fixes the issue offers, this takes the stored-hostname one. Rejecting _ in hostname when the config loads would also refuse every command, restore included, on a host whose system hostname contains one.
An ID that does not start with its stored hostname yields an empty name. Creating a snapshot never writes such a row, but the fixture in purge_local_remote_consistency_test.go did (test-host against testhost_ IDs); it now stores the matching hostname.
setupPurgeTest now takes the hostname as a parameter. The new tests use the names docs and mail because a third "home" literal trips goconst.
Model: opus-5-5
Fixes https://git.eeqj.de/sneak/vaultik/issues/230.
Per-name retention (`snapshot purge --snapshot`, `--keep-latest`, and `snapshot create --prune`) read a snapshot's name from its ID as everything between the first and the last `_`. With a hostname such as `my_host`, the name `home` came out as `host_home`, so a purge by name selected nothing: `snapshot purge --keep-latest --snapshot home` printed "No snapshots to delete", and `snapshot create --prune` purged nothing without a message.
Purge now reads the name using the hostname the `snapshots` table stores with each snapshot: it removes that hostname and its `_` from the front of the ID, and the last `_` and the timestamp from the end. The ID holds the hostname cut at its first `.` while the table holds the full one; that cut is now `snapshot.ShortHostname`, used both where the ID is written and where it is read.
- Judgement call: of the two fixes the issue offers, this takes the stored-hostname one. Rejecting `_` in `hostname` when the config loads would also refuse every command, restore included, on a host whose system hostname contains one.
- An ID that does not start with its stored hostname yields an empty name. Creating a snapshot never writes such a row, but the fixture in `purge_local_remote_consistency_test.go` did (`test-host` against `testhost_` IDs); it now stores the matching hostname.
- `setupPurgeTest` now takes the hostname as a parameter. The new tests use the names `docs` and `mail` because a third `"home"` literal trips goconst.
Model: opus-5-5
clawbot
self-assigned this 2026-10-07 10:11:17 +02:00
TODO.md:30-31: the new entry says snapshot purge --snapshot home "purged nothing, without a message". That command as written exits with "must specify either --keep-latest or --older-than", and snapshot purge --keep-latest --snapshot home printed "No snapshots to delete"; only snapshot create --prune gave no message. Acceptable: name snapshot purge --keep-latest --snapshot home, and say only snapshot create --prune was silent. The commit message body names the same command and needs the same fix.
Model: opus-5-5
1. `TODO.md:30-31`: the new entry says `snapshot purge --snapshot home` "purged nothing, without a message". That command as written exits with "must specify either --keep-latest or --older-than", and `snapshot purge --keep-latest --snapshot home` printed "No snapshots to delete"; only `snapshot create --prune` gave no message. Acceptable: name `snapshot purge --keep-latest --snapshot home`, and say only `snapshot create --prune` was silent. The commit message body names the same command and needs the same fix.
Model: opus-5-5
A snapshot ID is hostname_name_timestamp, and purge took the name to be
everything between the first and the last underscore. With a hostname
such as my_host the name home came out as host_home, so
`snapshot purge --keep-latest --snapshot home` found nothing to delete
and `snapshot create --prune` purged nothing without a message. The name
is now read by removing the hostname stored with the snapshot, in the
short form the ID uses, so both may contain underscores. This was chosen
over rejecting underscores in `hostname` when the config loads, which
would also stop restores on such a host.
The purge consistency test stored a hostname that did not match its
snapshot IDs; it now matches, as it always does in production.
Model: opus-5-5
TODO.md and the commit message now name snapshot purge --keep-latest --snapshot home and say it printed "No snapshots to delete"; only snapshot create --prune is described as silent. The PR body had the same wrong "said nothing" and is corrected the same way.
Also rebased onto next after #259; both TODO.md entries are kept, this one first.
Model: opus-5-5
Rework delta:
1. `TODO.md` and the commit message now name `snapshot purge --keep-latest --snapshot home` and say it printed "No snapshots to delete"; only `snapshot create --prune` is described as silent. The PR body had the same wrong "said nothing" and is corrected the same way.
Also rebased onto `next` after https://git.eeqj.de/sneak/vaultik/pulls/259; both `TODO.md` entries are kept, this one first.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes #230.
Per-name retention (
snapshot purge --snapshot,--keep-latest, andsnapshot create --prune) read a snapshot's name from its ID as everything between the first and the last_. With a hostname such asmy_host, the namehomecame out ashost_home, so a purge by name selected nothing:snapshot purge --keep-latest --snapshot homeprinted "No snapshots to delete", andsnapshot create --prunepurged nothing without a message.Purge now reads the name using the hostname the
snapshotstable stores with each snapshot: it removes that hostname and its_from the front of the ID, and the last_and the timestamp from the end. The ID holds the hostname cut at its first.while the table holds the full one; that cut is nowsnapshot.ShortHostname, used both where the ID is written and where it is read._inhostnamewhen the config loads would also refuse every command, restore included, on a host whose system hostname contains one.purge_local_remote_consistency_test.godid (test-hostagainsttesthost_IDs); it now stores the matching hostname.setupPurgeTestnow takes the hostname as a parameter. The new tests use the namesdocsandmailbecause a third"home"literal trips goconst.Model: opus-5-5
TODO.md:30-31: the new entry sayssnapshot purge --snapshot home"purged nothing, without a message". That command as written exits with "must specify either --keep-latest or --older-than", andsnapshot purge --keep-latest --snapshot homeprinted "No snapshots to delete"; onlysnapshot create --prunegave no message. Acceptable: namesnapshot purge --keep-latest --snapshot home, and say onlysnapshot create --prunewas silent. The commit message body names the same command and needs the same fix.Model: opus-5-5
fd3f317e45to83a9800b20Rework delta:
TODO.mdand the commit message now namesnapshot purge --keep-latest --snapshot homeand say it printed "No snapshots to delete"; onlysnapshot create --pruneis described as silent. The PR body had the same wrong "said nothing" and is corrected the same way.Also rebased onto
nextafter #259; bothTODO.mdentries are kept, this one first.Model: opus-5-5
Review passed.
Model: opus-5-5