Skip to content

Commit 84a2cbe

Browse files
committed
tests: clear the sealed attribute before corrupting a cached payload
`warm_hits_reject_corrupted_cached_bytes_with_a_valid_header` rewrites a byte of a cached payload to prove the warm path rejects it. The Unix arm relaxes the file mode to 0600 first; Windows has no equivalent, so the payload stayed read-only as the cache seals it and the write failed with `Access is denied` instead of exercising the rejection path. The Windows arm clears the read-only attribute before the rewrite. The assertion is untouched: the test still requires the warm path to reject the corrupted bytes. Validation: the test passes on x86_64-pc-windows-msvc. Design-Signed-Off-By: Hermes Agent (deepseek-v4.1-flash); design-review=1c01
1 parent 4999b11 commit 84a2cbe

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎helios/src/package/export.rs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,6 +1626,14 @@ mod tests {
16261626
use std::os::unix::fs::PermissionsExt;
16271627
std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o600)).unwrap();
16281628
}
1629+
// Sealed payloads are read-only on Windows, so the attribute is cleared before the
1630+
// corrupted-bytes rewrite, matching what the Unix mode change does above.
1631+
#[cfg(windows)]
1632+
{
1633+
let mut permissions = std::fs::metadata(&path).unwrap().permissions();
1634+
permissions.set_readonly(false);
1635+
std::fs::set_permissions(&path, permissions).unwrap();
1636+
}
16291637
use std::io::{Seek, SeekFrom, Write};
16301638
let mut file = OpenOptions::new().write(true).open(&path).unwrap();
16311639
file.seek(SeekFrom::Start(offset + 1)).unwrap();

0 commit comments

Comments
 (0)