Skip to content

Web Fetch: one report model and a mode registry for report builds #328

Done

Description

@lanyue-llk

Part of the convergence on the repository specification (#313). Rules: 1, 3, 4, 7. Size: L.

Problem

The Web Fetch renderer has no input schema and several unrelated generators.

  • web_fetch/report.py (4,684 lines) defines generate (:2252, dicts plus nine keyword flags), generate_wcxb (:137), generate_cohort_diagnostic (:822), generate_public_benchmark_research (:1002), generate_webmainbench (:3714) and generate_webmainbench_full (:4069), sharing only small helpers.
  • Mode is inferred from dict keys (dataset['comparison'] read 29 times, saved_matrix_scope 13 times) and from ContextVars _REPORT_PROVIDER_LABELS and _REPORT_SUITES (report.py:407, 417) set by the saved-matrix adapter (report_saved_matrix.py:3059-3060); generate imports from the saved-matrix module (report.py:2253-2254).
  • scripts/build_report.py selects about ten modes through mutually exclusive flags with hand-written exclusion lists (:61, 69, 81, 94, 110, 118) and branches on variant and comparison_kind (:98, 105, 152).
  • Kind branches recur in report_build.py:209, 535, 753, 861, 925, 1615, report_check.py:491, 821, 948 and report_package.py:101.

Direction

Define a report model schema: participants, populations, result rows, evidence links, sections and state. Each build mode becomes an input adapter that produces the model, registered by variant; one renderer consumes it. Benchmark-specific views become section hooks. Remove the ContextVars and the reverse import, and reduce scripts/build_report.py to a thin entry.

Done when

  • One renderer entry that takes a validated report model.
  • Build, check and package select behaviour from the variant registry, not from kind comparisons.
  • Existing report variants build with unchanged measurements.

Paths are relative to src/harness/ unless prefixed; line numbers are from main at 997a228.

Activity

  1. added
    refactor
    on Nov 24, 2026
  2. lanyue-llk commented on Nov 24, 2026

    @lanyue-llk
    ContributorAuthor

    Done (#375, #377): typed report model, variant registry, one render_report entry, Web Fetch track template, WCXB/WebMainBench page sets as benchmark views() hooks, kind branches as declared kinds, variants recorded and checked. Accepted remainder: one render-scope ContextVar in report_model.py (passing it explicitly touches ~120 call sites for no behavioural gain).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    refactor

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions