CultLib/packages/cultmesh-rs/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens 36f31920ce Let a caller choose what the media channel does
`media` was hardcoded Reliable in two places — the profile builder and the
per-channel send options — so no caller could ask for anything else.

Measured on Raven through `cultnet-impair`, 848-byte packets at 12 Mbps, which
is Muninn's real media shape:

    profile    mode          delivered    ack bytes
    clean      unreliable      100.00%           43
    clean      reliable         69.10%      131,322
    loss 1%    unreliable       98.95%           43
    loss 1%    reliable         72.00%      135,837
    loss 3%    unreliable       96.73%           43
    loss 3%    reliable         73.30%      138,030

A reliable media channel loses 31% of a clean 12 Mbps offer, and its delivery
barely moves as loss rises, so loss is not the binding constraint — it cannot
carry the rate. An unreliable one holds everything on a clean link and then
degrades by about the loss injected. The reverse channel differs by three orders
of magnitude.

Muninn wanted the unreliable lane and had no way to say so. It signalled the
intent the only way the API allowed, by passing no reliable expiry, and its own
test has asserted Unreliable and failed since it was written. With this change
it passes.

Delivery now comes from the advertised profile, resolved by `channel_delivery`
alongside the `channel_reliable_expire_after_ms` that already worked this way.
That removes the send path's private opinion about reliability, so the profile a
peer was shown and the behaviour it gets cannot disagree. The channels whose
semantics are fixed by design — schema reliable and ordered, realtime unreliable
— are untouched and pinned by a test.

`media_delivery: None` means Reliable, so no existing consumer changes
behaviour. It is still source-breaking for anyone constructing the three options
types with a struct literal rather than `::client(...)`: two sites in
cultmesh-rs, four in Muninn, seven across the test suites here, all mechanical.
An earlier draft claimed Muninn was unaffected; the compiler disagreed.

The `examples/media_delivery_probe.rs` added here is what produced the table, so
the claim can be re-run rather than believed. Note its sender-side wire-cost
figure is unsound for the reliable case: the sender stops draining after five
seconds while retransmission is still in flight, so those byte counts
under-report. The delivery percentages are receiver-measured and stand.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-10 01:08:31 +02:00
..
rudp_document_server.rs Let a caller choose what the media channel does 2026-09-10 01:08:31 +02:00