Repository navigation
test: add characterization baselines for each track - #342
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/<name>.json?"} CMP -- yes --> OK["pass"] CMP -- no --> DIFF["fail with unified diff"]Coverage
webstone run --delay 0,rescore,report(fixture dataset and provider)harness.web_search.example(default and--comparison)report.check)harness.web_extract.example, all four modesreport.check)data/*.json, report outlinebuild_browser_use_fixture(failed variant)data/results.jsonl, report outline; per-task dataset pages of the frozen pilot listed but not outlinedbuild_replay_fixture(failed variant)webarena_report_check.check)data/results.json,data/metrics.json, report outlinelexbench_report_fixture, minimal scenariodata/model.json, per-case outcomes (evidence bindings omitted), route inventoryNormalization: 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 waytests/test_golden_reports.pydoes, 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
It is documented in
tests/baselines/snapshot.pyand 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.-n 4 --dist worksteal(CI mode), withTZ=America/Los_Angeles LANG=C, and withWEBSTONE_REPORT_LANGUAGE=zhset.web-fetch.jsonfails the test with a one-line diff.make lint-checkpasses (tests/baselinesadded to the Ruff include list).make docs-checkpasses.tests/test_golden_reports.pyand the packaging and privacy tests pass.make ci-tests/test-python(TEST_PATHS=tests). No workflow change was needed.Closes #340