Skip to content

fix(tests): make unwritable-path tests actually unwritable on Windows (V2-1043) - #176

Merged
jacderida merged 1 commit into
mainfrom
nic/v2-1043-windows-unwritable-dir-test
Aug 25, 2026
Merged

fix(tests): make unwritable-path tests actually unwritable on Windows (V2-1043)#176
jacderida merged 1 commit into
mainfrom
nic/v2-1043-windows-unwritable-dir-test

Conversation

@Nic-dorman

Copy link
Copy Markdown
Member

Linear issue

V2-1043

Risk tier

  • T0 — docs / tooling / CI / pure UX-output. Repo CI only.
  • T1 — client-only, no network-facing behavior change. CI + prod compat smoke.
  • T2 — node/client logic with behavioral surface, no protocol/format/economics change. Dev testnet + ADR.
  • T3 — protocol / storage format / payments / routing. T2 evidence + adversarial testing.

Test-only change; no shipped code touched.

Compatibility

  • Wire: none
  • Storage: none
  • API: none

Semver impact

  • breaking
  • feature
  • fix

Test evidence

Both tests assumed a path under the Unix root is uncreatable; on Windows it resolves to a creatable C:\ directory, so save_snapshot_to_unwritable_dir_does_not_panic failed on every Windows dev box and save_with_timeout_returns_promptly_on_fast_failure silently timed a successful write instead of a fast failure — and both littered directories at the drive root. The fix routes the path through a tempfile::NamedTempFile so a parent component is a regular file and create_dir_all fails on every platform.

  • Windows 11 (previously failing environment): both tests pass; full cargo test -p ant-core --lib now fully green, 452/452; confirmed no drive-root litter is recreated.
  • cargo clippy --all-targets --all-features -- -D warnings clean, cargo fmt --check clean.
  • Linux/macOS behavior unchanged (path is uncreatable there under either construction); repo CI covers it.

New dependency

none (tempfile is already a dev-dependency used by neighboring tests)

ADR

n/a

Mitigation / rollback

Test-only — revert the single commit.

🤖 Generated with Claude Code

… (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>
@dirvine

dirvine commented Aug 21, 2026

Copy link
Copy Markdown
Member

Review verdict: APPROVE at c437471b025ff876cbb9035e06fbb57adc4f9af2.

Routing the failure through an existing regular file is deterministic across Windows/Unix and actually exercises the intended create_dir_all error path without relying on Unix permission semantics. The focused local test passed: save_snapshot_to_unwritable_dir_does_not_panic1 passed; the PR's Windows CI is also green. I found no diff-specific blocker.

The remaining red checks are the repository-wide h2 security audit and the pre-existing Ubuntu Merkle E2E timeout/cancellation.

@jacderida jacderida left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@jacderida
jacderida merged commit 00bd2e1 into main Aug 25, 2026
13 of 15 checks passed
@jacderida
jacderida deleted the nic/v2-1043-windows-unwritable-dir-test branch August 25, 2026 21:00
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.

3 participants