pub fn append_outbox_record(peer: &str, record_bytes: &[u8]) -> Result<PathBuf>Expand description
Append a single JSONL record to the outbox for peer, holding the
per-path mutex to keep concurrent appenders from interleaving lines.
record_bytes should be the full canonical JSON of the signed event,
without trailing newline (the helper appends it). All bytes are written
in one write_all while the lock is held.
The peer arg is normalized to its bare handle (bob@relay.example →
bob) so the outbox filename is always <bare_handle>.jsonl. This is
the canonical form the push enumerator and daemon reader expect; the
normalization at this chokepoint guarantees correctness for every
future caller, even if they forget to bare_handle() first. The
original silent-fail of v0.5.11 was a caller that passed the FQDN
form (issue #2 — 25-minute message-loss incident, surface fix in
v0.5.13). This defense-in-depth makes the on-disk contract self-
enforcing instead of caller-policed.