Are you an LLM? You can read better optimized documentation at /protocols/sbp/conformance.md for this page in Markdown format
SBP Conformance Tests (v0.1 plan)
Authority: Supporting (Test specification)
Purpose: Test vectors, fixtures, and validation checklist for SBP implementations.
Status: Stub — This document is a plan and not a complete conformance suite.
Lightweight checklist for cross-implementation compatibility. Use deterministic fixtures; avoid network in golden tests.
Fixtures
- Frame vectors: encode/decode golden cases for each frame kind (with fixed 16-byte
frameIdvalues), using fixed inputs forsubject,body,message,ackId,code. - Handshake payloads: valid base case; invalid protocol/version; missing
peerId; oversized metadata. - Error cases: malformed headers (short buffer, bad lengths), invalid frameId length (not 16 bytes), reserved flag bits set, unknown frame kind, incomplete payload for each frame kind.
Invariants to assert
- Round-trip encoding:
decode(encode(frame))yields the same structure for all supported frames. - Frame ID validity:
frameIdMUST be exactly 16 bytes (opaque binary). Equality checked by byte-wise comparison. - Reserved bits: any non-zero reserved flag bit MUST throw
InvalidFrame. - Length guards: subject length mismatch and message length mismatch MUST throw
InvalidFrame. - Handshake validation: wrong protocol/version MUST throw
UnsupportedVersion; missing required fields MUST throwInvalidFrame. - Ack frame ID: must reference exactly 16 bytes from another frame's
frameId.
Subject namespace validation
- MUST reject unknown subjects (e.g.,
foo/bar) withErrorFrame{code=1002} - MUST reject
streamin v1 withErrorFrame{code=1003} - MUST set
ErrorFrame.idto the offending frame'sframeId - MUST continue processing after rejection (non-fatal)
- MUST accept valid channels (
rpc,event) andapp/prefix - Round-trip: valid subjects route without error
Negative fuzzing
- Feed random/oversized buffers into
decodeFrame; expect bounded error handling (no crashes/hangs) andInvalidFrame. - Bound
ErrorFrame.messagelength to implementation limit; ensure rejection path is consistent. - Malformed RPC envelope MUST emit
ErrorFrame, notRpcError.
Transport-shared expectations
- Ordering: encoded frame sequences preserve order after decode.
- Unicode: subjects/messages are UTF-8; invalid UTF-8 MUST be rejected when decoded to string fields.
- Limits: frames exceeding configured size caps MUST yield
ProtocolViolationand closure.