Repository navigation
Run WebMainBench and WCXB through Web Fetch benchmark adapters - #351
Conversation
There was a problem hiding this comment.
This review found 6 issue(s), including 6 blocking issue(s).
| selected = selection = None | ||
| if profile.case_ids_file: | ||
| selected, selection = load_selected_ids(profile.case_ids_file, profile.expected_dataset_sha256) | ||
| records = load_source(profile.dataset, selected, profile.expected_dataset_sha256) |
There was a problem hiding this comment.
The adapter still calls load_source with its default expected_count=545. The updated certifier accepts any positive profile case_count and validates the source with that count, but its child run reaches this call and rejects every non-545 corpus after preflight succeeds. Propagate the profile's expected count into the child run and this loader (retaining 545 as the historical default) so certified execution uses the same inventory contract as preflight.
| run_frozen_cohort(benchmark, args) | ||
| return 0 |
There was a problem hiding this comment.
Frozen runs accept --fail-on-failure but always return success, even when every final provider response has ok=False. Unlike the live path, no outer handler enforces this flag. Return a failure summary from run_frozen_cohort and use it to return a nonzero status when requested, or explicitly reject the unsupported flag rather than silently ignoring it.
| """Prove that the measured child can read the fixture but cannot connect externally.""" | ||
| parsed = urlsplit(endpoint) | ||
| origin = urlsplit(record["url"]) | ||
| path = origin.path or "/" if preserve_original_origin else "/case/" + record["track_id"] |
There was a problem hiding this comment.
The origin-preserving probe omits origin.query. For records such as https://example.com/page?id=1 and https://example.com/page?id=2, the fixture marks /page ambiguous and disables its path fallback. The probe therefore gets a 404 and aborts a valid run before measurement. Include the query string in the probe's request target and cover this case with a regression test.
| if args.limit: | ||
| records = records[: args.limit] |
There was a problem hiding this comment.
--limit accepts any integer without validation: zero skips this branch and runs the entire cohort, while a negative value selects all but the last N records. This can issue many unintended provider calls. Validate that an explicitly supplied limit is positive before loading inputs or creating evidence, and distinguish None from zero.
| or any(not isinstance(name, str) for name in methods) | ||
| or len(set(methods)) != len(methods) | ||
| or type(profile.get("case_count")) is not int or profile["case_count"] != 545 | ||
| or type(profile.get("case_count")) is not int or profile["case_count"] <= 0 |
There was a problem hiding this comment.
Profiles now accept cohorts other than 545 records, and preflight uses that count, but the collection subprocess does not propagate it. WebMainBench.cases() still calls load_source() with its default expected_count=545, so a valid non-545 profile passes preflight and then fails collection. Carry the profile's case_count through the shared run interface and into the adapter's load_source() call.
| "-m harness.trajectory_replay", | ||
| "scripts/run_webmainbench_benchmark.py", | ||
| "-m harness.web_fetch.webmainbench_runner", | ||
| "-m harness.web_fetch run", |
There was a problem hiding this comment.
The updated isolation check recognizes the module invocation but not the advertised webstone run --benchmark ... console entry point. That entry point runs in-process, so its process command does not contain this marker. A concurrent WebMainBench/WCXB console run can therefore escape both the preflight and polling checks and contaminate certified timing. Include the console invocation in process detection and test both launch forms.
…chmark adapters Add the Web Fetch benchmark adapter registry (default, webmainbench, wcxb), move frozen-input serving to frozen_inputs, loaders to their dataset modules, and the per-call loop to runner.run_frozen_cohort. Method matrices, versions and counts come from profiles and provider configuration; hosted versus local network isolation follows the engine capability. webstone run selects the benchmark with --benchmark and certification with --certified; the WCXB certifier moves to wcxb_certification.
…nch sample reports
…t benchmark adapter
175b726 to
ecabb16
Compare
|
Rebased on main after #345 and #349.
|
There was a problem hiding this comment.
This review found 6 issue(s), including 6 blocking issue(s).
| selected = selection = None | ||
| if profile.case_ids_file: | ||
| selected, selection = load_selected_ids(profile.case_ids_file, profile.expected_dataset_sha256) | ||
| records = load_source(profile.dataset, selected, profile.expected_dataset_sha256) |
There was a problem hiding this comment.
The adapter still calls load_source with its default expected_count=545. The updated full-cohort certifier accepts profile["case_count"] and uses it for preflight, so a hash-bound corpus with a different declared count passes preflight but its first run subprocess fails here with Expected 545 records. Propagate the declared count/profile from the certifier into this adapter and pass it as expected_count, retaining 545 only as the unprofiled default.
| run_frozen_cohort(benchmark, args) | ||
| return 0 |
There was a problem hiding this comment.
Frozen runs accept --fail-on-failure through the shared parser but always return success here, even when every final provider response has ok=False. This makes failure-sensitive automation incorrectly pass. Propagate the final cohort failure status and return a nonzero exit code when requested, or explicitly reject this option for frozen runs rather than silently ignoring it.
| """Prove that the measured child can read the fixture but cannot connect externally.""" | ||
| parsed = urlsplit(endpoint) | ||
| origin = urlsplit(record["url"]) | ||
| path = origin.path or "/" if preserve_original_origin else "/case/" + record["track_id"] |
There was a problem hiding this comment.
The original-origin probe omits the URL query. For records such as /search?q=first and /search?q=second, the fixture deliberately disables path-only fallback, so probing /search returns 404 and the hash check aborts a valid run before any provider calls. Include origin.query in the probe request target and add a probe test covering the query-distinguished records already exercised by the fixture tests.
| if args.limit: | ||
| records = records[: args.limit] |
There was a problem hiding this comment.
--limit accepts any integer, but this truthiness check makes --limit 0 execute the entire cohort, while a negative value runs all but the last N cases. Both can unexpectedly trigger many paid provider calls instead of limiting execution. Validate that a supplied limit is positive before preparing the run (or explicitly support zero as an empty selection), and test zero and negative values.
| or any(not isinstance(name, str) for name in methods) | ||
| or len(set(methods)) != len(methods) | ||
| or type(profile.get("case_count")) is not int or profile["case_count"] != 545 | ||
| or type(profile.get("case_count")) is not int or profile["case_count"] <= 0 |
There was a problem hiding this comment.
Profiles with a non-545 case_count now pass preflight, but the collection subprocess does not receive that count (or the profile). WebMainBench.cases() still calls load_source() with its default expected_count=545, so these newly accepted profiles fail before collection. Pass the profile/count through to the adapter and use it when loading the corpus.
| "-m harness.trajectory_replay", | ||
| "scripts/run_webmainbench_benchmark.py", | ||
| "-m harness.web_fetch.webmainbench_runner", | ||
| "-m harness.web_fetch run", |
There was a problem hiding this comment.
The process guard misses the newly advertised webstone run --benchmark ... entry point: its process command contains neither this module invocation nor any of the script markers. A concurrent console-script benchmark can therefore run during certified timing without triggering the isolation check. Include console-entry-point invocations in the matcher and test them alongside the module invocation.
…ozen-run flags, guard console runs The certifier again requires the profile case count the WebMainBench loader enforces. Frozen runs reject --fail-on-failure instead of ignoring it, --limit must be positive, and the latency isolation guard also sees console runs (webstone run / webstone webfetch run).
|
OCR round 1 (ecabb16), fixed in 44bbfff:
|
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| """Prove that the measured child can read the fixture but cannot connect externally.""" | ||
| parsed = urlsplit(endpoint) | ||
| origin = urlsplit(record["url"]) | ||
| path = origin.path or "/" if preserve_original_origin else "/case/" + record["track_id"] |
There was a problem hiding this comment.
The origin-preserving probe drops the URL query. For valid records such as /search?q=first and /search?q=second, fixture_server() marks the shared path ambiguous and returns 404 for this query-less probe. If the first selected record has such a URL, run_frozen_cohort() aborts before measuring any cases despite the fixture supporting both exact URLs. Append origin.query to the probe request path and add a probe regression test using query-distinguished records (the fixture tests already cover this input).
| if (profile.get("schema_version") != 1 | ||
| or not isinstance(methods, list) or not methods | ||
| or any(not isinstance(name, str) or name not in PROVIDERS for name in methods) | ||
| or any(not isinstance(name, str) for name in methods) |
There was a problem hiding this comment.
Allowing configured participant names here is not sufficient for hosted-engine aliases: _read_profile() still tests engine_definition(name).hosted, and main() makes the same lookup using provider. For a participant named hosted-chrome configured with engine: kitesurf, these lookups return the unregistered (non-hosted) definition, while hosted_html_route() correctly uses the configured engine. Consequently a valid hosted participant without a release version is rejected, or receives an inappropriate --expected-version check. Resolve these capability checks from each participant's provider configuration, rather than its report label.
…nfigured engine The certifier's release-version requirement and --expected-version hand-off now use the participant's configured engine, as the hosted HTML route does, rather than its report label.
|
OCR round 2 (44bbfff), handled in 0d10b13:
|
There was a problem hiding this comment.
This review found 2 issue(s), including 2 blocking issue(s).
| path_key = (host.casefold(), parsed.path or "/") | ||
| key = (*path_key, parsed.query) |
There was a problem hiding this comment.
Original-origin fixture keys discard scheme and port, so distinct URLs such as https://example.test/page and https://example.test:8443/page collide and raise the non-unique URL error before the run starts. The dataset loaders do not prohibit these URLs, and lookup also strips the port, so changing only the duplicate check would still serve the wrong body. Preserve the complete origin identity in both registration and HTTP/CONNECT routing.
| """Prove that the measured child can read the fixture but cannot connect externally.""" | ||
| parsed = urlsplit(endpoint) | ||
| origin = urlsplit(record["url"]) | ||
| path = origin.path or "/" if preserve_original_origin else "/case/" + record["track_id"] |
There was a problem hiding this comment.
The original-origin probe drops the URL query. For the supported cohort shape already covered by test_same_origin_path_uses_exact_frozen_query_without_crossing_cases (/search?q=first and /search?q=second), probing the first record requests /search, which returns 404 because the path fallback is ambiguous. run_frozen_cohort therefore aborts before any measured calls despite a working fixture and sandbox. Include origin.query in the probe request target and add coverage for sandbox verification with query-distinguished records.
|
OCR round 3 (0d10b13). Both remaining findings are about frozen-input serving code that this PR moved without changing it from
Both fail closed: the run aborts before any measured call, so evidence is not corrupted, and no pinned corpus triggers them. Deferred as P2 follow-ups rather than a third OCR cycle on a behaviour-preserving refactor. Merging on green required checks. |
Purpose
Web Fetch benchmarks get one adapter interface and one run entry. WebMainBench and WCXB stop having their own runner module, method lists, versions and benchmark branches: a registry of
BenchmarkAdapters supplies cases, frozen-input serving, scoring and populations, andwebstone run --benchmark <name>(plus--certified) selects them.flowchart LR CLI["webstone run --benchmark NAME<br/>(one argument definition)"] --> REG["BENCHMARKS registry<br/>web_fetch/benchmarks.py"] CERT["webstone run --certified / run_certified_benchmark.py --benchmark NAME"] --> REG REG --> LIVE["default (LiveSuite)<br/>cases: dataset · inputs: live sites · score: score_attempt"] REG --> WMB["webmainbench<br/>cases: webmainbench_dataset · score: pinned official calculator"] REG --> WCXB["wcxb<br/>cases: wcxb_dataset + profile · score: bound wcxb_metrics"] LIVE --> RE["runner.run_evaluation"] WMB --> RF["runner.run_frozen_cohort"] WCXB --> RF RF --> FI["frozen_inputs: loopback HTTPS fixture,<br/>sandbox probe, hosted inline-HTML route"]What moved or was removed
web_fetch/benchmarks.py:BENCHMARKSregistry withdefault,webmainbench,wcxbadapters (cases,inputs,score,populations,resolve,certify, capabilityfrozen_inputs). Command choices derive from the registry.web_fetch/webmainbench_runner.pyremoved. Its parts went to:frozen_inputs.py(benchmark-neutral):fixture_server,verify_loopback_sandbox,fetch_frozen, input contract, hosted inline-HTML route, version check.webmainbench_dataset.py:selected_input,load_source,load_selected_ids,DATASET_SHA256,SCORER_COMMIT(webmainbench_scoringnow imports these instead of duplicating them).wcxb_dataset.py:selected_wcxb_input,load_wcxb_source(this also removes the import cycle between the two modules).runner.run_frozen_cohort(benchmark, args): the per-call loop with no benchmark name. It still writes the shard layout every current reader needs (dataset.json,physical-attempts.jsonl,results.jsonl,execution.json,artifacts/), with the same field set.run_evaluationscores throughbenchmark.score(...)(defaultLiveSuite, which callsscore_attempt).wcxb_scoring.case_metricsandwebmainbench_scoring.official_metricsare the per-case scorers, used by both the score stages and the adapters.certification.run_wcxbmoved towcxb_certification.main.certification.mainselects a frozen-input certifier with--benchmarkand no longer dispatcheswebmainbench-full/wcxbby argv.PROVIDERS,WCXB_PROVIDERSremoved. The WebMainBench and WCXB profiles'providersare the matrix. Names are validated as safe identifiers present in the provider configuration.EXPECTED_VERSIONSremoved. Versions come from--expected-version, the profile (versions/expected_versions) or the provider config'sexpected_version, whichvalidate()already enforces.case_count != 545is now the profile'scase_count, passed toload_source(expected_count=...).moli/moli-pr643binary pins become "each build hash the profile pins is measured by exactly one participant" (paired_latency_methods). WCXB runs now pass the profile'stimeout_seconds/max_failure_retriesexplicitly. Both equal the old defaults, 45 and 1.if provider != "kitesurf"/if provider == "obscura"become a declared capability: an engine with a hosted backend (engine_definition(...).hosted) takes the inline-HTML route. Every local engine runsloopback_onlywithallow_private_networkset. Only obscura's command template has that slot, so other engines see no difference.scripts/run_webmainbench_benchmark.pystays, because frozen latency certifiers name it. It is now a thin wrapper ofwebstone run --benchmark webmainbench.Breaking changes
python scripts/run_webmainbench_benchmark.py --provider P --config C ...andpython -m harness.web_fetch.webmainbench_runner ...webstone run --benchmark webmainbench --providers P --provider-config C ...(the script remains as a wrapper with the new flags)python -m harness.web_fetch.webmainbench_runner --benchmark wcxb ...webstone run --benchmark wcxb --providers P --profile ... --case-ids-file ...run_certified_benchmark.py webmainbench-full ...run_certified_benchmark.py --benchmark webmainbench ...orwebstone run --certified --benchmark webmainbench ...run_certified_benchmark.py wcxb ...run_certified_benchmark.py --benchmark wcxb ...orwebstone run --certified --benchmark wcxb ...webstone webmainbench-full-run(owner command)webstone run --certified --benchmark webmainbenchwebstone run --timeout/--dataset/--provider-configdefaultswebstone runwith frozen-only options (--profile,--case-ids-file, ...) on the default suite, or live-only options on a frozen benchmarkwebmainbench_runner.*,certification.run_wcxbRecorded-content changes for new runs only: the
dataset.jsoninput_contract.network_policytext says "hosted engines reject subresource types" instead of naming Kitesurf. The ephemeral fixture CA subject names no benchmark.execution.jsonrunner_sha256now hashesrunner.py. Nothing reads these values back. Existing evidence and certificates are untouched.Not changed / remains (Part of)
run_evaluation, not the same loop. Merging them needs one record schema. That means migrating every WebMainBench/WCXB reader (assembly, certificationverify_shard, both scorers, report build, case/latency correction), and those readers must keep reading historical shards. Scoring also stays two benchmark-specific stages (webmainbench-score,wcxb-score,webmainbench-full-score) rather than one sharedscore --benchmark. The two certifiers (webmainbench_certification,wcxb_certification) keep separate code because their certificate formats are hash-bound and verified by current readers.webmainbench_correction.py("moli-fixed"),webmainbench_latency_correction.py,webmainbench_latency_diagnostic.py,webmainbench_case_correction.py, and thereview_execution.pydefaults still name one provider or campaign. These exist for finished WebMainBench correction and latency campaigns. Current authorities (the latency-source registry and the correction binding) bind their receipts but not these modules' code paths for new runs. Only their run invocation was updated here.webstone runfor every benchmark,run_certified_benchmark.py --benchmark, and the in-processrun_stageused by certifiers. Still separate:scripts/run_benchmark.py(benchmark_runner), the default-suite certifier parser,headless-runandrisk-control.report_build.py:1055(!= 200) and thewcxb_datasetsample-size constants were not touched; they belong to the report lane.Checks
tests/baselines): unchanged. Goldens: only the reproduction command text changed (see below).uv run --frozen lexbench-webfetch version:scoring_source_sha256is still0fe8931734e1ba7282e1e9c8303eea958d20fdcee83d84e87cdc7e08cd08169e. Nosrc/lexbench_webfetch/or HF card changes.wcxb_metrics.py(hash-bound) is not edited.tests/test_web_fetch_benchmarks.pyiterates the registry: protocol conformance, frozen hooks, registry-derived choices, both scorers, option rejection and--certifieddispatch.Commands run:
make lint-check: passed.uv run --frozen --all-extras python -m pytest tests/baselines tests/test_golden_reports.py tests/test_architecture_*.py: passed. Goldens were refreshed only for the two reproduction-command lines in the WCXB and WebMainBench sample reports. Withreport.pyrestored, the old goldens pass, so nothing else in the rendered output changed.pytest -n 8: 23936 passed, 11 failed. All 11 also fail on base maina0b5b5636for environment reasons (test_ci_gate, plustest_markdown,test_html_to_markdownandtest_headlessconverter tests that need node).Part of #338, Part of #322, Part of #326.