Skip to content

Render Web Extract product and record reports from one evidence model - #388

Merged
lanyue-llk merged 2 commits into
mainfrom
refactor/extract-one-evidence-model
Nov 25, 2026
Merged

lanyue-llk merged 2 commits into
mainfrom
refactor/extract-one-evidence-model

Conversation

@lanyue-llk

Copy link
Copy Markdown
Contributor

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 --> A
Loading

What moved

  • ExtractEvidence (new dataclass in web_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), plus details for what only one shape's pages read and manifest for shape-only manifest fields.
  • ReportBody hooks: 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 (One browser adapter and participant registry for the browser tracks #321 leftover): lexbench/report.py already took the engine from layout_engine() (the registered browser with the layout-publication capability); the remaining literal was in the bundled reproduction script lexbench/reproduction.py, which now uses layout_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 in webstone build identity (dirty tree) and the webstone-version.json file 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

  • Web Extract (all four): unchanged.
  • Lexbench (lexbench.json, lexbench-linux.json, lexbench-macos.json): only the reproduction/run.py digest 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_product and build_record_cohort are replaced by render(PRODUCT_BODY | RECORD_BODY, ...); report.build is the entry point as before.

Closes #324. Part of #321.

…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.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Review complete · 76d2cca

No findings in this review.

@lanyue-llk
lanyue-llk merged commit 3c75a0d into main Nov 25, 2026
10 checks passed
@lanyue-llk
lanyue-llk deleted the refactor/extract-one-evidence-model branch November 25, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web Extract: benchmark-declared fields and one renderer

1 participant