- Every source file < 200 lines (test files may be longer). Split by concern (one protocol, one repo, one route group per file).
- Rust:
snake_case.rs; Swift/C#:PascalCase; docs/scripts:kebab-case. fsync-ffiholds adapters only — no business logic.fsync-protoholds wire types only — no I/O.
- Libraries (
fsync-proto,fsync-core,fsync-ffi):thiserrorenums, nounwrap()/expect()outside tests. - Binaries (
fsync-cli,fsync-backend):anyhowallowed at the edges. - Never log secrets, keys, tokens, clipboard content or file names.
- postcard (serde) for wire frames and signed bytes; JSON for HTTP.
- Protocols versioned by ALPN (
fsync/clip/2,fsync/file/1,fsync/pair/1). Never change v1 semantics — add v2. - Signatures are domain-separated (
"fsync-devlist-v1" || body).
- Secret material wrapped in
zeroizetypes; constant-time compares for MACs/codes. - No plaintext clipboard/file bytes ever reach backend or relay.
- No secrets in repo;
.env.exampleonly.
fsync-corefeaturestest-hooks(fault injection) andtest-relay-ca(trust a private relay CA fromFSYNC_TEST_RELAY_CA, modulenet/test_relay_ca.rs). Neither is default, and neither may reachfsync-ffi.fsync-cli/test-relay-cais enabled only by the netns harness (tests/e2e/netns/run-in-container.sh).scripts/build-xcframework.shandscripts/build-windows-dll.ps1fail the build ifcargo tree -e normal,build -p fsync-ffilists either feature. Keep it that way when adding a test feature.- Test certificates are generated per run and never committed.
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace.