Backport release/v6.7: Validate snapshots before publication - #4054
Conversation
Reject malformed node hashes before writing snapshot records and validate completed snapshots before updating the current symlink. Add regression coverage for partial leaf records and corrupt snapshot publication. (cherry picked from commit f28da4c)
PR SummaryHigh Risk Overview Introduces Startup: Reviewed by Cursor Bugbot for commit aa44ba7. Bugbot is set up for automated code reviews on this repo. Configure here. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/v6.7 #4054 +/- ##
================================================
- Coverage 61.33% 60.61% -0.73%
================================================
Files 2163 2083 -80
Lines 188823 180280 -8543
================================================
- Hits 115813 109274 -6539
+ Misses 62286 60984 -1302
+ Partials 10724 10022 -702
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit aa44ba7. Configure here.
| } | ||
| if renameErr := os.Rename(path, targetPath); renameErr != nil { | ||
| return fmt.Errorf("rename snapshot directory to %q: %w", targetPath, renameErr) | ||
| } |
There was a problem hiding this comment.
Snapshot replacement can orphan current
High Severity
When replacing a corrupted snapshot, publishSnapshot removes the existing target before the validated temp is renamed into place. A failed second rename or a crash in that window, then cleanupFailedSnapshotRewrite, deletes the replacement too and leaves current dangling. createDBIfNotExist then refuses to open the store.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit aa44ba7. Configure here.


Backport of #4036 to
release/v6.7.