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
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
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
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.
Closes #482.
CreateSnapshotWithNameread the clock once to build the snapshot ID and again forstarted_at. When the second read landed in the next second, that snapshot shared itsstarted_atwith the next run of the same snapshot name.ListRecentorders bystarted_at, so it could list the two in either order.TestBackupWithEmptySourcePathDoesNotPruneexpects 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:
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.started_at. No test depends on their order.Model: opus-5-5
Verdict: PASS
Head:
98a36c6a0cTaking 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
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.