Skip to content

test(protocol): skip non-UTF-8-filename round-trip where the fs rejects it (macOS APFS) - #70

Merged
hartsock merged 1 commit into
mainfrom
fix/non-utf8-filename-macos
Jul 19, 2026
Merged

test(protocol): skip non-UTF-8-filename round-trip where the fs rejects it (macOS APFS)#70
hartsock merged 1 commit into
mainfrom
fix/non-utf8-filename-macos

Conversation

@hartsock

Copy link
Copy Markdown
Member

What this PR does

Makes user_key::tests::save_load_roundtrip_non_utf8_filename portable. It plants a non-UTF-8 filename (b"user-\xff\xfe.key"); macOS APFS rejects that at File::create with EILSEQ (os error 92), so the test panicked on macOS while passing on Linux CI (ext4/xfs store the bytes verbatim). This is a filesystem-capability gap, not a product bug — UserKey::save/load handle OsStr paths fine; the OS refuses to create the file.

The fix runs a runtime probe (File::create a non-UTF-8 path); if the filesystem rejects it, the test prints skipping: filesystem rejects non-UTF-8 filenames (e.g. macOS APFS EILSEQ) and returns; otherwise it runs the full round-trip + refuse-to-overwrite assertions. This matches the repo's own convention — the sibling save_errors_on_readonly_parent_dir (user_key.rs:627) uses the same probe→skip pattern — and, unlike a #[cfg(target_os = "linux")] gate, keeps the test running on every capable unix (Linux CI, BSDs), weakening nothing where it runs. #[cfg(unix)] stays (the test uses OsStrExt).

Test plan

  • Before (macOS): FAILED — panic Io(Os { code: 92, … "Illegal byte sequence" }). After (macOS): skipping: …ok. On Linux the probe succeeds and the full assertions run.
  • cargo test -p agent-mesh-protocol → 110 pass. Full cargo test --workspace --exclude agent-mesh-py --no-fail-fast → all green, incl. the ratchet/transport crates a prior fail-fast run had left untested. (agent-mesh-py is a PyO3 crate that needs maturin, not plain cargo build — excluded.)
  • cargo fmt --check, cargo clippy --workspace --all-targets --exclude agent-mesh-py -D warnings, build — clean.

Out of scope

  • The agent-mesh-py PyO3 link under plain cargo build (a maturin-build-path artifact, not a defect).

…ts it

save_load_roundtrip_non_utf8_filename plants b"user-\xff\xfe.key" and
asserts save/load round-trips it. macOS APFS/HFS+ reject non-UTF-8
filenames at create with EILSEQ ("Illegal byte sequence", errno 92), so
the #[cfg(unix)] test panicked on macOS while passing on the Linux CI
runners. The failure is a filesystem-encoding limitation, not a bug in
UserKey::save/load, which handle OsStr paths fine.

Probe the filesystem at runtime: try to create the non-UTF-8 path and
skip (eprintln + return) when the fs won't hold it, matching the existing
skip convention in save_errors_on_readonly_parent_dir. This keeps the
round-trip assertion running everywhere the name is representable (Linux
CI and other unixes) instead of narrowing to a hardcoded target_os.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@hartsock
hartsock merged commit 66611d6 into main Jul 19, 2026
8 of 9 checks passed
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.

1 participant