Skip to content

Add checksum verification for completed downloads - #25

Open
thsnkhn wants to merge 1 commit into
mainfrom
issue-17-checksum-verification
Open

Add checksum verification for completed downloads#25
thsnkhn wants to merge 1 commit into
mainfrom
issue-17-checksum-verification

Conversation

@thsnkhn

@thsnkhn thsnkhn commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add optional SHA-256 input for direct downloads.
  • Persist expected and computed checksums for completed downloads.
  • Show Verified or Checksum failed in list/detail UI without moving mismatches out of Completed.

Validation

  • xcodebuild -project Harbor.xcodeproj -scheme Harbor -configuration Debug build
  • git diff --check

Closes #17

@thsnkhn

thsnkhn commented Jun 14, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@thsnkhn
thsnkhn marked this pull request as ready for review June 14, 2026 12:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add checksum verification for completed downloads

1 participant