Repository navigation
Render Web Extract product and record reports from one evidence model - #388
Merged
Merged
Conversation
…dence model Each report body assembles an ExtractEvidence; one renderer writes every page through the shared page template, the English notice, the entry page and the manifest, with assemble, pages, entry and manifest field hooks per shape.
This was referenced Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Close #324: the Web Extract product report and the record-cohort report no longer have two monolithic build bodies. Both assemble the same evidence model and go through one renderer, with shape hooks for what differs.
flowchart LR B["report.build(content mode)"] --> S["REPORT_SHAPES"] S -->|compatibility / full-cohort-progress| R["render(PRODUCT_BODY)"] S -->|field-extraction-cohort| R2["render(RECORD_BODY)"] S -->|field-extraction-suite| SU["report_suite.build<br/>(composes record cohorts)"] subgraph Render["render(body, ...): one path"] A["body.assemble → ExtractEvidence<br/>verified rows, truth, labels, prices, audit,<br/>completion, public evidence views"] --> P["body.pages(evidence, lang, write)"] P --> W["write(): shared page template,<br/>authored intros, model tables"] W --> F["English notice, body.entry,<br/>build version, file inventory,<br/>manifest (common fields + shape fields,<br/>body.manifest_keys order)"] end R --> A R2 --> AWhat moved
ExtractEvidence(new dataclass inweb_extract/report.py): the fields both shapes fill (methods, labels, truth, logical rows, prices, audit, completion, input profile, public evidence receipts, observations, planned methods, languages, title/site prefix, page options), plusdetailsfor what only one shape's pages read andmanifestfor shape-only manifest fields.ReportBodyhooks:assemble,pages,entry,manifest_keys.render()owns page writing (detail pages, authored intros, model-comparison binding, intro hashes), the English-not-generated notice, the entry page, build version, file inventory, the common manifest fields and the final rendered check._build_product→_assemble_product+_product_pages;build_record_cohort→_assemble_record+_record_pages. The duplicated per-shape tails (notice, entry, version, inventory, manifest assembly) are removed.lexbench/report.pyalready took the engine fromlayout_engine()(the registered browser with the layout-publication capability); the remaining literal was in the bundled reproduction scriptlexbench/reproduction.py, which now useslayout_engine()too. Fields named in frozen evidence schemas (moli_sha256, schema IDs) stay as they are.The check paths (
_check_product,_check_record_cohort, suite check) are unchanged, so published reports keep verifying.Output identity
All four Extract example reports were rebuilt before and after this change and compared with
diff -r. Every HTML page, public evidence file and data file is byte-identical. Manifests differ only inwebstonebuild identity (dirty tree) and thewebstone-version.jsonfile hash. The manifest field order is kept per shape (manifest_keys), so report-manifest bytes match too.Allowlists
Instance literals 0 → 0; layering unchanged.
Baselines
lexbench.json,lexbench-linux.json,lexbench-macos.json): only thereproduction/run.pydigest changed, because the bundled reproduction script now resolves the engine from the registry. No other value changed.Scorer hash unchanged:
0fe8931734e1ba7282e1e9c8303eea958d20fdcee83d84e87cdc7e08cd08169e.Verification
uv run --frozen --all-extras python -m pytest -n 8 --dist worksteal tests: 21644 passed, 78 skipped, 2 xfailed.make lint-check: passed.Breaking changes
None to commands. The private functions
_build_productandbuild_record_cohortare replaced byrender(PRODUCT_BODY | RECORD_BODY, ...);report.buildis the entry point as before.Closes #324. Part of #321.