Guarantees
These statements are tested, not aspirational. The executable definitions live
in tests/testkit/tests/guarantees.rs and the golden vectors in
tests/vectors/.
| Guarantee | Precise meaning |
|---|---|
| Bound | Every delivered Predicted value is within the field’s declared tolerance of the sender’s true final value, after quantisation and casting. |
| No silent staleness | After startup, a gap or a failed decode, affected fields are Unknown until re-validated. Losing exactly a multiple of 256 consecutive frames is the documented exception. |
| Self-stabilisation | A delivered Reset makes the decoder’s predictor state equal to the encoder’s for that field. |
| Determinism | Identical inputs give identical frame bytes and predictor-state hashes on every supported platform. |
| Containment | A rejected frame leaves predictor state and trust unchanged; only named diagnostic counters may change. |
Test envelope
The guarantee suite runs 200 seeds × 192 frames × four channel profiles: clean,
5% Bernoulli loss, 25% Bernoulli loss, and a Gilbert-Elliott burst profile.
Each run includes adjacent reordering, duplication and single-bit payload
corruption. The decoder uses resync_n = 1; the encoder uses K = 8,
K_R = 32 and max_resets_per_frame = 8.
Gap-rule cost (counterfactual)
These numbers are not observed bandwidth. The sender has no feedback, so its
frames are identical whether or not the receiver has lost data. The table
estimates what a sender with feedback would spend if it sent true values instead
of compact Predicted values during windows where receiver fields are
untrusted.
For each delivered frame, the test adds a field’s payload cost when that field
was untrusted before the frame and the frame used Predicted. It divides the
total by all committed frames (200 × 192 = 38,400). In the guarantee signal,
the five numeric fields and the enum each cost 1 byte, the string costs 7 bytes
and the list costs 4 bytes.
| Loss profile | Hypothetical extra bytes per committed frame |
|---|---|
| 0% (clean) | 0.000 |
| 5% Bernoulli | 6.341 |
| 25% Bernoulli | 6.140 |
| Burst | 6.042 |
The cost stays near 6 B/frame rather than rising with loss: more loss creates more untrusted windows but also drops frames that would contribute to them, and frequent resets truncate those windows. Reproduce it with:
cargo test -p predsync-testkit --test guarantees \
conservative_gap_rule_extra_bytes_report -- --exact --nocapture
The other guarantees were unaffected in that run: delivered predicted values stayed in bounds, no field was predicted from untrusted state outside the exact 256-frame blind spot, delivered resets converged state hashes, rejected frames did not change them, and two identical simulations produced identical bytes.
Cross-platform determinism
pixi run qemu-determinism runs the same no-alloc scenario on the host and on a
Cortex-M4 under QEMU. It compares frame bytes, decoded views and encoder/decoder
state hashes, and fails if any digest differs between the two targets.
Scope limits
- Custom C/Python predictor callbacks are outside the cross-platform bit-exactness guarantee; their floating-point behaviour is the caller’s responsibility.
- Transport framing is a host responsibility. The protocol assumes exactly one
complete frame per
feedcall. - Frames do not identify senders. Separate streams are mandatory.