Add checksum verification for completed downloads - #25
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c3a8dbc2e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| item.fileLocationPath = destinationURL.path | ||
| item.preferredFilename = destinationURL.lastPathComponent | ||
| item.computedSHA256 = item.expectedSHA256 == nil ? nil : try SHA256Checksum.hashFile(at: destinationURL) |
There was a problem hiding this comment.
Move checksum hashing off the main actor
When a direct download has an expected checksum, this hashes the entire completed file synchronously from finalizeFileDownload; because DownloadCenter is @MainActor, large downloads will keep the UI and queue management blocked until every byte has been read, so multi-GB files can make the app appear hung and delay starting the next queued download. Consider computing the digest off the main actor and applying the result back on the main actor.
Useful? React with 👍 / 👎.
| return nil | ||
| } | ||
|
|
||
| return expectedSHA256 == computedSHA256 ? .verified : .failed |
There was a problem hiding this comment.
Expose retry for checksum failures
For a direct download that completes with a mismatched expected SHA-256, this returns .failed while the item's status stays .completed; the existing detail, context-menu, and toolbar retry paths are still gated on status == .failed || status == .cancelled, so the exact item that shows Checksum failed has no retry action and users must manually recreate the download to recover.
Useful? React with 👍 / 👎.
Summary
Validation
xcodebuild -project Harbor.xcodeproj -scheme Harbor -configuration Debug buildgit diff --checkCloses #17