fix(tests): make unwritable-path tests actually unwritable on Windows (V2-1043) - #176
Conversation
… (V2-1043)
Two adaptive.rs tests built their "impossible" path under the Unix root
("/nonexistent_.../..."), assuming create_dir_all must fail there. On
Windows that resolves to a creatable directory under C:\, so:
- save_snapshot_to_unwritable_dir_does_not_panic failed on every
Windows box (the snapshot was written and the !exists assert
tripped), and
- save_with_timeout_returns_promptly_on_fast_failure silently stopped
testing the fast-fail path (mkdir succeeded, so it timed a
successful write instead),
and both littered directories at the drive root.
Route the path through a tempfile::NamedTempFile instead: a parent
component is an existing regular file, so create_dir_all fails on
every platform and nothing is left behind.
ant-core lib suite is now fully green on Windows (452/452).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Review verdict: APPROVE at Routing the failure through an existing regular file is deterministic across Windows/Unix and actually exercises the intended The remaining red checks are the repository-wide |
jacderida
left a comment
There was a problem hiding this comment.
Approved. Verified the diff is confined to test code inside #[cfg(test)] — no shipped code is touched; routing the path through a NamedTempFile makes create_dir_all fail on every platform rather than relying on Unix root-write semantics.
The two red checks on this branch are the known repo-wide baselines, both already fixed on main: Security Audit was RUSTSEC-2026-0258 (h2 0.4.14), cleared by #177, and Merkle E2E (ubuntu) was killed at the 60m cap, raised to 90m by #178. Neither is attributable to this diff.
Linear issue
V2-1043
Risk tier
Test-only change; no shipped code touched.
Compatibility
Semver impact
Test evidence
Both tests assumed a path under the Unix root is uncreatable; on Windows it resolves to a creatable
C:\directory, sosave_snapshot_to_unwritable_dir_does_not_panicfailed on every Windows dev box andsave_with_timeout_returns_promptly_on_fast_failuresilently timed a successful write instead of a fast failure — and both littered directories at the drive root. The fix routes the path through atempfile::NamedTempFileso a parent component is a regular file andcreate_dir_allfails on every platform.cargo test -p ant-core --libnow fully green, 452/452; confirmed no drive-root litter is recreated.cargo clippy --all-targets --all-features -- -D warningsclean,cargo fmt --checkclean.New dependency
none (
tempfileis already a dev-dependency used by neighboring tests)ADR
n/a
Mitigation / rollback
Test-only — revert the single commit.
🤖 Generated with Claude Code