Repository navigation
Report template contract with Web Search as the first track template - #366
Merged
Merged
Conversation
…ext catalog Define the page roles, ordered slots and content slots every report fills; track templates register variants as data, benchmarks contribute SectionHook views, and check_page/recorded_variant let a release gate compare built pages with the recorded template. Move the shared page shell, table, highlight and evidence-link components into reporting/shell.py and add source_text to the one catalog API in reporting/locales.py.
Search becomes a track template with standard and comparison variants; page writers return slot fills, the report records its template in the manifest and check() verifies roles and section order. Review, Reproduce and Changes render generated defaults without authored content. Benchmark declarations now own the factual evidence panel, level charts, population metric kinds, answer-judgment display and population notes, so comparison and report code no longer name a dataset (#323).
This was referenced Nov 24, 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
Define the report template contract from
docs/spec.md"Report templates" and prove it on Web Search, the track with the cheapest staged report model. Other tracks (Web Fetch, Web Extract, Browser Use, Trajectory Replay) port onto the same API next.New structure
flowchart TB subgraph Shared["src/harness/reporting/"] BT["templates.py<br/>PAGE_ROLES (8 roles, ordered slots)<br/>CONTENT_SLOTS · Page · Variant · TrackTemplate<br/>SectionHook · compose() · check_page() · recorded_variant()"] SH["shell.py<br/>page shell · navigation · footer · theme/language links<br/>table · cells · numeric_cell/winners · evidence_link/dialog"] LC["locales.py<br/>translate · catalog_text · source_text (one catalog API)"] end subgraph Search["src/harness/web_search/"] TT["template.py<br/>TrackTemplate web-search/1<br/>variants: standard, comparison · HOOK_POINTS"] BM["benchmarks.py<br/>SearchBenchmark.views() → SectionHook<br/>metric_kinds · AnswerGrading.explains"] BV["benchmark_views.py<br/>factual evidence panel · level charts<br/>MetricKind: factual, target page, site"] RP["report.py<br/>page writers return slot fills"] end BT -- "roles/slots" --> TT TT --> RP BM -- "views() hooks, metric kinds" --> RP BV --> BM SH --> RP LC --> RP RP --> OUT["report: main[data-page-role] + div[data-slot]<br/>manifest.template = base, track, variant + versions"] OUT --> CK["check(): recorded_variant + check_page per variant page"]What changed
Base template (
reporting/templates.py) — page roleshome, datasets, methodology, results, interpretation, review, reproduce, changes, each with ordered slots; authored content is allowed only in content slots (lead, summary, findings, notes, history). AVariantmust fill or declare absent every role and cannot add one;compose()renders slots in base order and refuses unknown slots;check_page()verifies a page's role, slot order and that authored nodes sit in content slots.TrackTemplate.record()is what the manifest stores;recorded_variant()refuses a different base/track/variant version.SectionHookis the typeBenchmarkAdapter.views()returns (added to the protocol; Web Fetch adapters return[]).Shell and catalog —
reporting/shell.pyholds the page skeleton plus navigation, footer, table, cells, directional highlight cells (numeric_cell/numeric_winners) and evidence link/dialog components, moved out of Search.reporting/locales.pygainssource_text()(English source text as key,context|sourcedisambiguation); Search'smessages.pyis now two thin bindings over it.Web Search on the template —
web_search/template.pyreplacespages.py: two registered variants (standard,comparison, selected by authoredpresentation) mapping every route to a role;configs/report-templates.jsonlists the same variant names (a test keeps them equal). Every page writer now returns slot fills. With no authored content the build fills every role from data: new generated Review (states no review is recorded), Reproduce (profile counts + documented commands) and Changes (current build only; authoredchangessection when bound) pages. Footer links come from variant data (pages withnav=False) instead of a presentation branch.#323 remaining items — via benchmark declarations, not dataset names:
comparison.py: factual-only level charts → the factual benchmark'slevel-findingshook; the factual population-size note → a loop over declared benchmarks; the/scenariojudgment key →benchmark_of(case).nameplusAnswerGrading.explains.report.py: the factual evidence panel (with the SimpleQA contamination paragraph) → the factual benchmark'sevidence-panelhook; scenario/site/factual population summaries and directed-discovery checks →MetricKinddeclarations registered on the benchmarks (metric_kinds); population validation →MetricKind.validate.Removed:
web_search/pages.py, Search's privatetable,cells,numeric_cell,numeric_winners, the inline page shell and footer construction in_write_page, thepresentation == "comparison-report"branches for footer, language link and notice.Allowlists
Instance-literal allowlist: 1 → 1 entry (
harness.reporting.visual, untouched). Layering allowlist: 0 → 0. The new shared modules name no instance.Baselines
tests/baselines/web-search.jsonandweb-search-comparison.jsonchanged in presentation structure only. Scored records are identical, and every existing page keeps identical h1–h3 headings and table cells. Route digests changed because:<main>now carriesdata-page-roleand its body sections are wrapped in<div data-slot="…">in base-template order;review.html,reproduce.html,changes.html(anden/copies) are the generated defaults for roles Search did not fill;manifest.jsonrecordstemplate = {track, renderer, entrypoint, base, base_version, track_template, track_version, variant, variant_version}.Authored sections on the default home now sit in the
summaryslot after the generated core comparison, and the dataset page's authored section leads the page; neither baseline example binds those sections.Breaking changes
check/--release-check("Report manifest does not record its template; rebuild it"). No Search report is bound by a current authority in Git; rebuild from the saved run directory.review,reproduce,changes), and its producer binding namesharness/web_search/template.pyinstead ofpages.py.configs/report-templates.jsonSearchvariantsare nowstandard,comparison(the template's registered variants).Verification
uv run --frozen --all-extras python -m pytest tests/web_search tests/baselines tests/test_report_template_contract.py tests/test_report_locales.py tests/test_adapters.py tests/test_web_fetch_benchmarks.py -n 8 --dist worksteal— passeduv run --frozen --all-extras python -m pytest tests -n 8 --dist worksteal— 23788 passed, 1 failed (tests/test_moli_provider.py::...test_cancel_permission_error_preserves_timeout_and_unresolved_worker, a load-sensitive timing test that passes alone and is unrelated); Search, baselines and architecture tests rerun after rebasing on main: passedtests/test_report_template_contract.py(role coverage, unknown slot, slot order, authored content outside a content slot, version drift) andtests/web_search/test_report.py::test_release_check_rejects_pages_that_leave_their_template(reordered slots, wrong role, variant/version drift in the manifest, missing route).make lint-check— passed. Scoring sources insrc/lexbench_*untouched.Closes #323
Part of #337, #331