The snapshot ID carries a timestamp in whole seconds (internal/snapshot/snapshot.go:118-136), and the row is a plain INSERT (internal/database/snapshots.go:41-48). A second run of the same snapshot name that starts in the same second as the first therefore dies with UNIQUE constraint failed: snapshots.id. The process lock serializes runs, so this needs the first run to finish within that second. A small snapshot to file:// does: vaultik snapshot create x && vaultik snapshot create x reproduces it.
Found by the second-pass audit on next at e161343, by code trace.
Definition of done
Back-to-back snapshot create runs of one name both succeed with distinct snapshot IDs, for example by waiting for the next second before taking the timestamp. Any change to the ID format is reflected in docs/DATAMODEL.md.
A test runs two creates of one name back to back.
make check passes.
Model: fable-5-1 (audit); opus-5-5 (issue)
The snapshot ID carries a timestamp in whole seconds (`internal/snapshot/snapshot.go:118-136`), and the row is a plain `INSERT` (`internal/database/snapshots.go:41-48`). A second run of the same snapshot name that starts in the same second as the first therefore dies with `UNIQUE constraint failed: snapshots.id`. The process lock serializes runs, so this needs the first run to finish within that second. A small snapshot to `file://` does: `vaultik snapshot create x && vaultik snapshot create x` reproduces it.
Found by the second-pass audit on `next` at `e161343`, by code trace.
## Definition of done
1. Back-to-back `snapshot create` runs of one name both succeed with distinct snapshot IDs, for example by waiting for the next second before taking the timestamp. Any change to the ID format is reflected in `docs/DATAMODEL.md`.
2. A test runs two creates of one name back to back.
3. `make check` passes.
Model: fable-5-1 (audit); opus-5-5 (issue)
clawbot
self-assigned this 2026-10-07 18:00:20 +02:00
Fixed in #277. Before creating the snapshot row, the create looks the snapshot ID up in the local index. If a snapshot already has that ID, it waits a second and takes a new timestamp. The ID format is unchanged.
The new test calls the snapshot manager's create twice. A test of two whole backups did not reproduce the failure: under the race detector on a loaded host, one small backup takes over a second.
Model: opus-5-5
Fixed in https://git.eeqj.de/sneak/vaultik/pulls/277. Before creating the snapshot row, the create looks the snapshot ID up in the local index. If a snapshot already has that ID, it waits a second and takes a new timestamp. The ID format is unchanged.
The new test calls the snapshot manager's create twice. A test of two whole backups did not reproduce the failure: under the race detector on a loaded host, one small backup takes over a second.
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.
The snapshot ID carries a timestamp in whole seconds (
internal/snapshot/snapshot.go:118-136), and the row is a plainINSERT(internal/database/snapshots.go:41-48). A second run of the same snapshot name that starts in the same second as the first therefore dies withUNIQUE constraint failed: snapshots.id. The process lock serializes runs, so this needs the first run to finish within that second. A small snapshot tofile://does:vaultik snapshot create x && vaultik snapshot create xreproduces it.Found by the second-pass audit on
nextate161343, by code trace.Definition of done
snapshot createruns of one name both succeed with distinct snapshot IDs, for example by waiting for the next second before taking the timestamp. Any change to the ID format is reflected indocs/DATAMODEL.md.make checkpasses.Model: fable-5-1 (audit); opus-5-5 (issue)
Fixed in #277. Before creating the snapshot row, the create looks the snapshot ID up in the local index. If a snapshot already has that ID, it waits a second and takes a new timestamp. The ID format is unchanged.
The new test calls the snapshot manager's create twice. A test of two whole backups did not reproduce the failure: under the race detector on a loaded host, one small backup takes over a second.
Model: opus-5-5