open-standards/wai/live-conformance/ledger
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science ba9c439cf9 receipt-ledger §5.2: one registry of record kinds; the job kinds are 14 to 16
Kinds 10 to 13 were already revenue-share §7.4's run and invoice and
opportunity-report §7.3's cue event and room policy; the job source's OER/2
receipt, int_motion decode receipt and route record took 10 to 12 and so meant
two things. They are now 14, 15 and 16. §5.2's table registers every kind a
WAI text names a record by, 10 to 13 pointing to the texts that define them,
unchanged, and those texts say so. Kinds 128 to 255 are reserved for private
and provisional use: a WAI record never states one, and an invoice that lists
one is refused private_kind, in either version. A version-2 invoice lists kinds
1 to 9 and 14 to 16, never another text's. Three controls; the corpus and both
implementations follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-30 00:51:06 -04:00
..
README.md receipt-ledger: media jobs under a tariff of version 2 2026-10-29 20:49:57 -04:00
vectors.json receipt-ledger §5.2: one registry of record kinds; the job kinds are 14 to 16 2026-10-30 00:51:06 -04:00

live-conformance/ledger — the receipt ledger

The corpus of extensions/receipt-ledger.md §11, in one file, vectors.json:

  • sources: the sources the vectors bill from, by name, each a source document of §5.1;
  • vectors: verification documents (§7.1), each a tariff, an invoice, the previous invoice or null, and the names of its sources in order, with the outcome §7.3 gives it;
  • keys: the seller's, the buyers' and the two delivering parties' public keys.

Ledger equivalence. For each vector, a conforming verifier given its tariff, its invoice, its previous invoice and its sources, resolved by name, reaches the outcome the vector states:

  • refuse: the reason and where, at: ["tariff"], ["tariff", "seller"] or ["tariff", "buyer"], ["invoice"], ["previous"], ["source", k] for source k, or ["source", k, …] followed by the place the source's own extension gives (live-metering §5.1, settlement §8.2, packaging §9, live-ads §9.2);
  • accept: the invoice's digest, its tariff, currency, start and end, the number of records, each line (its source kind, source, unit, quantity, price, amount and the records it cites, each [kind, identity]), each energy row (scope, class, figures, joules and max_ppm), the unmetered figures and coverage of each scope, the amount, and the reports of §8: ads, one per ads source, and delivery, the parties and their overlaps.

The accepted vectors:

  • a_day: one day's invoice over a lesson room, two delivering parties (one viewer acknowledges part of one object from both, in windows that overlap; one party serves a fetch free; the other declares delivery to viewers with no key), a viewer that forwarded sealed objects and states no tariff of its own, a package, ads under a policy that requires presentation claims and under one that does not;
  • the_next_invoice: the next invoice of the chain, over a relay's session whose hop is unmetered (its room energy is partial) and a second package;
  • room_hops_of_three_classes: a room whose hops are a model, a counter and an estimate, under a tariff of its own: one row each;
  • streams_stitched_by_others: presentations of ads another party stitched, from three vectors of stitched/ (hls_stitched; form1_prefetch, whose form-1 receipt states its own quartiles and spend beside the presented ones; and squeezeback, a shared break whose sessions' own claims are not all presented), under a tariff whose ad scope is the stitchers that corpus accepts; its report is stitched-presentation §7.5's statement, unchanged;
  • jobs_routed_and_served (version 2, §4.5): a month of media jobs routed by the route corpus's router, beside a package, under a tariff of version 2 that prices wai.video.int_motion per job and per subpixel and wai.video.av1 per job: the served int_motion jobs are billed from their billed hop and their output's decode receipt (work_pixel_ops); the failover is billed at the fallback's price; the job served past its deadline and the one every allowed hop failed bill nothing; the jobs' energy is the serving hops' figures, a counter row and a model row, and the job whose serving hop was unmetered is counted unmetered (coverage partial).

Every other vector is refused, a control of one defect: each reason of §10, the reused codes, and a refusal of each source kind by its own extension.

Provenance. Generated here: wai_receipt_ledger_vectors gen writes vectors.json from fixed seeds (the seller, the buyers, the two delivering parties, their viewers and objects) and from sources taken unchanged from the corpora of the extensions the ledger reads: rooms and their receipts from metering/ (lesson, mixed_classes, receipt_bad_signature, relay_recorded), the forwarding viewer's statement and the room its hop records name from settlement/, ad rooms from ads/ (live_break, gap) and presentation/ (video_rule, ceiling_exceeded_by_presented), streams stitched by others from stitched/ (hls_stitched, form1_prefetch, squeezeback, with the manifests, responses and receipts they name, by their bytes), media jobs from routes/ (served_first_try, failover_after_a_server_error, served_after_the_deadline, served_by_an_unmetered_hop, every_allowed_survivor_failed, served_by_a_hop_whose_figure_states_no_class, a_failed_hop_billed, an_unknown_energy_ranks_last), each int_motion job's output a decode receipt sealed here over wai-rs/tests/vectors/int_video/int_video_bitstream.wiv1, and the packages video-base-01 and video-staged-01 of pack-conformance/packs/. When one of those corpora is regenerated, so is this one. Nothing here was fetched from outside the repository.

Regenerate and check:

cd wai/wai-rs
cargo run -q --no-default-features --features receipt_ledger --bin wai_receipt_ledger_vectors -- gen ../live-conformance/ledger
cargo run -q --no-default-features --features receipt_ledger --bin wai_receipt_ledger_vectors -- verify ../live-conformance/ledger
cargo test -q --no-default-features --features receipt_ledger --test receipt_ledger
python3 -I ../live-conformance/receipt_ledger_verify.py ../live-conformance/ledger

The second implementation, receipt_ledger_verify.py, shares no code with wai-rs. It verifies each source with the second implementation of that source's own corpus, recomputes every line, citation, row and report, requires every mutated copy of the corpus to fail, and requires the corpus to catch it with each of its own checks dropped.