blake3: check-mode interop fixes and parser polish#3782
Merged
jqnatividad merged 2 commits intomasterfrom Apr 29, 2026
Merged
Conversation
- check_mode: compare hashes with eq_ignore_ascii_case so checksum files containing uppercase hex verify correctly (matches blake3's Hash::from_hex case-tolerant parsing). - parse_standard_line: also accept binary-mode `<hash> *<filename>` separator alongside the text-mode two-space form for interop with standard *sum tooling. - parse_tag_line: drop unreachable strip_prefix defensive branch (caller already gates on the `BLAKE3 (` prefix); use fail_clierror! consistently for the single failure path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… check-mode tests - parse_tag_line: switch raw slicing back to strip_prefix(...).expect(...) so the caller-side prefix invariant is documented and a violation panics with a clear message instead of an opaque slice OOB. - tests: cover the two new check_mode behaviors and a malformed-separator guard (uppercase hex round-trips OK, `<hash> *<filename>` binary-mode separator round-trips OK, single-space-without-asterisk errors). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves qsv blake3 --check interoperability with checksum files produced by other tools by making hash comparisons case-insensitive and expanding accepted checksum line formats, with accompanying regression tests.
Changes:
- Make
--checkhash comparisons ASCII-case-insensitive so uppercase hex in checksum files verifies correctly. - Extend standard checksum parsing to accept both text-mode (
<hash>␠␠<filename>) and binary-mode (<hash>␠*<filename>) separators. - Add tests covering uppercase-hex verification, binary-mode separator parsing, and malformed-separator error behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/cmd/blake3.rs |
Updates check-mode comparison logic and broadens checksum line parsing for better interop. |
tests/test_blake3.rs |
Adds regression tests for uppercase hex, binary-mode separator acceptance, and malformed separator rejection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
check_mode: compare hashes witheq_ignore_ascii_caseso checksum files containing uppercase hex verify correctly (matches blake3'sHash::from_hexcase-tolerant parsing).parse_standard_line: also accept the standard*sumbinary-mode<hash> *<filename>separator alongside the text-mode two-space form for interop with files produced by other tooling.parse_tag_line: make the caller-sideBLAKE3 (prefix invariant explicit viastrip_prefix(...).expect(...)and usefail_clierror!consistently for the single failure path.Test plan
cargo test blake3 -F all_features— 23/23 pass (3 new + 20 existing)cargo clippy --bin qsv -F all_features --no-deps -- -D warnings— clean🤖 Generated with Claude Code