Skip to content

test: run tests in parallel, split CI static checks, trim slow tests and fold golden snapshots - #358

Merged
lanyue-llk merged 9 commits into
mainfrom
refactor/test-speed
Nov 24, 2026
Merged

lanyue-llk merged 9 commits into
mainfrom
refactor/test-speed

Conversation

@lanyue-llk

@lanyue-llk lanyue-llk commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

First pass at #356: tests run in parallel by default, every CI pytest shard runs only pytest, and the slowest tests run on smaller inputs. It also folds the golden byte snapshots into the per-track baselines (#352) and skips Node-package tests on a local checkout that has no node_modules (#355).

This PR does not reach the raised targets: under 60 s locally and under 3 min in CI. "Remaining work" below lists what is left, with numbers.

flowchart LR
  scope[Select check scope] --> static["Static checks and Node suites<br/>make ci-static: naming, lint, shell,<br/>fixture smoke, Node UI/adapters, extraction SDK"]
  scope --> s1["Python tests 1/3"] & s2["Python tests 2/3"] & s3["Python tests 3/3"]
  scope --> pkg[Installation and packaging] & browser[Rendered reference and report checks]
  static & s1 & s2 & s3 & pkg & browser --> gate["Python 3.11 (required)"]
  subgraph baselines["tests/baselines (one refresh: WEBSTONE_UPDATE_BASELINES=1)"]
    stage["per-track stage snapshot<br/>records + outline + route digests"]
    variants["further report scenarios<br/>route digests only"]
  end
Loading

What changed

  • Infrastructure. make test-python passes -n $(PYTEST_WORKERS) --dist worksteal. PYTEST_WORKERS defaults to auto, and PYTEST_WORKERS=0 runs serially. The new make ci-static runs naming, lint, shell, fixture smoke, Node UI/adapter tests and the extraction SDK tests. make ci-tests is now ci-static + test-python. In CI, that work moves to its own static job, which also runs docs-check for documentation-only PRs, and pytest runs as three shards of -n 4 instead of two. The required Python 3.11 gate now needs static. CONTRIBUTING and .github/workflows/README.md describe the new layout.
  • Fold the golden byte snapshots into the per-track characterization baselines #352. tests/golden/, tests/golden_snapshots.py and tests/test_golden_reports.py are removed. Each baseline routes entry is now "<route> <sha256-prefix>" over normalized bytes, and the unpinned-Mermaid guard moved with it. The checkout path is normalized to <checkout>. Golden scenarios that the stage baselines did not already render keep route-digest baselines in tests/baselines/: browser-use pass; trajectory-replay pass and step-durations; the three curated replay variants; public WebArena; lexbench macos and linux; wcxb; webmainbench sample and full. headless-engine-routes.jsonl and its test moved to tests/baselines/. UPDATE_GOLDEN is replaced by WEBSTONE_UPDATE_BASELINES.
  • CI gate tests fail locally without Node packages #355. A new node_packages marker skips a test with the reason "run npm ci" when node_modules is absent and CI is unset, so CI still requires these tests. It is applied to 4 converter tests, the HTML-to-Markdown test, the headless converter test and 4 CI-concurrency tests.

Baselines

The only content change is the format of routes: a sorted list of names becomes a sorted list of name digest lines. I checked that the route names are identical before and after in every existing baseline. Two digest values differ from the deleted golden files: wcxb and webmainbench-sample pick up #351's reproduce page change, which updated the golden files on main. The golden suite passed on main before the fold.

Deleted, merged or shrunk tests

Test Reason What still covers it
test_golden_reports.py (17 cases): web-fetch, web-search, browser-use fail, trajectory-replay fail, lexbench minimal d, duplicate builds stage baselines, which now carry route digests
test_golden_reports.py: other scenarios d, moved route-digest baselines listed above
web_search/test_native_revisions.py::test_locked_reference_extensions_rescore…: full-capture replay of the shipped SimpleQA dataset (≈170 s serial) c stubbed in this test; benchmarks/websearch/test_simpleqa.py covers the replay accept/reject rules on synthetic captures
test_release_versions.py (8 tests), test_benchmark.py::test_all_shipped_suites_are_consistent, test_release_metadata.py (Web Fetch half): each re-validated every frozen suite a the validated_catalog fixture validates once per process; the suite-consistency assertions moved into test_catalog_retains_registered_task_suites…; unregistered suites still validate in full
test_explicit_utf8_io.py::test_lexbench_report_builds_under_an_ascii_locale [macos, linux] b [minimal], plus the ASCII replay of every stage baseline
test_ci_gate.py::test_only_documentation_uses_one_test_partition d, the construct no longer exists the docs-only gate test (checks are skipped for docs-only PRs)
web_extract test_cohort_report bound_intro… 24→14, unknown_total_cost… 45→17 b clean build in every mode; each damage once, rotated across modes
web_extract report_suite summary_links 4→1, authored_intro_links[False] b/d one build carries all 4 href forms, each asserted and damaged; the remaining case checks the clean build first
web_extract repair_review managed_snapshot_repair 28→10 b clean case on all 4 shapes; 6 corruptions rotated
web_extract record_report intro tests 12→7; execution_boundaries native_redirect 15→7; model_scoring transport_recovery 12→6; worker_resources release_boundary 12→6; execution_settings 9→3; completion_metrics 20→10 b every damage, status and route kept at least once; every mode keeps its clean check
web_extract fixture servers polled shutdown every 0.5 s e now polled every 10 ms; built reports are copied per test instead of rebuilt
test_local_audit local matrix 6→3 b each language combination and each timeout type (int, float) once
test_webmainbench_assembly [count=0,1,3] → [0,2] b 2 variants cover the multi-variant path, and the variant-replacement test reuses that package
test_saved_matrix_evidence 274→262, _revision 56→45, _comparability 98→82, _composition 111→109 a/b one build per presentation loops over routes×defects with restore; every before/after outcome kept
test_lexbench_verification: complete_report_runs_all_evidence_negative_controls, three_configuration_report_passes…, chinese_only_report_passes… d requested_editions…[True] asserts the full verify summary (372 cases, 4482 calls, 19 negative controls); [False] covers the zh-only report; stale-English rejection stays
test_dual_content_scopes one_acquisition[zh] b the [en] case builds both editions
test_external_local_report 6→5 cases with smaller populations b/c the release chain, the stale-text scan, the 45 s default, and failure on/off
test_selected_native_policy: real 6 s min_interval_seconds sleep e runner.time.sleep is patched
test_assemble_webfetch_refresh 150→34 synthetic tasks, webmainbench_sample_case_correction 5→3 methods, local_revision chain built once per module c/a expected counts are now derived from the scope arithmetic

Measurements

Before (main) After
Collected tests 24,096 23,937
Test code (py+mjs lines) 205,966 206,045 (fixtures added ≈ cases removed)
Local full suite, 10-core Mac 5 min 17 s (-n 8) 3 min 24 s (make test-python, -n auto)
CI wall time, code PR 9 min 10 s (primary job) 5 min 30 s (run 45378015703)
CI pytest jobs primary 9 min 10 s (incl. static), secondary 5 min 52 s shards 4 min 04 s / 5 min 16 s / 4 min 04 s; static job 39 s
Other CI jobs — packaging 3 min 26 s, browser 3 min 57 s

The scoring-source hash is unchanged (0fe89317…). uv run --frozen lexbench-webfetch version prints the same value.

Remaining work for the raised targets (60 s local, 3 min CI)

  • The local suite still takes about 1,600–1,800 CPU-seconds. Reaching 60 s on 10 cores needs roughly a 3× cut, which requires a per-file necessity review across the ~780 files. That is follow-up PR material.
  • The largest remaining single costs:
    • real shipped-data validations: test_fairness full reference ≈17 s, test_risk_control_dataset contract check ≈13 s, test_popular_sites_current ≈8 s, test_ground_truth ≈6 s, test_scoring_regressions ≈7 s, test_release_versions catalog ≈9 s;
    • lexbench macos/linux report builds, ≈6 s each;
    • the web_extract cohort/suite report builds;
    • process-timeout tests in test_moli_provider and test_browser_observation_contracts, where real timeouts are the behaviour under test.

Verification

  • CI: every job is green (run 45378015703).
  • Local make test-python: everything passes except one flaky test_moli_provider process-timeout subtest, which fails only under host load. That file is unchanged, a different moli timeout test also failed on main in the base run, and the test passes in CI.
  • uv run --frozen --all-extras python -m pytest tests/baselines: 30 passed, stable across repeated runs.
  • make lint-check: passed.
  • Without node_modules: the marked tests skip with the reason, and with CI=1 they fail as required.

Breaking changes

  • UPDATE_GOLDEN=1 and GOLDEN_KEEP are removed. Use WEBSTONE_UPDATE_BASELINES=1.
  • make test-python is parallel by default. Use PYTEST_WORKERS=0 to run serially.
  • make ci-tests no longer runs test-ui and test-native-adapters through make test. Both now run inside the new make ci-static.

Closes #352
Closes #355
Part of #356

@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 · b13ef0e

No findings in this review.

Each baseline now records a digest of every normalized report route next to
its outline, and further report scenarios of a track keep their route digests
in tests/baselines. One refresh command (WEBSTONE_UPDATE_BASELINES=1) replaces
UPDATE_GOLDEN, and the duplicate golden builds of scenarios the baselines
already render are gone. The ASCII-locale build check replays the baselines.
Catalog-mutation tests checked one changed field each but re-read every frozen
task file. A shared fixture serves the registered suites' validation from one
computed result; unregistered suites still validate in full.
The full-capture replay of the shipped SimpleQA reference dataset took about
three minutes; synthetic replay tests in test_simpleqa.py cover its rules.
Damage cases that one validator rejects regardless of mode now run on one
mode while every mode keeps its clean build; built reports are copied per
test instead of rebuilt; local fixture servers poll shutdown every 10 ms.
Matrices whose cases reach the same validator keep one case per distinct
branch; read-only tests share module-built inputs; oversized synthetic
populations shrink where the counts are not production constants; a real
retry interval sleep is patched out; duplicate Lexbench verify runs merge
into the end-to-end edition test.
make test-python uses one worker per CPU (PYTEST_WORKERS, 0 for serial).
Static checks, the fixture smoke test and the Node and extraction SDK suites
move into their own CI job through make ci-static, so every pytest shard
runs only pytest; pytest runs on three shards instead of two.
Tests marked node_packages skip with a clear reason on a checkout without
node_modules; CI (CI set) still runs and requires them.
The suite-consistency assertions join the catalog release test, and the
installed-metadata test checks only the Web Search catalog, so one worker
validates the frozen Web Fetch task files instead of three.

@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 · 7a8265a

No findings in this review.

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.

CI gate tests fail locally without Node packages Fold the golden byte snapshots into the per-track characterization baselines

1 participant