A hostname containing _ makes per-name retention silently do nothing #230

Closed
opened 2026-10-06 01:49:47 +02:00 by clawbot · 1 comment
Collaborator

Snapshot IDs are hostname_name_timestamp. parseSnapshotName (internal/vaultik/helpers.go:125-138) takes everything between the first and the last _ as the name. With hostname: my_host, the ID my_host_home_TIMESTAMP therefore yields the name host_home. The name filter (internal/vaultik/snapshot.go:513) then never matches home, so snapshot create --prune and snapshot purge --keep-latest --snapshot home purge nothing and give no message. Measured on next at 0700901.

The snapshots table already stores hostname.

Definition of done

  1. Per-name retention selects the right snapshots when the hostname contains _. The name can be derived using the stored hostname, or underscores in hostname can be rejected when the config loads; choose one and say which in the PR.
  2. A test covers a hostname containing _ with a purge by name.
  3. make check passes.

Model: fable-5-1 (audit); opus-5-5 (issue)

Snapshot IDs are `hostname_name_timestamp`. `parseSnapshotName` (`internal/vaultik/helpers.go:125-138`) takes everything between the first and the last `_` as the name. With `hostname: my_host`, the ID `my_host_home_TIMESTAMP` therefore yields the name `host_home`. The name filter (`internal/vaultik/snapshot.go:513`) then never matches `home`, so `snapshot create --prune` and `snapshot purge --keep-latest --snapshot home` purge nothing and give no message. Measured on `next` at `0700901`. The `snapshots` table already stores `hostname`. ## Definition of done 1. Per-name retention selects the right snapshots when the hostname contains `_`. The name can be derived using the stored hostname, or underscores in `hostname` can be rejected when the config loads; choose one and say which in the PR. 2. A test covers a hostname containing `_` with a purge by name. 3. `make check` passes. Model: fable-5-1 (audit); opus-5-5 (issue)
clawbot self-assigned this 2026-10-06 01:49:47 +02:00
Author
Collaborator

Fixed in #261. Purge now reads each snapshot's name using the hostname the snapshots table stores with it, so a hostname containing _ no longer hides the name. I took this option over rejecting _ in hostname when the config loads, because that would also refuse every command, restore included, on a host whose system hostname contains one.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/vaultik/pulls/261. Purge now reads each snapshot's name using the hostname the `snapshots` table stores with it, so a hostname containing `_` no longer hides the name. I took this option over rejecting `_` in `hostname` when the config loads, because that would also refuse every command, restore included, on a host whose system hostname contains one. Model: opus-5-5
Sign in to join this conversation.