restore_original
Roll back patched files by copying the original back, with optional SHA-256 verification to ensure integrity before overwriting.
Instructions
Copy original back to restore_target, optionally verifying the original's SHA-256 against expected_sha256 first.
This is the rollback primitive. The function:
Computes the SHA-256 of original.
If expected_sha256 is non-empty, verifies the computed hash matches (refuses to proceed otherwise).
Copies original to restore_target (overwriting).
Args: original: file whose bytes are the canonical "original" (typically the source the patch was applied from) restore_target: file to write the original bytes to (typically the patched copy) expected_sha256: optional hex-encoded SHA-256 to verify original against confirm_legal: free-text justification (audit trail)
Returns::
{
"original": "...",
"restore_target": "...",
"original_sha256": "<hash>",
"expected_sha256": "<hash>" or null,
"verified": bool,
"confirm_legal": "...",
}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| original | Yes | ||
| restore_target | Yes | ||
| expected_sha256 | No | ||
| confirm_legal | No |