Repository navigation
Web Fetch: one render entry, benchmark page-set views and declared comparison kinds - #377
Conversation
…lease would ignore
…B and WebMainBench views
…context; methods.py keeps no ContextVars
… read declarations, not kind names
…nt; checks use the shared template gate; fix the WCXB reproduce command
…nd comparison-kind declarations
There was a problem hiding this comment.
This review found 4 issue(s), including 4 blocking issue(s).
| retry_html=('<details><summary>'+(report_text('zh' if lang == 'zh' else 'en')('earlier_failed_calls', 'Earlier failed calls'))+'</summary><ul>'+''.join(f'<li>#{v["physical_attempt"]} · {v["elapsed_ms"]:,.0f} ms · {esc(v["error_type"])} · {esc(v["error_message"])} · <a href="{esc(v["artifact_path"])}">'+(report_text('zh' if lang == 'zh' else 'en')('raw_response', 'Raw response'))+'</a></li>' for v in retries)+'</ul></details>') if retries else '' | ||
| timing_note=('<p class="small muted">'+(report_text('zh' if lang == 'zh' else 'en')('latency_is_from_the_selected_final_crossover', 'Latency is from the selected final crossover round; content and scores are from the original call.'))+' <a href="research/wcxb-full-paired-latency/calls.jsonl">'+(report_text('zh' if lang == 'zh' else 'en')('timing_calls', 'Timing calls'))+'</a></p>') if r.get('latency_source')=='paired_final_round' else '' | ||
| panels.append(f'<section class="panel" id="{p}"><h2>{esc(p)} · F1 {fmt(r["f1"])}</h2><p><span class="tag">{esc(diag(lang,"excluded" if case in exclusion_ids else r["diagnosis"]))}</span> · {r["total_elapsed_ms"]:,.0f} ms · {r["physical_attempt_count"]} calls · {esc(r["attempt_id"])}</p>'+timing_note+f'<p>{esc(x["missing"])}: {esc(missing)}</p><p>{esc(x["extra"])}: {esc(extra)}</p>'+snippet_detail+(f'<p class="bad">{esc(x["error"])}: {esc(r["error_type"])}{(" · HTTP "+str(r["status_code"])) if r.get("status_code") else ""}{(" · "+esc(r["error_message"])) if r["error_message"] else ""}</p>' if r['error_type'] else '')+retry_html+f'''<details data-output><summary>{esc(x['output'])} · {r['output_chars']:,} characters</summary><p><a href="{evidence_path}">{report_text('zh' if lang == 'zh' else 'en')('complete_evidence_json', 'Complete evidence JSON')} ↓</a></p><pre data-src="{evidence_path}" data-provider="{p}"></pre></details></section>''') | ||
| qualification=(f"""<p class="callout">{report_text('zh' if lang == 'zh' else 'en')('this_reference_was_excluded_before_calls_official', 'This reference was excluded before calls; official raw scores and outputs remain visible, but it does not enter the main quality mean.')} {esc(exclusion_ids[case])}</p>""" if case in exclusion_ids else '') |
There was a problem hiding this comment.
There was a problem hiding this comment.
Acknowledged (low, non-blocking). This code moved unchanged from report.py; left as is to keep the WCXB page set byte-identical in this refactor.
| ): | ||
| parser.add_argument("--" + name, type=Path, required=True) | ||
| args = parser.parse_args(argv) | ||
| declared = declared_correction(args.correction) |
There was a problem hiding this comment.
The campaign rules are now an external dependency, but certification still freezes and hashes only this Python file (bind_certifier_source). The certificate does not retain or hash the selected declaration, and application reloads it from the current registry. Editing an existing declaration can therefore change how a saved certificate is interpreted without changing its recorded certifier-source hash; the archived Python source is also insufficient to recover the rules used during certification. Retain and hash the selected declaration in new certificates and verify that binding when applying them, while explicitly preserving compatibility with historical certificates.
There was a problem hiding this comment.
Fixed in cdc3484: new certificates retain the selected declaration (correction_declaration); applying a certificate rejects a changed declaration; historical certificates without it still apply. Regression test added.
| records: list[dict] | None = None, *, | ||
| authority_root: Path | None = None, profile_path: Path | None = None) -> None: | ||
| root = open_report(root) | ||
| check_recorded_template(root) |
There was a problem hiding this comment.
This new check ignores both authority_root and the authority selected by profile_path, so template validation reads configs/report-templates.json and validates its referenced files against the installed/default repository while the rest of this checker uses the caller's authority tree. A report checked with an explicit authority can therefore fail against an unrelated checkout (or be validated against the wrong template). Move this call after repo is resolved and pass authority_root=repo, as the full-report checker does.
There was a problem hiding this comment.
Fixed in cdc3484: the recorded variant is now the checkout-independent template identity (base, track and variant versions) and is checked against the template registry in code, so no authority tree is read.
| core_note+=' '+h('timing_corrections_use_preselected_round_physical_calls', 'Timing corrections use preselected round {formal_round}; physical calls and correction receipts remain available.', formal_round=formal_round) if latency_corrected else '' | ||
| core_note+=' '+h('timing_corrections_use_preselected_round_physical_calls', 'Timing corrections use preselected round {formal_round}; physical calls and correction receipts remain available.', formal_round=formal_round) if latency_corrected else '' | ||
| core_note+=' '+h('timing_corrections_use_preselected_round_physical_calls', 'Timing corrections use preselected round {formal_round}; physical calls and correction receipts remain available.', formal_round=formal_round) if latency_corrected else '' |
There was a problem hiding this comment.
Fixed in cdc3484: the repeated append is removed.
…tency declarations in certificates, drop a repeated timing note
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| repro=f'''<div class="hero"><h1>{esc(x['repro'])}</h1><p>{report_text('zh' if lang == 'zh' else 'en')('versions_and_source_are_bound_by_this', 'Versions and source are bound by this cohort certificate.')}</p></div><section class="panel"><p>WCXB v1.0 test · {case_count} × {len(providers)} · SHA-256 <code>{summary['source_sha256']}</code></p><p>{esc(x['source'])}: <a href="{source_repository}/tree/{source_commit}">GitHub {source_commit[:7]}</a> · <a href="sample-manifest.json">{report_text('zh' if lang == 'zh' else 'en')('full_test_manifest', 'Full test manifest')}</a> · <a href="certification.json">certification.json</a> · <a href="wcxb-score-summary.json">score summary JSON</a></p><div class="scroll"><table><thead><tr><th>{esc(x['provider'])}</th><th>{esc(x['version'])}</th><th>{report_text('zh' if lang == 'zh' else 'en')('route', 'Route')}</th><th>SHA-256</th></tr></thead><tbody>{versions}</tbody></table></div><pre>uv run --frozen python scripts/run_certified_benchmark.py --benchmark wcxb --dataset <WCXB source> --sample-manifest evaluation/public-wcxb-test-qualified.json --output-root <new evidence dir> --env-file .env\nuv run --frozen python -m harness.web_fetch score --benchmark wcxb --source <WCXB source> --sample-manifest evaluation/public-wcxb-test-qualified.json --evidence-root <certified evidence dir>\nuv run --frozen python scripts/build_report.py --profile <WCXB report profile> --evidence <certified evidence dir> --wcxb-source <WCXB source> --output reports/wcxb</pre><p class="small muted">{esc(x['no_review'])}</p></section>''' | ||
| page(lang,'reproduce/index.html',x['repro'],repro) | ||
| for case,group in sorted(by_case.items()): | ||
| if case in exclusion_ids:continue |
There was a problem hiding this comment.
This skip makes the excluded-reference qualification callout and the "excluded" if case in exclusion_ids diagnosis below unreachable. Since the current scoring contract rejects cohorts with exclusions, remove those dead detail-page branches so the renderer does not imply that it displays excluded-reference evidence.
There was a problem hiding this comment.
Low/maintainability, same as the earlier note: this branch moved unchanged from report.py and is kept so the WCXB page set stays byte-identical in this refactor; not blocking.
Purpose
Finish the Web Fetch report convergence after #375: every report variant renders through one entry on the track template, benchmark page sets are benchmark views, comparison kinds are declarations, and the remaining instance literals in the latency correction become data.
What changed
render_report(out, *inputs, variant=None).generate,generate_wcxb,generate_webmainbench,generate_webmainbench_full,generate_cohort_diagnosticandgenerate_public_benchmark_researchare removed. WCXB and WebMainBench (sample, full) page sets moved out ofreport.py(4,651 → 3,127 lines) intowcxb_report.pyandwebmainbench_report.py. The benchmark adapters contribute them throughviews()as a new instance-neutralreporting.templates.PageSetHook. Diagnostic and research page sets are track page sets keyed by variant.report-manifest.json.check_recorded_template/check_template_pagesverify it, and reports built before this change still verify. The Web Fetchcheck_template_pagesnow delegates to the sharedreporting.release_check.check_template_pages.uniform_native_local_measurement,web_fetch_diagnostic,headless_html/headless_markdown,synthetic_browser_report,risk_control_100_moli) are nowComparisonKinddeclarations inreport_variants.py.report_build,report_check,report_changesandlocal_auditread the declared properties. The risk-control certification check and its file list moved intorisk_control.pyas the declared certification owner.methods.pyno longer holds ContextVars. Its four ContextVars (records, execution configs, method registry, measured labels) are now aMethodScopefield of the oneRenderContext, which moved toreport_model.py.rendering()keeps an enclosing method scope.validate_releasegate. It gains the shared language and presentation stages, and the stages run in the gate's order.--profileand wrote toreports/webfetch.webmainbench_latency_correction.pyis still needed.evaluation/webmainbench-content-binding.jsonhash-bindslatency-corrections.json(e859d378…) as evidence of the current WebMainBench sample report, and the sample check, build and publication check read it throughvalidate_latency_correction. So the module is kept. Its campaign literals (methods and versions, 200/400/800/1200 counts, rounds, selected round, receipt and certificate kinds, known failures) moved intodata/webmainbench-latency-corrections.json. Apply and verify select the campaign from the certificate or receipt kind. The frozen receipts and certifier sources are unchanged.ReceiptRelease) now rejects an explicitPublicationTarget.titlethat differs from the release title, and ashare_urlthat differs from the saved receipt or profile link. Before this change, both were silently ignored.package_archivearchives the report tree verbatim and writes an attestation, so switching would change the archive bytes and outputs; this PR leaves the packager alone. Lexbench has no directory packager to move; itscopytreeis a negative-control view.Breaking changes
scripts/run_certified_benchmark.py webmainbench-latency(the latency certifier) now requires--correction <receipt kind>.harness.web_fetch.report.generate*are replaced byrender_report(..., variant=...).report_build.require_risk_control_certificationis replaced byrequire_declared_certification.Allowlists
Instance literals: 1 → 1. Layering: 0 → 0.
Baselines
The
web-fetchbaseline is unchanged. Thewcxb,webmainbench-sampleandwebmainbench-fullbaselines change only inreport-manifest.json, which now records the variant (for webmainbench-full it is added to the existing manifest). The WCXBreproduce/index.html(zh and en) also changes because of the command fix. All other routes are byte-identical. The scorer hash is unchanged (0fe89317…).Verification
uv run --frozen --all-extras python -m pytest -n 8 --dist worksteal -q tests: 21,624 passed, 1 failed. The failure isweb_extract/test_model_comparison.py::test_unreachable_connection…, which is flaky and passes alone.make lint-check: pass.uv run --frozen lexbench-webfetch version: scoring hash unchanged.Closes #333
Part of #328
Part of #322
Part of #332