17 Certification and downstream
Stages 6 and 7: measure again, then update the corpus incrementally
17.1 Stage 6 — Certify
pdai-validity --collection <c> --doc <d>
pdai-audit --collection <c> --vol <d> --all --quiet
pdai-coherence --collection <c> --vol <d>pdai-audit --all produces, in pdai/collections/<c>/quality/<d>/:
- the LettreAI Typst report
audit_report_<d without hyphens>.pdf; - the figure census (
complete_full,complete_desc,caption_only,empty,omitted); - the tag protocol, compared with the protocol of the diagnosis by
diff_tag_protocols(tag_protocol_diff.json); - the fault dossier.
pdai-coherence checks whether the CSS rules and the DTD agree with the tags that occur in the XML. Its classification step uses the role css-classify (kimi-k2.7-code:cloud, fallback gemini-3.8-flash).
17.1.1 Gate
- the validity fail count of the scope is not higher than in the diagnosis;
- the structural defect count is not higher;
- no code appears that the diagnosis did not report;
- one repaired page is inspected on the viewer port, facsimile next to the rendering, before the iteration is reported as done.
The op pdai:cure_certify compares the counts of the diagnosis with the new counts and fails on a new class or a higher count.
17.2 Stage 7 — Downstream
~/ai-mac-studio/pdai/index/ai-lemma-index/.venv/bin/pdai-complete --collection <c> --dry-run
~/ai-mac-studio/pdai/index/ai-lemma-index/.venv/bin/pdai-complete --collection <c>
~/ai-mac-studio/pdai/index/ai-lemma-index/.venv/bin/pdai-corpus-audit --collection <c>pdai-complete runs stanza → corpus → lemma → gazetteer → chroma, with a corpus audit at start and end. It does not run OCR or structure.xml; those gaps are reported. Changed pages are detected by the content hash text_sha256 of the page, not by the file modification time; a normalizer that only rewrites attributes therefore does not make a page stale.
The corpus audit is pdai-corpus-audit (package ai-lemma-index). The name pdai-audit belongs to the structural audit of pipeline/schema-audit. Both packages used to define pdai-audit; whichever was installed last shadowed the other.
17.2.1 Gate
status.jsonreportssearch_ready, or names the gaps;- the language gate passes: no language with at least 100 sentences before the run loses more than 5 % of them, unless the run is given
--allow-lang-dropon purpose; - a Glider query (port 5890) returns a hit from a repaired page.
The language gate exists because of an observed failure: a Stanza cache without the Latin and French models dropped those sentences and still reported every page as processed (see the Copernicus case).
17.3 In the Partitur
Stages certify and downstream (ops pdai:cure_certify, pdai:cure_downstream). downstream runs pdai-complete --dry-run unless the input apply is true.