Skip to content

test: add characterization baselines for each track - #342

Merged
lanyue-llk merged 1 commit into
mainfrom
refactor/baselines
Nov 24, 2026
Merged

lanyue-llk merged 1 commit into
mainfrom
refactor/baselines

Conversation

@lanyue-llk

Copy link
Copy Markdown
Contributor

Purpose

The spec-convergence refactors (#336) move code between modules and are not supposed to change behaviour. This PR adds one characterization baseline per track. Each one drives the track's runnable offline example through every stage that can run without network, credentials, Docker or a browser. It then compares a readable, normalized snapshot with tests/baselines/<name>.json. When a refactor changes a baseline, the failure prints a unified diff of the records, routes, headings or table cells that moved.

tests/golden/ already holds byte-level route hashes for most report builds. Those hashes show that a report changed. The baselines add what changed (scored record fields, route inventory, section order, table values), extend coverage to Web Extract, which had no snapshot, and cover the run, score and check stages as well as the report.

flowchart LR
    EX[/"Track example<br/>fixture provider or synthetic evidence"/] --> RUN["Run<br/>(Web Fetch fixture)"]
    RUN --> SC["Score / rescore"]
    EX --> SC
    SC --> REP["Build report"]
    REP --> CHK["Check<br/>(where offline)"]
    SC --> SNAP["Normalize<br/>paths, timestamps, sha256 → tokens"]
    CHK --> SNAP
    SNAP --> S[/"Snapshot<br/>records · routes · h1–h3 · table cells"/]
    S --> CMP{"Equal to<br/>tests/baselines/&lt;name&gt;.json?"}
    CMP -- yes --> OK["pass"]
    CMP -- no --> DIFF["fail with unified diff"]
Loading

Coverage

Track Example driven Run Score Report Check Snapshot contents
Web Fetch webstone run --delay 0, rescore, report (fixture dataset and provider) yes yes; rescore must reproduce the run's records yes – run-dir inventory, records + metrics, summary, report outline (zh + en)
Web Search harness.web_search.example (default and --comparison) synthetic calls yes (lexbench_websearch metrics, relevance labels) yes yes (report.check) scored calls, report outline
Web Extract harness.web_extract.example, all four modes synthetic calls yes (field scoring, metrics) yes yes (report.check) public evidence + data/*.json, report outline
Browser Use build_browser_use_fixture (failed variant) no (needs model, browsers, WebArena) logical-result selection and aggregation yes no (needs a profile authority) data/results.jsonl, report outline; per-task dataset pages of the frozen pilot listed but not outlined
Trajectory Replay build_replay_fixture (failed variant) no (needs BrowserTool and sites) logical results, metrics yes yes (webarena_report_check.check) data/results.json, data/metrics.json, report outline
Lexbench headless lexbench_report_fixture, minimal scenario no (needs Docker and browsers) aggregation from retained grader evidence yes – data/model.json, per-case outcomes (evidence bindings omitted), route inventory

Normalization: absolute build paths become <root>, ISO and compact timestamps become <timestamp>, and 64-hex digests become <sha256>. Web Fetch pins its clock and host the same way tests/test_golden_reports.py does, and the builder identity is pinned for all tracks. Tables longer than 20 rows keep their first 20 rows plus a "N more rows" line, so a change in row count still shows.

Refresh command

WEBSTONE_UPDATE_BASELINES=1 uv run --frozen --all-extras python -m pytest tests/baselines

It is documented in tests/baselines/snapshot.py and in CONTRIBUTING.md. A PR that changes a baseline must explain the change in its description.

Verification

  • uv run --frozen --all-extras python -m pytest tests/baselines: 10 passed in about 3.5 s, 2.6 s of which is test calls. Two consecutive runs produced identical snapshots.
  • The tests also pass with -n 4 --dist worksteal (CI mode), with TZ=America/Los_Angeles LANG=C, and with WEBSTONE_REPORT_LANGUAGE=zh set.
  • Negative control: editing one table cell in web-fetch.json fails the test with a one-line diff.
  • make lint-check passes (tests/baselines added to the Ruff include list). make docs-check passes. tests/test_golden_reports.py and the packaging and privacy tests pass.
  • CI picks the tests up through make ci-tests / test-python (TEST_PATHS=tests). No workflow change was needed.

Closes #340

@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 · 3811ec5

No findings in this review.

@lanyue-llk
lanyue-llk merged commit 2073471 into main Nov 24, 2026
8 checks passed
@lanyue-llk
lanyue-llk deleted the refactor/baselines branch November 24, 2026 05: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.

Characterization baselines for each track's stage outputs before refactoring

1 participant