# PSF1 decoder vectors

`vectors.json` is deterministic conformance data generated by the real Rust codec.
All values are synthetic; no recorded or licensed feed is used.

Regenerate from the repository root with:

```sh
cargo run -p schema --example psf1_vectors
cargo test -p schema golden_vectors_match_generator_and_decode_transactionally
```

The file embeds the production descriptor as a WebSocket `hello`. Start a fresh
stateful decoder for each case and decode its frames in order. Compare each result
with `expect` (the JSON mode frame); honor `decoder_schema` when present as the
application's older schema, while using the hello descriptor to consume wire fields.
Each invalid frame must be rejected without changing previously committed state.
Hex is uncompressed PSF1, without TCP or WebSocket framing.

`expect` uses the WebSocket JSON frame representation: `stream`, `seq`,
`tick_time`, `snapshot`, and `records` (record name → array of rows). Rows carry
`iid` and descriptor field names. f64 values are JSON numbers in real units,
including reconstructed quantized values, rather than integer quanta; compare the
parsed binary64 value bit for bit. f32 literals are widened to binary64. Decimals
are exact fixed-scale JSON strings (including trailing fractional zeros).
`time_ns` and header `tick_time` are signed JSON integers of UTC nanoseconds;
integer fields remain JSON integers, so use lossless integer parsing. Enums are
the descriptor's string labels, bools are JSON booleans, and text/date values are
strings. Explicit nulls are JSON `null`; absent fields are omitted. Empty records
are omitted from `records`, including `{}` for an empty frame.

For each `invalid[]` entry, create a fresh decoder. If `state_from_case` is a
case name, apply that **whole case**, in order, before attempting the invalid
frame; null means fresh state with no prior frames. Reject the invalid frame and
confirm that all committed state (sequences and numeric bases for every stream)
is unchanged. The golden test compares serialized state before and after each
rejection. Malformed vectors are built directly as bytes because the encoder
correctly refuses to emit them.
