test(depot): add branch history snapshot helper for exact retention assertions#5220
Conversation
|
Stack for rivet-dev/rivet
Get stack: |
|
🚅 Deployed to the rivet-pr-5220 environment in rivet-frontend
|
Code ReviewOverviewThis PR adds a The design is sound: using a snapshot-isolation transaction ensures partial deletes cannot hide behind in-process caches, and Issues1. Redundant prefix computation inside loops (minor / performance) In // Before (VTX loop):
for (key, value) in scan_prefix(tx, &keys::branch_vtx_prefix(branch_id)).await? {
let prefix = keys::branch_vtx_prefix(branch_id); // re-allocated per entry
...
}
// After:
let vtx_prefix = keys::branch_vtx_prefix(branch_id);
for (key, value) in scan_prefix(tx, &vtx_prefix).await? {
let suffix = key.strip_prefix(vtx_prefix.as_slice())...;
...
}The same applies to the PIDX and SHARD loops. 2. The module doc says "Tests and tooling use this." Compare to Nits3. Misleading comment on // Two single-chunk deltas plus one for the far page commit.
assert_eq!(snapshot.delta_chunk_rows, 3);All three commits produce single-chunk deltas; the comment implies only two are. Clearer: "Three commits, each producing one delta chunk row." 4. Assertion helpers repeat the same collect boilerplate five times
What looks good
|
No description provided.