Expand description
pv census — ONT-001 v4.3 ONT-1: ONE cardinality over the contract corpus,
reported by_kind, by_entity_type and by_anchoring.
WHY THIS WALKS WITH pv lint, AND WHY IT READS RAW YAML TOO.
ONT-001 §1 quote-freezes three different corpus sizes — 1818, 1460, 1331 —
because three readers each had their own idea of what a contract file is.
This command therefore collects with provable_contracts::lint’s walker, the
one pv lint and pv validate already share: same directory exclusions, same
is_contract_yaml rule. A census that counted its own universe would just be
a fourth number.
The ANCHORING breakdown cannot come from the typed Contract, though.
Contract is not #[serde(deny_unknown_fields)], so serde silently DROPS an
entity: block it does not model (measured 2026-09-14: pv validate prints
“Contract is valid” for a contract whose entity: it ignored). A census built
only on the struct would report unanchored for every contract FOREVER,
including after the corpus was anchored, and ONT-001 §11.2’s ratchet reading it
would record 0 while the work was done. So each file is parsed twice: through
the shared parser, for the file rule and by_kind, and as raw text, for the
anchor the struct cannot see.
R-2 applies to the instrument itself:
- nothing to read →
ZeroContracts, exit 2,decline: 0 contracts under <path>; - a file that will not parse →
ParseErrors, exit 1,reject: N parse error(s) under <path>.
A census of 4 over 3 readable contracts is the shape R-2 exists to refuse: the count would include a file nobody read.
Structs§
- Anchoring
Counts by_anchoring— the three anchoring levels of §0.0, always all three keys.- Census
- The counts ONT-1 owes, in the order
contracts/census.jsoncarries them. - External
Corpus - The declaration’s shape, defined ONCE — in the schema module, beside the
pv validaterules that check it (PMAT-1098). It used to be declared here, which madepv censusandpv validatetwo readers each holding half of what the file is;EXT-CORPORA-009now validates THROUGH this struct, so a declaration pv calls valid is one this command can count, by construction. Onecontracts/external-corpora.yamlentry, copied into the census verbatim. - Timing
timing— the baseline’s definition, not a measurement taken here.
Enums§
- Anchoring
- How a contract names the thing it is a contract for (ONT-001 §0.0).
Constants§
- SCHEMA
- Schema id of
contracts/census.json. - TIMING_
RUNS - Runs the timing baseline is defined over (ONT-001 §5 ONT-1). The values stay
nulluntil PVL EV-9’sprovable-ladderjob measures them on the CI host class; R-12 is unarmed until then. A number measured HERE would be a number from the wrong host, and would also make two runs of this command disagree — which the ONT-1 probe (tracked census == fresh census) would catch as drift.
Functions§
- census_
of - Walk
dirwithpv lint’s file rule and count. Returns the census, or the refusal the corpus earned (see the module docs). - classify
- Classify ONE raw YAML document. Pure, so the case table can pin every row without touching a filesystem.
- parse_
external_ corpora_ str - The declaration’s shape, defined ONCE — in the schema module, beside the
pv validaterules that check it (PMAT-1098). It used to be declared here, which madepv censusandpv validatetwo readers each holding half of what the file is;EXT-CORPORA-009now validates THROUGH this struct, so a declaration pv calls valid is one this command can count, by construction. Parse an external-corpora declaration. - render_
json - The tracked
contracts/census.jsonbytes: deterministic, one trailing newline. Two runs over one tree are byte-identical — the ONT-1 probe compares the tracked file with a fresh run. - run
pv census <dir> [--format json].