open-standards/wai/live-conformance/termination/README.md
2026-10-22 13:47:44 -04:00

65 lines
4.1 KiB
Markdown

# live-conformance/termination — stream termination and the display match
The corpus of [`extensions/stream-termination.md`](../../extensions/stream-termination.md) §8
and of the display match of
[`extensions/capability-constraints.md`](../../extensions/capability-constraints.md) §4:
display declarations against ladders, and stream logs a sink signed (`WSL1` records), each with
the outcome a verifier gives it.
**Equivalence.** For each match, a conforming implementation given the `declaration`, the
`ladder` and the `rendition` reaches the `exceedances` of that rendition, its `match`, the
ladder's `admissible` renditions and its `least` (capability-constraints §4.2). For each log, a
conforming verifier given its `records` (hexadecimal, in order) reaches the outcome stated
(stream-termination §6.3):
- `refuse`: the `reason` and `at`, the index of the record refused;
- `accept`: `record_count` and `segments`; `media` (`video` or `audio`); `terminated`, the
reason of the terminate record or `null` for an open log, and `media_end`, its media time;
the `totals` (by role and class: figures and joules) and `unmetered` counts (by role) of the
segment receipts; the roles `absent` from every segment receipt; for video, `panel` (the
segments within the declaration in effect, and those served under `none_within`),
`unseen_us` and `unwatched` (the segments made after the sink's grace had run out while the
stream was unseen, with their totals and unmetered counts); `null` for each of those three
for audio.
A verifier that reaches another outcome, reason, index or fact does not conform.
**Provenance.** Generated here: `wai_stream_termination_vectors gen` writes `vectors.json`
from records written in code, from fixed seeds: each key is SHA-256 of the corpus's fixed
label and an index, each stream and segment digest SHA-256 of another fixed label and a name,
every time is a constant (from 2026-10-16T00:00:00Z), and Ed25519 signing is deterministic
(RFC 8032), so the file is the same bytes on every machine. The panels, ladders, timings and
joule figures are synthetic, chosen to exercise the rules, and were measured by nothing: the
corpus claims nothing about the energy any device spends or any termination saves. The
generator asserts that each log reaches the outcome it was written to have before it writes it.
## Layout
One file, `vectors.json`:
- `sink_keys`: the public keys the logs are signed with (informative): the video sink's, a
stranger's (`sink_changed`), and the audio sink's.
- `matches`: within; each exceedance alone (resolution, refresh, bit depth, an HLG rendition
on an SDR panel) and every one together; both orientations; a refresh rate of 59.94 under a
panel declared at 60; a PQ rendition on an HDR panel; a panel smaller than every rendition,
its least admissible and the other not; the least by frame rate, by range and in a tie.
- `logs`: accepted, a video stream terminated as hidden after its grace with a segment counted
unwatched; as occluded and as display off; as idle after interactions; as autoplayed with no
interaction; stopped by the viewer, its sink decode under two classes; an audio stream that
goes on while hidden; an open log; a panel smaller than every rendition; display records
that change the declaration down and back up; a hidden document observed hidden twice; an
HDR panel. Refused, each reason of §7 and the codes it reuses (`truncated`, `malformed`,
`unknown_version`, `bad_key`, `bad_signature`, `energy_invalid`), each a control of one
defect.
## Regenerate and verify
```
cd wai/wai-rs
cargo run --no-default-features --features stream_termination --bin wai_stream_termination_vectors -- gen ../live-conformance/termination
cargo run --no-default-features --features stream_termination --bin wai_stream_termination_vectors -- verify ../live-conformance/termination
cargo test --no-default-features --features stream_termination --test stream_termination
cd ..
python3 -I live-conformance/stream_termination_verify.py live-conformance/termination
python3 -I live-conformance/stream_termination_verify.py --log <log.json> # one log a sink signed
```