Skip to content

fix: harden core error handling, blob verification, and force-mode reporting#56

Merged
Wenxin-Jiang merged 1 commit intomainfrom
fix/core-hardening
Apr 7, 2026
Merged

fix: harden core error handling, blob verification, and force-mode reporting#56
Wenxin-Jiang merged 1 commit intomainfrom
fix/core-hardening

Conversation

@Wenxin-Jiang
Copy link
Copy Markdown
Contributor

Summary

Three independent hardening fixes in socket-patch-core:

  • read_manifest error propagation (MEDIUM-2): Non-NotFound I/O errors (permissions, disk failures) and JSON parse/validation errors are now propagated as Err instead of silently mapped to Ok(None). Users see the real error ("Permission denied") instead of the misleading "Invalid manifest".
  • Blob hash verification at download (LOW-1): download_hashes now computes git_sha256 on downloaded content and verifies it matches the expected hash before writing to disk. Corrupt downloads are rejected with a "Content hash mismatch" error.
  • --force + all NotFound reporting (MEDIUM-1): apply_package_patch now distinguishes all-AlreadyPatched from all-NotFound-skipped. When every file is NotFound under --force, the result is still success: true (to not break CI) but includes an informational error message: "All patch files were skipped: N not found on disk (--force)".

Test plan

  • cargo check --workspace --all-features compiles
  • cargo test -p socket-patch-core passes (255 tests)
  • cargo test -p socket-patch-cli passes
  • Manual: make manifest file read-only, run apply — should show real permission error
  • Manual: run apply --force against a package where all files are missing — should succeed but show skip message

🤖 Generated with Claude Code

…porting

- Propagate real I/O and parse errors from read_manifest instead of
  silently returning Ok(None), so callers see the actual failure reason
- Verify downloaded blob content hash before writing to disk, rejecting
  corrupted or mismatched data at fetch time
- Distinguish all-AlreadyPatched from all-NotFound in --force mode,
  surfacing an informational message when patch files are skipped

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Wenxin-Jiang
Copy link
Copy Markdown
Contributor Author

@claude review once

@Wenxin-Jiang Wenxin-Jiang merged commit d25e60c into main Apr 7, 2026
19 checks passed
@Wenxin-Jiang Wenxin-Jiang deleted the fix/core-hardening branch April 7, 2026 18:51
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.

2 participants