Repository navigation
refactor(web-fetch): move Web Fetch scripts to subcommands - #181
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Head reviewed: a39075ba. CI on this head passes: Tests and static checks, Installation and packaging, and Rendered reference and report checks.
Findings
P2: import-env can write credentials to a file the runner never reads
src/harness/web_fetch/cli.py:81, src/harness/web_fetch/accounts.py:114
- Problem: the old script always defaulted
--targetto the checkout's.env. The router callsmain_import_credentials()with no default, so the target is nowPath.cwd() / ".env".load_runtime_envstill readsROOT / ".env"(config.py:72). Run from any other directory, the command reports success, copies live credentials into that directory, and later runs do not see them. I confirmed this from a temporary directory: the command reported its target as<tmp>/.env. The.gitignoreentry only protects copies inside the repository. - The PR lists this as a default-root change, but it differs from the other six. Those commands fail on missing inputs or write non-secret output. This one duplicates a secret. The
Path.cwd()fallback was also unused until now, because the only entry point always passed a target. - Fix: default the target to
harness.web_fetch.config.ROOT / ".env", the fileload_runtime_envreads, and add a test that runs the command from another directory.package_smoke.pypasses--targetexplicitly, so it does not cover the default.
P2: the headless guide still says a script runs the moved stage
src/harness/web_fetch/HEADLESS.md:188
- Problem: "
headless_runner.pyowns cohort selection, execution and implementation checks. The command inscripts/delegates to it." That command wasrun_headless_benchmark.py, which this PR removes. No file inscripts/callsheadless_runnernow.run_certified_benchmark.pycallscertification.main. The name search in the PR's reference check could not find this sentence because it does not name the script. - Fix: name
headless-run, for example "python -m harness.web_fetch headless-runruns it."
P3: the documented headless-check --rescore command always fails (already on main)
src/harness/web_fetch/HEADLESS.md:354, :373; src/harness/web_fetch/headless_runner.py:316
- Problem:
check_evidenceraisesRescoring requires an explicit report_profilewhenever--report-profileis absent, even without--rescore. The guide command omits the flag, so it fails before any evidence check. The cohort rejection described at line 373 is never reached in that form either. I reproduced this at this head. - The same check explains why
test_optimized_python_rejects_invalid_inventoryfails onmainwherever the reference inputs are installed. Its CI pass is not evidence forheadless-check. - This PR did not cause it, but it rewrites both guide lines. Fix: add
--report-profile PROFILEto the guide and to that test, here or in a follow-up issue.
Verified with no defect
- Router mapping: each of the 23 commands points at the function its old script called.
reference-finalizekeeps exit status 1 for an unverified result, and the three parsers moved intocli.pymatch the old scripts. - Argument handling: owners get the same arguments through
sys.argv. No owner underharness/web_fetchorharness/reportingreadssys.argv[0]for other uses. headless_worker.pyremoval: the provider, the runner hash and the resource container all useproviders/headless_worker.py. The resource Dockerfile only copiesscripts/.- Remaining references: the removed script names appear in no tracked file except two test aliases and same-named functions.
- Hash bindings: the
f877f6a6SHA-256 of every changed or deleted non-test file appears in no tracked file, so no hash in Git binds the old bytes.rescoring.pyis the only changed-scope module that hashes its own file, and it keeps its block.capture_source_identitycovers no changed file. - Kept scripts: I checked the named authorities:
run-profile.json,initial-reference-audit.json, theinputs.pyafter_sha256incode-migration.json, and the latency certifier markers. The pending scripts match #151. No Web Fetch script is left unclassified. - Process markers: no marker in
competing_benchmark_pidsor the otherps/pgrepcallers names a removed script. - Credentials: the publish commands do not call
load_runtime_envthrough the router.--helpforsite-publish,site-verifyandsite-bundle-checkcreates no files in a clean directory and home. Adding aload_tokencall topublication_verify.mainmade the rewritten credential test fail. - Golden snapshots: only
report-manifest.jsoninweb-fetchchanged, which matches the template registry edit. The removed translation key has no matching text inreport.py. - Workflows: nothing under
.github/workflows/changed, and no workflow calls a moved script.
Tests run locally at this head
- Both ruff gates passed.
tests/test_golden_reports.pyand the affected test modules ran. The only failures are on the known local macOS list:test_optimized_python_rejects_invalid_inventory(it also fails onf877f6a6),test_converter_shared_and_nonzero_not_convertedand fourtest_ci_gate.pycases.- Not run: real provider calls or publication.
There was a problem hiding this comment.
✅ Re-review complete · 0e766eb
No findings in this incremental review.
|
Review round 1: all three findings are fixed, none disputed.
I updated the PR body to match the new |
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Head reviewed: 0e766eb0, based on current main (f877f6a6). CI on this head passes: Tests and static checks, Installation and packaging, Rendered reference and report checks, and Python 3.11.
Findings
P3: one new guide line shows a bare python command
scripts/README.md:6
- Problem: this PR adds "Track stages run as
python -m harness.<track> <command>." Issue #179 andAGENTS.mdrequireuv run --frozen python. All the other track sections in this file use that form, starting at line 32. This is the only new command in the diff with a barepython. - Fix: change it to
uv run --frozen python -m harness.<track> <command>.
I found no correctness, evidence or scope defects.
Round 1 fixes
All three hold.
import-envdefault: the target is nowconfig.ROOT / ".env", the fileload_runtime_envreads. I restored the oldPath.cwd()default and the new test failed, so it does guard this.- Headless guide sentence: it now names
headless-run. --report-profile:check_evidencedoes raise without it, and the guide now says so. The test still reachesTask inventory differs, because that check runs before the profile is read. That test skipped in my run because reference inputs are not installed in this worktree, so I read the code path but did not run it.
What I verified
- Removed scripts: the diff removes all 24 scripts in the PR table. No tracked file names any of them, and the only remaining
headless_worker.pyreferences are toproviders/headless_worker.py. The installedlexbench_webfetchpackage names none of them either. - Hash bindings: I hashed the
mainversion of each removed script and each modified file, then searched the tracked tree for those hashes. There were no hits. I also searchedlexbench_webfetchfor the removed scripts and the main changed sources (not the tests), with no hits.capture_source_identitycovers no file this PR changes. - Kept scripts:
- None of the 24 removed scripts is on the #151 pending list.
research/initial-reference-audit.jsonbindscollect_source_evidence.pyandaudit_initial_references.py.- The
lexbench_webfetch/inputs.pyerror text namesimport_reference_inputs.py, and that file's hash is incode-migration.json.
- Process markers: the certifier markers name only scripts that stay.
headless-observationsmatches on browser profile flags, not script paths. - Old and new behaviour:
- I compared each removed script with its router entry. Only the disclosed default-root change differs. Where that default matters, a missing source or authority file should stop the command rather than give a false pass.
reference-finalizekeeps its exit status of 1 anddiagnostic-checkkeeps its parser error.- None of the owner modules I checked reads
sys.argvdirectly. rescoring.pyuses multiprocessing. By my reading ofmultiprocessing.spawn,-mwith a.__main__module is safe. I did not run this path.
- Credentials: with a sentinel
.envin the checkout, importing the router and runningsite-verify --helpleft the environment unchanged. - Guides: every flag shown for a moved command in the changed guides, the skill reference and
configs/report-templates.jsonexists in that command's--help. - Translation entry: the removed key does not match the current
report.pytext. - Golden snapshot: only
report-manifest.jsonchanges inweb-fetch, as the PR says.
Local runs
- Ruff: both commands passed.
- Golden, owner-command, config, entry-point, publish, package, privacy, report-check, headless and template tests: 441 passed, 5 skipped, 1 failed.
- The failure is
test_migrated_roots_and_worker_paths. It compares/tmpwith/private/tmp, which comes from where this worktree sits on macOS. The PR does not touch that assertion, and the full suite passes in CI.
I did not make provider calls, publish anything or build a report from measured evidence.
Outside this PR
report.py is unchanged here, and its headless reproduction sentence that names run_certified_benchmark.py has no exact entry in the translation catalog, and no phrase entry matches it. The English edition of that page may therefore show Chinese text. This already happens on main, and I did not render the page. It may deserve its own issue.
|
Review round 2: Fixed (ed7f82c): Disputed: nothing. Not changed, because this PR's diff does not add these lines:
Local results: ruff passes, and |
There was a problem hiding this comment.
ℹ️ Review skipped · ed7f82c
No reviewable content was selected for this run.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 3
Reviewed head: ed7f82c5. No defects found.
What I verified
- Removed scripts: a whole-word search of all tracked files, and of the installed
lexbench_webfetch, finds no reference to any of the 24 removed scripts. The hits that remain are module and function names, such asproviders/headless_worker.pyandfinalize_reference_checks, plus the two test aliases the PR names. - Router parity: I compared every removed script with its router entry.
reference-finalizekeeps exit status 1 for an unverified result.diagnostic-checkkeeps its one-output rule.- No other removed script used a return value as its exit status.
- No owner reads
sys.argv[0]or records it.
headless_worker.py: the provider and the resource container both runproviders/headless_worker.pydirectly, so nothing depended on the removed script.- Module entries: nothing runs
-m harness.web_fetch.headless_runner,.scoring_revisionor.reference_revisionnow. Neither of those last two files reads its own bytes for a binding. - Hash bindings:
- The base-commit SHA-256 of every modified or deleted file under
scripts,srcandconfigsappears in no tracked file. cli.pyincode-migration.jsonis the LexBench file, not this one.capture_source_identitycovers no file this PR changed.
- The base-commit SHA-256 of every modified or deleted file under
- Kept scripts:
research/initial-reference-audit.jsonnames the two audit scripts,lexbench_webfetch/inputs.pynamesimport_reference_inputs.pyandcode-migration.jsonbinds that file's hash. The scripts left for #151 match its list. - Default root: with no path given, the moved commands use the working directory. Most then fail if run outside the checkout, because their inputs are missing;
site-verify --exportis the exception and writes topublish/in that directory.release.pypassescwd=ROOT, and the Make targets run from the checkout. - Earlier rounds: the fixes hold.
import-envtargetsconfig.ROOT / ".env", theHEADLESS.mdwording and--report-profilecommands are correct, andscripts/README.mdusesuv run --frozen python. No added line in the diff uses a barepythoncommand. - Golden snapshots: only the
report-manifest.jsonhash intests/golden/web-fetch.jsonchanges, which is the change the PR explains. - Scope: "Closes #179" is accurate. No workflow file changed, and the diff has no private data or attribution lines.
Test results
- Lint: both ruff gates pass.
- Targeted tests, first set: 486 passed, 1 failed. This set covers golden reports, owner commands, config, entry points, publish and package, headless, documented paths, the public WebArena release and checkout precedence.
- The one failure:
test_config.py::test_migrated_roots_and_worker_pathscompares/tmp/...with/private/tmp/.... That comes from my worktree sitting under a symlinked path, and the test passes in CI. - Targeted tests, second set: 168 passed, 5 skipped. This set covers packaging hygiene, external local report, browser reference scope, headless report and reference inputs.
- Commands:
--helpworks from outside the checkout for the router,native-dnsandreference-finalize.make -n report-checkandmake -n import-envprint the new commands. - CI on
ed7f82c5: all pass, including "Tests and static checks", "Installation and packaging" and "Rendered reference and report checks".
Not run
No real provider calls, publication, or report build against measured evidence. Receipts outside Git could not be checked, as the PR says.
Noted, not raised as a finding
No production caller now passes the root= or authority_root= keyword to report_publish.main, publication_verify.main, publication_check.main or report_check.revision_main, so those parameters are unused. browser_observations.py is hash-bound and has to keep its own, and a test still passes root= to report_package.main. A partial cleanup would make these owners inconsistent and change no behaviour, so I would leave it for a later cleanup.
ed7f82c to
8250e40
Compare
Issues
Closes #179.
Summary
23 Web Fetch scripts become subcommands of
python -m harness.web_fetch, using the router table from #145. One more script,headless_worker.py, is removed because nothing ran it. No old names remain as aliases.run_headless_benchmark.pyheadless-runcapture_headless_browser_observations.pyheadless-observationsassemble_headless.pyheadless-assemblecheck_headless_evidence.pyheadless-checkpackage_headless_resources.pyheadless-resourcesreview_headless_results.pyreview-headlessreview_result_anomalies.pyreview-anomaliesmerge_result_review_revision.pyreview-mergerebase_blind_result_review.pyreview-rebaserescore_content.pycontent-rescorerevise_body_scoring.pyscoring-revisionrevise_reference_evidence.pyreference-revisionfinalize_reference_checks.pyreference-finalizeappend_dynamic_content.pydynamic-appendmerge_dynamic_supplement.pydynamic-mergebuild_native_dns.pynative-dnscheck_report_revision.pyreport-revision-checkcheck_diagnostic_report.pydiagnostic-checkcheck_publication_bundle.pysite-bundle-checkpackage_artifact_site.pysite-packagepublish_artifact_site.pysite-publishverify_artifact_site.pysite-verifyimport_benchmark_env.pyimport-envheadless_worker.pyproviders/headless_worker.pydirectlyThe Makefile, guides, skill reference,
SECURITY.md,configs/report-templates.json,public_webarena/release.py,tests/package_smoke.pyand the tests move in this change.scripts/README.mdnow lists only the scripts that stay.Behavior worth reviewing
site-package,site-publish,site-verify,site-bundle-check,report-revision-checkandheadless-observations. The commands use each owner's existing default, the working directory, aswcxb-publishdid in refactor(web-fetch): move WCXB and WebMainBench scripts to subcommands #145. Make targets andrelease.pyrun from the checkout, so they behave the same. Elsewhere, pass the path or run from the checkout.import-envkeeps the repository.envdefault. Its default target isharness.web_fetch.config.ROOT / ".env", the fileload_runtime_envreads, from any working directory. A test covers it.cli.py.reference-finalize,native-dnsanddiagnostic-checkhad their parsers in the script.capture_source_identityhashesreference_lifecycle.pyandnetwork_dns.py, so their parsers cannot move there. The third sits beside them for consistency, as in refactor(trajectory-replay): replace curated scripts with one subcommand CLI #176.reference-finalizekeeps its exit status of 1 for an unverified result, and a test covers it.python -m harness.web_fetch.headless_runner,.scoring_revisionand.reference_revisionare gone, because the guide now shows the subcommands..rescoringkeeps its block because that file hashes its own bytes into each rescore receipt.headless-runis now documented. The only mention of the old script was a translation entry whose key no longer matches any text inreport.py, which namesrun_certified_benchmark.pyinstead. I removed that dead entry, which changes no golden route, andHEADLESS.mdnow names the command and says its output is diagnostic only.--helpfor each publish, verify and bundle command through the router and still fails on any token read or created file. The source check forload_runtime_envnow readsreport_publish.pyandpublication_verify.py, becausecli.pyimports that function forrun.Golden snapshot changed:
web-fetchOnly
report-manifest.jsonchanges, because the manifest embeds the template registry and itsdiagnostic_check,snapshot_audit_packageandsnapshot_audit_publishcommands changed. Regenerated withUPDATE_GOLDEN=1. No HTML route and no other snapshot changed.Latency guard
competing_benchmark_pidsneeds no change. All its script markers name scripts that stay, and no other process marker or path check named a removed script. A test now fails if the bound certifiers stop namingrun_benchmark.py,build_report.py,check_report.pyorcheck_report_links.py, or if one of those scripts disappears.Left in place
run_benchmark.py,build_report.py,check_report.py,check_report_links.pydata/latency-certifiers/*.py.txtfiles match running processes against these paths, the same rule #145 applied.check_report_links.pyis also shared with other tracks.run_certified_benchmark.pyevaluation/risk-control/run-profile.jsonandrisk_control.pyname it as the certified entry point.collect_source_evidence.py,audit_initial_references.pyresearch/initial-reference-audit.jsonbinds their hashes.import_reference_inputs.pylexbench_webfetch/inputs.pynames it. That file's current hash is theafter_sha256incode-migration.json, so the text cannot change.restore_report_content.pyharness.reporting, not this track.add_provider_results.py,certify_headless_cases.py,project_headless_provider.py,build_postcheck_observations.py,check_resource_links.py,select_headless_speed_cases.py,package_headless_speed.py,assemble_webfetch_dataset.py,assemble_webfetch_refresh.py,audit_fixed_native_comparison.py,probe_cowagent_text.py, the three result-review shard tools,authorize_artifact_site.py,rename_artifact_site.pyNo workflow calls a moved script, so
.github/workflows/needed no change.Effects on existing evidence
report.py,rescoring.py,reference_lifecycle.py,network_dns.py,review_execution.py,result_review.pyandbrowser_observations.pyare byte-identical tomain.runtime_source_sha256:runner.pyhashes every.pyfile underharness/web_fetch, so new runs record a new value, as after any earlier change there. A run started before this change cannot resume after it.configs/report-templates.jsonchanged, as in refactor(web-fetch): move WCXB and WebMainBench scripts to subcommands #145 and refactor(trajectory-replay): replace curated scripts with one subcommand CLI #176. A privatereport-content-binding.jsonmay declare its hash underauthority. No binding in Git names it, so I could not check a real one.Reference search
Searching all tracked files for the removed script names leaves two local aliases in tests, neither of which refers to a script:
run_headless_benchmarkintests/test_reference_inputs.pyandrescore_contentintests/test_scoring.py.Test plan
Run locally with the shared locked environment on Python 3.11:
ruff check --config 'include=["*.py"]' --select F,TID252 .andruff check: passed.tests/test_golden_reports.py: 10 passed after regeneratingweb-fetch.main. Most areHistorical benchmark source is not recorded in the dataset lock, the nested-worktree cause described in refactor(web-fetch): move WCXB and WebMainBench scripts to subcommands #145.node_modules/node-html-markdown, a missingevaluation/popular-sites/current-report.json, and tests on the known local macOS failure list.make -n import-env report-check PROFILE=/p.jsonprints the new commands.tests/test_web_fetch_owner_commands.pynow checks that every new command's--helpcomes from its owner.tests/package_smoke.pywas edited but not run locally. The "Installation and packaging" check runs it.tests/test_golden_reports.pywith the config, accounts, env-file, owner-command, headless, runtime-entrypoint and path-privacy tests gave 335 passed and 1 failed (test_converter_shared_and_nonzero_not_converted, on the known local failure list).test_optimized_python_rejects_invalid_inventorynow passes locally with reference inputs installed.