hashlog cli#3676
Conversation
PR SummaryLow Risk Overview
Unit tests cover renderers and an end-to-end path through the public hashlogger writer and reader APIs. Reviewed by Cursor Bugbot for commit ed399c8. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
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 ed399c8. Configure here.
| } | ||
| if len(result.diffs) == 0 { | ||
| ew.printf("Archives are identical over the compared range.\n") | ||
| return ew.err |
There was a problem hiding this comment.
False identical message max-diffs zero
Medium Severity
When compare runs with --max-diffs=0, CompareHashes can return no pairs even if the archives differ, because the reader stops before recording the first difference. Text output still prints that the archives are identical over the compared range, which can hide a real mismatch.
Reviewed by Cursor Bugbot for commit ed399c8. Configure here.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3676 +/- ##
==========================================
- Coverage 58.97% 58.01% -0.96%
==========================================
Files 2266 2180 -86
Lines 187181 177628 -9553
==========================================
- Hits 110390 103057 -7333
+ Misses 66852 65433 -1419
+ Partials 9939 9138 -801
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
A well-tested, read-only CLI for inspecting hashlog archives. One edge-case correctness issue: --max-diffs=0 causes divergent archives to be falsely reported as identical. Cursor's review produced no output.
Findings: 0 blocking | 3 non-blocking | 1 posted inline
Blockers
- None at the file/PR level.
Non-blocking
- Cursor's second-opinion review file (cursor-review.md) was empty — that pass produced no output.
- Negative
--max-diffsvalues other than-1(e.g.-5) are silently treated as "all diffs" and never trigger the truncation warning. Consider validating the flag to accept only-1or non-negative values. - 1 suggestion(s)/nit(s) flagged inline on specific lines.
| } | ||
| cmd.PersistentFlags().Uint64("low", 0, "Lowest block to compare (inclusive); requires --high") | ||
| cmd.PersistentFlags().Uint64("high", 0, "Highest block to compare (inclusive); requires --low") | ||
| cmd.PersistentFlags().Int("max-diffs", -1, "Maximum number of differing blocks to report, or -1 for all") |
There was a problem hiding this comment.
[suggestion] --max-diffs=0 produces misleading output for divergent archives. In compareBlockRange the cap is checked as len(diffs) >= maxDiffCount (hash_log_reader.go:338) before appending, so with maxDiffCount=0 the loop breaks at the first differing block and returns an empty slice. renderCompare then sees len(diffs) == 0 and prints "Archives are identical over the compared range." — a false negative for a tool whose entire purpose is detecting divergence. Reject 0 (and other invalid negatives) here, or distinguish "no diffs found" from "capped at 0" in renderCompare so an empty result is never reported as proof of identity.


Describe your changes and provide context
CLI tooling for reading hashlog archives.
Testing performed to validate your change
Unit tests, hand tests