Skip to content

refactor: shared HTTP/privacy/style modules and uniform webstone <track> <stage> verbs - #345

Merged
lanyue-llk merged 3 commits into
mainfrom
refactor/shared-cli
Nov 24, 2026
Merged

lanyue-llk merged 3 commits into
mainfrom
refactor/shared-cli

Conversation

@lanyue-llk

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

Copy link
Copy Markdown
Contributor

Purpose

Two steps of the spec convergence (#314, #316):

  1. Helpers that several tracks use no longer live in web_fetch. Shared code and other tracks import them from neutral modules.
  2. Every track registers its stages with harness.adapters.TrackStages, and the root command runs webstone <track> <stage> the same way for all of them.
flowchart LR
  root["webstone &lt;track&gt; &lt;stage&gt;<br/>harness/cli.py TRACKS"] -->|"stage in STAGES.names()"| stages["&lt;track&gt;/cli.py STAGES<br/>TrackStages(run, score, report,<br/>check, package, publish, export, extra)"]
  root -->|"--help, track options"| main["&lt;track&gt;/cli.py main(argv, prog)"]
  stages --> owners["existing owners<br/>(unchanged mains)"]
  subgraph shared["shared modules"]
    http["harness/http_client.py"]
    events["harness/call_diagnostics.py"]
    privacy["harness/reporting/publication_privacy.py"]
    style["harness/reporting/style.py + report-style.css"]
  end
  web_extract --> http
  web_extract --> privacy
  web_search --> privacy
  browser_use --> style
  web_fetch --> http & events & privacy & style
  http --> events
Loading

What moved

From To Notes
web_fetch/providers/http_client.py harness/http_client.py whole module
emit, redact, diagnostic_context from web_fetch/diagnostics.py harness/call_diagnostics.py CallDiagnostics (names Web Fetch native logs) stays in web_fetch/diagnostics.py
web_fetch/publication_privacy.py harness/reporting/publication_privacy.py whole module; four Ruff findings fixed now that reporting/** is linted
STYLE and assets/report-style.css harness/reporting/style.py, harness/reporting/report-style.css (package data) asset_text and RANKING_STICKY are Web Fetch-only and stay
web_fetch/certification.py web-search branch removed harness.cli.certified_main already routes web-search to its owner

The Claude fetch worker's RUNTIME_SOURCES now names the moved paths. Local and remote checkouts compare those hashes live, and nothing in Git pins them.

Not moved: harness/safety.py and reporting/visual.py import lexbench_webfetch.paths. That module is part of SCORING_SOURCE_FILES, so its bytes feed SCORING_SOURCE_SHA256, which certified profiles and corrections bind. The package also has to stay importable without harness. Shared code keeps importing it.

Stage verbs (#316)

  • adapters.py: TrackStages.names() and .command(), plus owner_stage (lazy import, keeps owners' main() unchanged), run_stage and stage_main. These replace five copies of the same dispatch code.
  • Each track's cli.py exports STAGES:
Track Fixed stages Extras
webfetch run, score, report, check (report-revision-check), package (site-package), publish (site-publish) validate, accounts, compose, revise, every owner command
web-search run, report, check (report --check), publish, export (report --export-delivery) visual, judge, review
web-extract run (certified collection, also in the track parser and taking --home), score, report, check, package, publish prepare, plan, preflight, host, ...
trajectory-replay report, check, package, publish evaluate, replay, catalog-, cohort-, ...
browser-use run, report, check, package, publish visual, review
lexbench (python -m harness.lexbench) report, check, package reproduce, resource-*, chart
  • The root harness/cli.py gains a webfetch subcommand. Web Fetch stages also stay top-level.
  • Web Fetch rescore is renamed to score, and its two guide mentions are updated.
  • Web Extract stages also accept --home after the stage name, so webstone web-extract check --home H ... works.
  • reporting/templates.py rejects any registry key that is neither a field, a stage verb nor <variant>_<stage>. Existing keys are not renamed because built reports record the whole template entry.

Still open in #316: the wcxb-* and webmainbench-* commands stay as Web Fetch extras because the Fetch-run lane owns them. Trajectory Replay has no run verb yet: evaluate and replay are both candidates, and a process guard matches trajectory_replay evaluate. The per-track Make targets are unchanged.

Breaking changes

  • Web Fetch rescore is now score (webstone score, webstone webfetch score, python -m harness.web_fetch score). rescore no longer exists. Guides and tests are migrated.
  • webstone --help and python -m harness.web_fetch --help now also list check, package and publish, which run the same owners as report-revision-check, site-package and site-publish. python -m harness.web_fetch still lists only Web Fetch commands; the root-only commands (tracks, datasets, the other tracks, webfetch) appear only in webstone --help.
  • The report-template registry rejects a track key that is neither a field, a stage verb nor <variant>_<stage>.
  • Remote Claude fetch workers must run a checkout that has harness/http_client.py and harness/call_diagnostics.py, because the runtime-source hashes are compared by path.

Allowlists

  • layering: 9 entries -> 1 (benchmarks.publication -> web_search.revisions, an instance branch owned by the benchmark-adapter lane)
  • instance literals: unchanged (3)

Baselines

tests/baselines/*.json and tests/golden/* are unchanged. The Web Fetch scorer hash is unchanged (0fe8931734e1ba7282e1e9c8303eea958d20fdcee83d84e87cdc7e08cd08169e). tests/baselines/test_web_fetch.py now calls score instead of rescore.

Verification

  • make lint-check: passed
  • uv run --frozen --all-extras python -m pytest tests/test_architecture_layering.py tests/test_architecture_instance_literals.py: passed
  • Focused suites for moved modules, CLIs, templates, baselines and golden reports: 5956 passed, 19 skipped (architecture, adapters, root/track CLIs, templates, baselines, golden, tests/web_extract, tests/web_search, tests/browser_use, tests/trajectory_replay, moved-module suites); an earlier focused run of 3981 tests also passed

Part of #316. Part of #314.

@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 · 74b4ea2

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

Comment thread src/harness/web_extract/cli.py Outdated
Comment on lines +460 to +461
run=owner_stage("harness.web_extract.certification", "main",
"Run a certified cohort", takes_argv=True),

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 new run stage is registered only here, not in build_parser(). Consequently, webstone web-extract --home H run --profile P --method M --run-dir R reaches the track parser and fails with an invalid-command error, although the certification owner supports --home. Track help also omits run, and the module entry point cannot invoke it. Register and dispatch run in the track parser as well, forwarding the parsed home and remaining arguments to the certification owner.

…d report style into shared modules

The HTTP client and its call-event sink, the publication privacy projection and the
shared report stylesheet were used by several tracks but lived in web_fetch. Web Fetch
keeps its call log writer, asset loader and ranking styles. The certified Web Fetch
entry no longer re-routes Web Search; the root certified runner already selects it.
… <track> <stage>

Each track's cli.py exports STAGES (harness.adapters.TrackStages) mapping the fixed
verbs to its existing owners, with its own commands under extra. The root command
dispatches through it for every track, including a new webfetch subcommand. Web Fetch
rescore becomes score. The report-template registry rejects keys that are neither a
field, a stage verb nor a <variant>_<stage> variant.
… run in its parser, accept compose

Rebased on main: the new compose and revise commands join Web Fetch extras and the
registry accepts the saved_matrix_compose key. Web Extract's run stage is a parser
command that forwards --home and its arguments to certified collection. Tests that
called Web Fetch rescore use score.

@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 · 9616f61

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.

1 participant