Skip to content

Export scored runs as webstone-site result submissions for every track - #374

Merged
lanyue-llk merged 4 commits into
mainfrom
refactor/export
Nov 24, 2026
Merged

lanyue-llk merged 4 commits into
mainfrom
refactor/export

Conversation

@lanyue-llk

Copy link
Copy Markdown
Contributor

Purpose

The last pipeline stage was manual: webstone results could check and submit a result, but its input was a hand-filled template and no track produced one. This adds the export stage (spec "Stages and artifacts", Export result): every track with scored results registers export(run_dir, receipt=None) -> submission as TrackStages.export, and webstone <track> export RUN_DIR [--receipt R] --output submission.json writes the submission that webstone results validate|submit consumes. No measured value is typed by hand.

flowchart LR
  run[Scored run directory] --> exp["track export.py<br/>validate scored-result schema<br/>map to definition metrics"]
  receipt[Publication receipt] -.optional.-> exp
  exp --> shared["harness.results.export<br/>submission() / read_receipt() / export_stage()"]
  shared --> json[submission.json]
  json --> submit["webstone results validate / submit"]
  shared -. no receipt .-> unpub["source.kind = unpublished-run<br/>check refuses: no public evidence"]
Loading

What changed

  • src/harness/results/export.py (shared, track-neutral): submission() builds the format ResultsClient.check validates; read_receipt() reads share_url/url or host|base_url + slug and versionId|version|expected_version from any publish stage's receipt; export_stage() is the shared CLI; scored_result_schema() binds the common record roles. Without a receipt the submission is marked source.kind: unpublished-run with no URL, and check/submit reject it until the report is published.
  • Exporters (track adapters, instance knowledge stays here):
    • Web Fetch → lexbench-webfetch/split-media, reading results.jsonl with the Web Fetch record schemas, one score entry, shared run arguments and certification #371 SCORED_RESULT schema and summarize(); categories from report_family.
    • Web Search → lexbench-websearch/title-snippet-v2 or simpleqa-verified/source-match-v2 (--benchmark when a run has both). Scenario relevance stays null: it comes from the separate relevance review.
    • Web Extract → lexbench-swde or lexbench-zyte-product-extraction via score_rows and completion_bundle; a method that missed part of the population gets null quality scores.
    • Browser Use → webarena-verified via _logical_results; action times from the BrowserTool events.
    • Browser Trajectory Replay → webarena-verified from the effective results.json and the trace steps.
  • Versioned schemas for the artifacts stages exchange #327: each exporter that lacked a schema validates a versioned scored-result projection (websearch.scored_result/1, webextract.scored_result/1, browseruse.scored_result/1, trajectoryreplay.scored_result/1) bound to the common roles. RecordSchema gains nullable roles (instance-neutral) for untimed calls.
  • Docs: docs/result-submissions.md export → submit flow and per-track table; docs/agent-workflows.md, the bundled webstone skill, and the webstone tracks limits no longer claim there is no evidence-to-leaderboard conversion.

Breaking changes

  • Web Search: the old export stage (lossless delivery shards, report --export-delivery) is renamed delivery (python -m harness.web_search delivery DESTINATION --output REPORT), because export is now the fixed result-export verb.

Allowlists and baselines

  • Instance-literal allowlist: 1 → 1; layering allowlist: 0 → 0.
  • Baselines unchanged (tests/baselines pass without refresh). Scorer identity unchanged: lexbench-webfetch version scoring hash 0fe89317… before and after.

Verification

  • uv run --frozen --all-extras python -m pytest tests/results tests/baselines tests/test_architecture_*.py tests/test_agent_workflows.py tests/test_documented_paths.py tests/web_search tests/trajectory_replay tests/browser_use tests/web_extract -n 8 --dist worksteal → 4450 passed, 19 skipped.
  • tests/results/test_export.py: for a synthetic run per track (the baseline fixtures), the export passes ResultsClient.check against a catalog-only fake transport (no GitHub), and the same run without a receipt exports as unpublished and is rejected. Also covers the webstone webfetch export command and receipt forms.
  • make lint-check passes.

Closes #334
Part of #327

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Review complete · e37175a

This review found 4 issue(s), including 4 blocking issue(s).


def method_id(name: str) -> str:
"""A submission method ID: the run's method name in lowercase hyphen form."""
slug = re.sub(r"[^a-z0-9]+", "-", str(name).lower()).strip("-")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
Normalization can collapse distinct, valid run methods into the same provider ID. For example, Web Search's validate_profile accepts both a-b and a--b, but both become a-b here. The exporter then successfully writes a submission that ResultsClient.check rejects with “Method IDs must be unique lowercase identifiers.” Preserve already-valid submission IDs and disambiguate collisions for other names deterministically, or at least detect collisions before writing the submission and report the affected methods. Add a regression test with two colliding method names.

Comment on lines +47 to +48
entries = [json.loads(line) for line in journal.read_text(encoding="utf-8").splitlines()
if line.strip()]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
The checkpoint journal contains every physical attempt, whereas manifest['calls'] contains the effective call per (method, case_id). After an access-repair retry, this fallback returns both the failed and replacement calls, inflating executedPages and timing populations and feeding duplicate cases into completion metrics. Collapse journal entries to the latest verified call per (method, case_id), as the pipeline's checkpoint loader does, so exporting a checkpoint uses the same logical population as exporting a finalized run.

Comment thread src/harness/web_extract/export.py Outdated
Comment on lines +72 to +73
run = Path(run_dir)
home = run.parents[1]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
Resolve the run path before indexing its parents. The shared export CLI passes the supplied Path unchanged, so export . from inside a run or export RUN_NAME from the runs directory raises IndexError here despite selecting a valid run. Use Path(run_dir).resolve() before deriving the data home.

Suggestion:

Suggested change
run = Path(run_dir)
home = run.parents[1]
run = Path(run_dir).resolve()
home = run.parents[1]

calls = Counter((record["provider"], record["case_id"]) for record in records)
if max(calls.values()) > 1:
raise ValueError("Export needs one scored result per method and case; this run repeats cases")
case_ids = {record["case_id"] for record in records}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
Check that every provider covers the same case set before exporting comparable scores. The runner can leave partial results when execution stops (it records remaining cases in manifest['unexecuted']), but case_ids here is the union across providers while summarize() calculates each provider's rates over its own records. For example, a provider passing its only completed case can export 100% alongside another provider covering 100 cases, with a shared taskCount of 100 and misleading category denominators. Reject unequal provider populations, or explicitly represent incomplete coverage and suppress scores that require the shared population. Add a regression test with unequal provider case sets.

Add the export stage: a per-track export(run_dir, receipt=None) registered
as TrackStages.export maps scored results and the publication receipt to the
submission ResultsClient.check validates. Without a receipt the submission is
marked unpublished. Exporters for Web Fetch, Web Search, Web Extract, Browser
Use and Browser Trajectory Replay validate versioned scored-result schemas
bound to the common record roles; RecordSchema gains nullable roles for
untimed calls. Web Search's delivery shard export moves to 'delivery'.

@lexmount-ocr lexmount-ocr Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Review complete · 207802f

This review found 1 issue(s), including 1 blocking issue(s).

raise ValueError(f"Benchmark {name} has no submission definition")
site_id, quality = SUBMISSIONS[name]
records = name != "zyte"
all_truth = read_json(home / "dataset/dataset/ground-truth.json")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug · medium
The exporter rescoring boundary does not verify the dataset against the run contract. Unlike score_run(), it neither calls validate_dataset(home) nor checks contract['dataset_manifest_sha256']. If the prepared dataset is replaced or its ground truth changes after collection, export silently produces quality metrics for different references, even though the call hashes still pass. Validate the prepared dataset and its contract binding before reading truth and recomputing scores, so changed inputs are rejected rather than exported as the original run.

@lexmount-ocr lexmount-ocr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Re-review complete · 94d0ca5

No findings in this incremental review.

@lanyue-llk
lanyue-llk merged commit a0de5de into main Nov 24, 2026
10 checks passed
@lanyue-llk
lanyue-llk deleted the refactor/export branch November 24, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export scored results to a webstone-site submission for every track

1 participant