# live-conformance/ad-traffic — invalid-traffic rules The corpus of [`extensions/ad-presentation.md`](../../extensions/ad-presentation.md) §14 and [`extensions/stitched-presentation.md`](../../extensions/stitched-presentation.md) §12: the rules a verifier applies to the impressions it states, each decided from signed records by comparing bytes and integers. - `rooms.json` holds `rooms`, each a room the ad-presentation verifier accepts, in the form of [`../presentation/README.md`](../presentation/README.md) with everything that verifier states; and `vectors`, each naming its `room`. - `stitched.json` holds one `stream`: the `manifests` (their text), `records` and `claims` the stitched verifier is given, with the `record_facts`, `claim_facts` and `spend` it states ([`../stitched/README.md`](../stitched/README.md)); and `vectors` over it. Both hold the `creatives`, `issuers` (and `signers`) their verifiers hold; `lists`, the two pinned lists with their bytes, digests, sources and entries as text; and `keys`, the public keys of the corpus's edges, attesters, devices and session keys, for a reader. Every address is a documentation address and every crawler token names a crawler that does not exist. **A vector** gives a verifier, beside its room or the stream: `traffic_policy` (`WTP1`, or `null` for none), `origins` (`WSO1`), `bindings` (`WDB1`) and `lists` (the lists it holds), each hexadecimal. `origin_about` and `binding_about` say what each record is, and are not checked. Its `traffic` is what a conforming verifier states (ad-presentation §14.7): - `outcome` `refuse` with its `reason`, when the policy does not read, verify or bind, or a list is not held or does not read; otherwise `accept`, and: - `policy`, its digest or `null`; `origin_facts` and `binding_facts`, each record's `digest` and `player` (`null` when it does not read) and its `verdict`, `accepted` or a reason; `devices`, each device key with its `sessions` and the indices of the `bindings` that give them, in ascending order of the key; - `impressions`, each with where it is (`receipt` and `slot`; in `stitched.json` `record`, `slot` and its own `claim`), its `price_micros`, whether the base verification `counts` it, its `traffic` verdict (`valid`, `invalid`, `undecided`), the `rules` that refuse it, each with its `code` and what it rests on (`claims`, `origin` and `binding` by index among those given, `entry` by index in its list, `device` and `sessions`), and its `undecided` marks; - `rules`, for each rule its `impressions`, and of those the ones that counted, `excluded`, with `excluded_micros`; `undecided`, for each mark its `impressions`, `withheld` and `withheld_micros`; - `totals`: `impressions`, `counted`, `valid`, `invalid`, `undecided`, `excluded`, `withheld`, and `presented_spend_micros`, `excluded_micros`, `withheld_micros` and `valid_spend_micros`; and each receipt's or record's valid spend (`receipt_valid_spend_micros`, `record_valid_spend_micros`). A sum of prices is a number in `rooms.json` and an object by currency in `stitched.json`. In every vector the presented spend is the excluded, the withheld and the valid spend together, and every impression is in exactly one of valid, invalid and undecided: an impression a rule refuses is counted as excluded, never left out. A verifier that states anything else of a vector does not conform. One that leaves out a rule states another `traffic` for some vector: without the duplicate rule, session 42's second claim of one impression passes in `room_no_policy`, and the vector refuses that verifier. ``` cd wai-rs && cargo run --features stitched_presentation --bin wai_ad_traffic_vectors -- verify ../live-conformance/ad-traffic python3 -I live-conformance/ad_traffic_verify.py live-conformance/ad-traffic ``` The first is the reference: it regenerates both files from their fixed seeds and requires them byte for byte, gives every vector its statement, and turns each rule off in turn. `wai_ad_traffic_vectors gen` writes the files. The second is the second implementation, written from the extensions' text and sharing no code with `wai-rs`: it verifies the rooms and the stream with the ad-presentation and stitched corpora's second implementations, judges every vector itself, mutates copies of the corpus and requires each to fail, and drops each rule and each of its checks in turn.