Take a snapshot's start time from the moment in its ID (closes #482) #483

Open
clawbot wants to merge 1 commits from issue-482-snapshot-start-time into next
pull from: issue-482-snapshot-start-time
Collaborator

Closes #482.

CreateSnapshotWithName read the clock once to build the snapshot ID and again for started_at. When the second read landed in the next second, that snapshot shared its started_at with the next run of the same snapshot name. ListRecent orders by started_at, so it could list the two in either order. TestBackupWithEmptySourcePathDoesNotPrune expects the first snapshot last in that list, so it failed at random.

The start time now comes from the same clock read as the ID. Two runs of one name already get IDs at least a second apart (#270), so their start times are now distinct and increasing.

Things the diff does not show:

  • The new test, TestCreateSnapshotWithNameTwiceBackToBackListsNewestFirst, fails on the old code only when the clock crosses a second at the wrong moment. It cannot reproduce the bug on every run without a clock you can inject, which this fix does not add.
  • Snapshots of different names can still share a started_at. No test depends on their order.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/vaultik/issues/482. `CreateSnapshotWithName` read the clock once to build the snapshot ID and again for `started_at`. When the second read landed in the next second, that snapshot shared its `started_at` with the next run of the same snapshot name. `ListRecent` orders by `started_at`, so it could list the two in either order. `TestBackupWithEmptySourcePathDoesNotPrune` expects the first snapshot last in that list, so it failed at random. The start time now comes from the same clock read as the ID. Two runs of one name already get IDs at least a second apart (https://git.eeqj.de/sneak/vaultik/issues/270), so their start times are now distinct and increasing. Things the diff does not show: - The new test, `TestCreateSnapshotWithNameTwiceBackToBackListsNewestFirst`, fails on the old code only when the clock crosses a second at the wrong moment. It cannot reproduce the bug on every run without a clock you can inject, which this fix does not add. - Snapshots of different names can still share a `started_at`. No test depends on their order. Model: opus-5-5
clawbot added the needs-review label 2026-11-19 13:00:45 +01:00
clawbot added 1 commit 2026-11-19 13:00:45 +01:00
CreateSnapshotWithName read the clock once for the ID and again for
started_at. When the second read fell in the next second, the snapshot
shared its started_at with the next run of the same name, and
ListRecent, which orders by started_at, could list the two in either
order. That made TestBackupWithEmptySourcePathDoesNotPrune fail at
random. The start time now comes from the same clock read as the ID, so
successive runs of one name have distinct, increasing start times.

Model: opus-5-5
clawbot self-assigned this 2026-11-19 13:00:47 +01:00
Author
Collaborator

Verdict: PASS
Head: 98a36c6a0c

Taking a snapshot's start time from the clock read that builds its ID gives every run of one name a distinct, later start time, which fixes the random listing order behind #482.

Judgement call: the new test fails on the old code only when a second boundary falls between the two clock reads. I accepted that, because a test that fails every time needs an injectable clock, and the codebase has none.

Model: opus-5-5

Verdict: PASS Head: 98a36c6a0c2dcefe8f06b2b0ed8a8d363cd14266 Taking a snapshot's start time from the clock read that builds its ID gives every run of one name a distinct, later start time, which fixes the random listing order behind https://git.eeqj.de/sneak/vaultik/issues/482. Judgement call: the new test fails on the old code only when a second boundary falls between the two clock reads. I accepted that, because a test that fails every time needs an injectable clock, and the codebase has none. Model: opus-5-5
Some checks are pending
check / check (push) Waiting to run
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin issue-482-snapshot-start-time:issue-482-snapshot-start-time
git checkout issue-482-snapshot-start-time
Sign in to join this conversation.