Make snapshot list report a changed destination instead of advising prune #375

Merged
clawbot merged 1 commits from issue-317-list-bound-elsewhere into next 2026-10-14 04:29:38 +02:00
Collaborator

Fixes #317.

What was wrong: after storage_url (or s3.endpoint, s3.bucket, s3.prefix) changed, the local index stays bound to the old destination. snapshot list then reported its snapshots as local records missing from the destination store and advised vaultik prune, which refuses in that state, as snapshot purge and snapshot remove do.

What changed:

  • snapshot list reads the binding. When the local index is bound to a different destination than the configured one, it gives the same warning the refusing commands give: both destinations, and the two ways out (revert the configuration, or run vaultik database delete). Below the table, the local-only note and its vaultik prune advice are left out in that case; the notes about remote-only, unreadable and omitted snapshots are unchanged.
  • With --json the warning goes to stderr through the logger, like the command's other --json warnings, so stdout stays the JSON document. The document itself is unchanged: its local rows still show remote_present: false.
  • The binding read moves out of EnsureStorageBinding into storageBinding, which records nothing, so the read-only list cannot bind a fresh index.
  • README's snapshot list section, its --json bullet included, says what the command prints in this case.

Things the diff does not show:

  • The warning is given even when the destination store cannot be listed, because it needs only the local index and the config.

Model: opus-5-5

Fixes https://git.eeqj.de/sneak/vaultik/issues/317. **What was wrong:** after `storage_url` (or `s3.endpoint`, `s3.bucket`, `s3.prefix`) changed, the local index stays bound to the old destination. `snapshot list` then reported its snapshots as local records missing from the destination store and advised `vaultik prune`, which refuses in that state, as `snapshot purge` and `snapshot remove` do. **What changed:** - `snapshot list` reads the binding. When the local index is bound to a different destination than the configured one, it gives the same warning the refusing commands give: both destinations, and the two ways out (revert the configuration, or run `vaultik database delete`). Below the table, the local-only note and its `vaultik prune` advice are left out in that case; the notes about remote-only, unreadable and omitted snapshots are unchanged. - With `--json` the warning goes to stderr through the logger, like the command's other `--json` warnings, so stdout stays the JSON document. The document itself is unchanged: its local rows still show `remote_present: false`. - The binding read moves out of `EnsureStorageBinding` into `storageBinding`, which records nothing, so the read-only list cannot bind a fresh index. - README's `snapshot list` section, its `--json` bullet included, says what the command prints in this case. Things the diff does not show: - The warning is given even when the destination store cannot be listed, because it needs only the local index and the config. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 00:45:22 +02:00
clawbot self-assigned this 2026-10-14 00:45:22 +02:00
clawbot force-pushed issue-317-list-bound-elsewhere from 3037bf9059 to 39ca0e3111 2026-10-14 00:45:23 +02:00 Compare
Author
Collaborator
  • internal/vaultik/snapshot_list.go, ListSnapshots: with --json the command returns before it reads the binding, so it never says that the local index is bound to a different destination. Every local snapshot then comes out with remote_present: false, which a script reads as stale local records, the same misreading this issue fixes for the table. The definition of done in #317 asks that snapshot list say so, and the command already sends its other --json warnings (destination not listable, unreadable manifests, truncated listing) through the logger to stderr. Acceptable: in --json mode, log the same warning (both destinations and both ways out) through the logger so stdout stays the JSON document; mention it in README's --json bullet for snapshot list; cover it in the test.

Model: opus-5-5

- `internal/vaultik/snapshot_list.go`, `ListSnapshots`: with `--json` the command returns before it reads the binding, so it never says that the local index is bound to a different destination. Every local snapshot then comes out with `remote_present: false`, which a script reads as stale local records, the same misreading this issue fixes for the table. The definition of done in https://git.eeqj.de/sneak/vaultik/issues/317 asks that `snapshot list` say so, and the command already sends its other `--json` warnings (destination not listable, unreadable manifests, truncated listing) through the logger to stderr. Acceptable: in `--json` mode, log the same warning (both destinations and both ways out) through the logger so stdout stays the JSON document; mention it in README's `--json` bullet for `snapshot list`; cover it in the test. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-14 00:58:57 +02:00
clawbot force-pushed issue-317-list-bound-elsewhere from 39ca0e3111 to 68c76d4aa4 2026-10-14 01:04:39 +02:00 Compare
clawbot force-pushed issue-317-list-bound-elsewhere from 68c76d4aa4 to ef0dc84ccd 2026-10-14 02:00:49 +02:00 Compare
clawbot force-pushed issue-317-list-bound-elsewhere from ef0dc84ccd to 9a1b5425c2 2026-10-14 02:47:57 +02:00 Compare
clawbot force-pushed issue-317-list-bound-elsewhere from 9a1b5425c2 to 271eef93a8 2026-10-14 03:20:06 +02:00 Compare
clawbot added 1 commit 2026-10-14 03:50:56 +02:00
When the local index is bound to a different destination than the
configured one, snapshot list now gives the warning prune, snapshot
purge and snapshot remove refuse with: both destinations and the two
ways out (revert the configuration, or run vaultik database delete).
Below the table it replaces the local-only note and its prune advice.
With --json it goes to stderr through the logger, so stdout stays the
document, whose local rows show remote_present false.

Reading the binding moves out of EnsureStorageBinding into
storageBinding, which records nothing, so the read-only list can call
it without binding a fresh index.

Model: opus-5-5
clawbot force-pushed issue-317-list-bound-elsewhere from 271eef93a8 to 89ce0f36f7 2026-10-14 03:50:56 +02:00 Compare
Author
Collaborator

Rework:

  • With --json, snapshot list now logs the binding warning (both destinations and both ways out) to stderr through the logger; stdout stays the JSON document.
  • README's --json bullet for snapshot list says so.
  • A new test covers the --json case.
  • Commit message and PR body describe the change as it now stands; rebased onto next.

Model: opus-5-5

Rework: - With `--json`, `snapshot list` now logs the binding warning (both destinations and both ways out) to stderr through the logger; stdout stays the JSON document. - README's `--json` bullet for `snapshot list` says so. - A new test covers the `--json` case. - Commit message and PR body describe the change as it now stands; rebased onto `next`. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-14 04:19:31 +02:00
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 65036bba1b into next 2026-10-14 04:29:38 +02:00
clawbot deleted branch issue-317-list-bound-elsewhere 2026-10-14 04:29:39 +02:00
Sign in to join this conversation.