test(protocol): skip non-UTF-8-filename round-trip where the fs rejects it (macOS APFS) - #70
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Makes
user_key::tests::save_load_roundtrip_non_utf8_filenameportable. It plants a non-UTF-8 filename (b"user-\xff\xfe.key"); macOS APFS rejects that atFile::createwith 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/loadhandleOsStrpaths fine; the OS refuses to create the file.The fix runs a runtime probe (
File::createa non-UTF-8 path); if the filesystem rejects it, the test printsskipping: 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 siblingsave_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 usesOsStrExt).Test plan
FAILED— panicIo(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. Fullcargo 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-pyis a PyO3 crate that needs maturin, not plaincargo build— excluded.)cargo fmt --check,cargo clippy --workspace --all-targets --exclude agent-mesh-py -D warnings, build — clean.Out of scope
agent-mesh-pyPyO3 link under plaincargo build(a maturin-build-path artifact, not a defect).