Repository navigation
Web Extract report variants on the shared report template - #370
Conversation
There was a problem hiding this comment.
This review found 3 issue(s), including 3 blocking issue(s).
| return document.main.find(True, recursive=False) is slot | ||
| core = slot.find_previous_sibling() | ||
| return (core is not None and core.get("data-slot") == "core-comparison" | ||
| and core.find_all(True, recursive=False)[-1] is home_comparison_end(core)) |
There was a problem hiding this comment.
An empty core-comparison wrapper makes this index raise IndexError instead of returning False and producing the intended intro-placement validation error. check_page() checks slot names/order but does not reject empty slots, and verify_page_intros() also calls this function directly. Guard the direct-child list before accessing its last element; add a negative test with an empty core slot followed by an intact summary intro.
| "field-extraction-cohort": "record-cohort", | ||
| "field-extraction-suite": "suite", | ||
| } | ||
| READER_ROUTES = tuple(key for key, _, _ in _READER_PAGES) |
|
|
||
| def intro_slot(route, mode): | ||
| """The slot that holds a page's authored introduction in this variant.""" | ||
| return variant_for_mode(mode).options["intro_slots"].get(route, "lead") |
There was a problem hiding this comment.
The default lead slot is not valid for the review role, whose only slots are summary and notes. An authored pages.review.intro is accepted by authored_intro() and passed to page(), but now causes compose() to raise ValueError: Page role review has no slot lead. Provide a supported intro/body slot arrangement for review pages (and update placement validation accordingly) so previously supported review introductions still render.
6357b0a to
1800f27
Compare
|
OCR findings addressed in the latest head: (1) |
…benchmark declarations
…track template Extract's page shell now fills base-template roles and slots; the product, progress, record-cohort and suite shapes are registered variants whose options (intro slot, evidence-state notice, external navigation) replace mode branches. Manifests record the template and checks verify each page's role and slot order. Product reports build from the run alone: content is optional and an unbound price contract renders as declared-absent until a release requires prices.
1800f27 to
783556a
Compare
Purpose
Port Web Extract's report onto the shared report template (#337, #331) and remove the product field names from shared Extract report and analysis code (#324).
flowchart TB T["reporting/templates.py<br/>roles · slots · Variant(options) · check_page"] --> ET["web_extract/template.py<br/>TrackTemplate web-extract/1<br/>product · product-progress · record-cohort · suite"] ET --> P["report.page()<br/>one shell: role, body slot, intro slot,<br/>notice and navigation from variant options"] PF["web_extract/product_fields.py<br/>DECLARED · REPORTED · REPORTED_DERIVED · NUMERIC<br/>(from the fixed-field benchmark adapter)"] --> R["report.py / analysis.py"] R --> P P --> M["manifest.template = owner + base/track/variant versions"] M --> C["check_template_pages(): recorded variant + check_page per page"]What changed
web_extract/template.py): the four report modes are registered variants (product,product-progress,record-cohort,suite). The variant'soptionsnow decide what were mode branches inpage(): which slot holds the authored intro (lead, orsummaryafter the home comparison), the evidence-state notice and results label, and the suite's external navigation and root-relative links.configs/report-templates.jsonlists the same variant names, and a test keeps the two equal. The baseVariantgains a genericoptionsmapping.page()gives<main>itsdata-page-roleand places the body and intro into the slots of that role. Intro placement is checked through the slots (intro_is_correctly_placed,INTRO_SELECTOR). Manifests (product, record cohort and suite) record{track, renderer, entrypoint, base, base_version, track_template, track_version, variant, variant_version}.check_template_pages()verifies the recorded variant and every page's role and slot order. It runs in the reader contract and in the suite check, with negative controls intests/web_extract/test_report_template.py.report --contentis now optional. The product shape renders from--runand the profile. With no bound prices, the price tables say no price contract is bound, and a release check refuses such a report. Declaring prices for only some participants is still refused at build time.web_extract/product_fields.py, which derives them from the fixed-field benchmark adapter (DECLARED,REPORTED,REPORTED_DERIVED,NUMERICfrom the schema).report.pyandanalysis.pyno longer spell outprice/sku/availability/OutOfStock; labels come from catalog keys built from the field name. These declarations sit besidedataset.pybecausedataset.py's bytes are bound into frozen cohort plans throughdataset_registry_sha256.reporting/locales.translate. The only new key isprice_not_declared.Allowlists
Instance-literal: 1 → 1. Layering: 0 → 0.
Baselines
All four Extract baselines keep identical scored evidence and identical page headings and tables. Only the route digests changed, for reader pages and manifests:
<main data-page-role>, the<div data-slot>wrappers, and the template record in the manifest.Breaking changes
check("does not record its template"). Rebuild them from their evidence.configs/report-templates.jsonweb-extractvariantsare nowproduct,product-progress,record-cohort,suite. Itsbuildexample uses--runand no longer--content.Not done (remaining for #324)
_build_product,build_record_cohort). They now share the shell, slots, intro placement and template checks, but each still loads and projects its evidence differently. Merging them needs a common evidence model, which is a separate change.analysis.pystill importsswde.record_value_key. Moving it would changeswde.py, whose bytes are bound into cohorts asadapter_sha256.reproduceandchangesroles; the variants declare them absent. Authored page bodies still share the generated body slot. Record cohorts still require content, because it declares their participants and prices.Verification
uv run --frozen --all-extras python -m pytest tests/web_extract tests/baselines tests/test_report_templates.py tests/test_report_template_contract.py tests/test_architecture_*.py -n 8 --dist worksteal: passedmake lint-check: passed. Scoring sources are untouched.Part of #337, #331, #324