Repository navigation
refactor(web-search): replace report scripts with one subcommand CLI - #139
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Head reviewed: 5e6209d6. No P0 defects. CI is green. Four findings, listed most severe first.
Findings
P1: src/harness/web_search/visual.py:63: a message-only edit invalidates visual receipts.
- Problem:
producer_sources()binds this file's SHA-256, andverify()rejects any receipt whoseproducer_sourcesdiffer. Rewording one error message therefore makes every existing Web Search visual receipt failreport --release-checkand a newpublish, for a change with no reader-visible effect. This track's rule is that receipts must keep verifying and that a change which would invalidate them is deferred, not done. The PR discloses the effect but still makes the change. Practical impact looks low: the check fails closed, recapture needs no provider calls, and I found no Web Search visual receipt in the one local data home I could check. Other hosts are unknown. - Fix: revert this line so
visual.pystays byte-identical, and list the stale message under the remaining work in## Issues, to change the next timevisual.pylegitimately changes. Correct the reference-search section, which would then report one match. If the owner prefers the clean message over receipt stability, record that decision in the PR.
P2: tests/benchmarks/test_checkout_entrypoint_precedence.py:89: the new test does not prove what its name says, and the PR does not disclose the lost guard.
- Problem:
test_search_cli_help_uses_checkout_over_noneditable_wheelputssrcfirst inPYTHONPATHitself, so the checkout wins because of the test's setup, not because of the entry point. The removed scripts did guarantee this withsys.path.insert(0, src). I confirmed the change: withPYTHONPATHholding only a staleharness.web_searchpackage and-S,python -m harness.web_search report --helpran the stale__main__and printed its marker.harness.web_fetchhas the same property and the issue asks for this form, so the design is acceptable. However, the PR's "Options and behavior of each command are unchanged" is not accurate for this case. A non-editable install now silently supplies the renderer and scorer code in place of the checkout. The removed scripts also leave theSCRIPTSparametrization, so nothing guards this path for the track. - Fix: rename the test to what it checks (for example, the help command runs from source with site hooks disabled), and state in the PR that the checkout-precedence guarantee no longer applies to these five commands and that they rely on the
uv runeditable install. If precedence must hold, add a guard in the shared entry path and a test that uses only the stale wheel onPYTHONPATH.
P2: PR body, "Effects on existing evidence": the publish --resume claim is wrong.
- Problem: the PR says a receipt must be recaptured before
publish --resume.report_visual.verifyis called only fromprepare(publication.py:41), which--resumeskips.verify_plancompares only the frozen copy'smanifest_sha256and its bound hash, so a resume is unaffected by thevisual.pyhash. The affected paths arereport --release-checkand a newpublish. Recapturing for a resume would also be pointless, because the plan binds its frozen copy underinputs/. - Fix: correct that sentence if the
visual.pyedit stays, or remove it with the revert above.
P3: src/harness/web_search/README.md:27-31,53,79,151,222,252 and .agents/skills/benchmark-report/SKILL.md:92: new command text omits uv run --frozen.
- Problem: the old prose named script paths, while the new text gives literal
python -m ...commands, including a complete copyablevisualcommand at line 79. AGENTS.md says to run repository Python only throughmakeoruv run --frozen python, and never to fall back to system Python. - Fix: use
uv run --frozen python -m harness.web_search ...in runnable commands, at least thevisualand full-gate commands on line 79 and the table.
What I verified
- References: no match for the five removed names anywhere in the tree, including
.github/,.agents/,docs/and the Makefile, so the PR's search result holds. No workflow called them. - Argument forwarding: the router passed arguments unchanged, in order, through a stubbed owner. Cases covered positionals,
--opt=value,--, negative numbers, empty strings, repeated options,-h,--heand values equal to a command name. An option placed before the command is also forwarded (--check report), which is harmless because the owner still validates it. - Dispatch: the five owners accept
argv, andjudgemaps tojudge_main. Return values are dropped as the old scripts dropped them, so exit codes do not regress. Nothing else underharness/web_searchorharness/reportingreadssys.argv, so changingargv[0]is safe. Importingcliloads onlyharness,harness.web_searchandharness.web_search.cli, so the lazy-import claim holds. - Hash bindings:
report.py,pages.py,runner.py,pyproject.tomlanduv.lockare unchanged.collection_implementation()names individual files, so addingcli.pyand__main__.pydoes not affect resume. - Scope:
Part of #100is correct. The console-script deferral is justified becausepyproject.tomlis incollection_implementation(). - Local tests (Python 3.11): both ruff commands passed.
tests/web_search,tests/test_golden_reports.py,tests/test_report_templates.py,tests/test_wcxb_participant_registry.pyandtests/benchmarks/test_checkout_entrypoint_precedence.py: 590 passed, 0 failed. This includes thetest_offline_imports.pycase the PR reported as a local failure, which passes whenPYTHONPATHselects the checkout. No golden snapshot changed. scripts/report_template.py web-search: prints the migrated commands.- CI for this head: Tests and static checks, Installation and packaging, and Rendered reference and report checks all pass. The failures above are not CI failures.
|
Review round 1 fixes, on head 813bb1d. Fixed
Disputed None. |
There was a problem hiding this comment.
✅ Re-review complete · 813bb1d
No findings in this incremental review.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Head reviewed: 813bb1d3. No defects found.
Round 1 fixes
visual.pyhash: the file is byte-identical tomain(git diff 27401304 HEADis empty), so existing visual receipts keep verifying.report.py,pages.py,runner.pyandpyproject.tomlare also unchanged.- Precedence test: the new name matches what the test does, and the PR body and track guide disclose the reliance on the editable install.
uv.lockrecords the project as editable, which supports that statement. I agree a guard cannot help, because a stale package's__main__runs before any checkout code loads. publish --resumesentence: it is gone from the PR body. "Effects on existing evidence" now says none, which matches the unchanged files above.- Command text: runnable commands in the track guide, the skill and
scripts/README.mduseuv run --frozen python -m harness.web_search.
What I verified
- References: the only remaining match for the five removed names is
src/harness/web_search/visual.py:63, as the PR lists. Onmain, those names appeared in the seven files the PR migrated or lists, and not in the Makefile, workflows ordocs/. No workflow called them. - Hash bindings: nothing under
evaluation/orsrc/harnessbinds the edited docs orconfigs/report-templates.json. This does not cover private evidence outside the repository. - Dispatch: an end-to-end run of the synthetic example with
report --checkpassed.scripts/report_template.py web-searchprints the migrated commands. Each command imports only what it needs, so the lazy-import claim holds. - Usage names on other Python versions: the
sys.argv[0]approach depends on howargparsepicks its default program name. I ran a small stand-in package on 3.13: it printed the public name. I could not run 3.14 here, so I read the CPython 3.14_prog_namesource. It falls back tobasename(sys.argv[0])whenargv[0]differs from the module origin, so the public name should hold there too. - Commits and scope: there are no attribution lines in the commits.
Part of #100is correct, and the remaining list and the console-script deferral match the issue and thecollection_implementation()binding.
Local checks (Python 3.11)
- Both ruff commands passed.
tests/web_search,tests/test_golden_reports.py,tests/test_report_templates.py,tests/test_wcxb_participant_registry.pyandtests/benchmarks/test_checkout_entrypoint_precedence.py: 590 passed, 0 failed.- No golden snapshot is in the diff.
- I did not run the real
visualcapture orpublish, which need a browser and a site target.publishandreviewwere checked through help and routing only.
CI for this head
Passing: Tests and static checks, Installation and packaging, Rendered reference and report checks, Python 3.11.
813bb1d to
ef23b27
Compare
A message-only edit changed the visual.py hash that receipts bind, which would fail every existing receipt at report --release-check and a new publish. Restore the file byte for byte. The stale script name in its regenerate message stays until a change that already has to invalidate these receipts.
The test puts src first on PYTHONPATH, so it cannot show checkout precedence over a noneditable wheel. A module entry point cannot provide that either, because the installed package would already be the one running. Rename the test and state the reliance on the uv run editable install in the track guide.
AGENTS.md requires make or uv run --frozen python, so command text must not read as a bare python invocation.
ef23b27 to
b59b0a3
Compare
Issues
Closes #100. This PR covers the Web Search report scripts only. Remaining:
pyproject.tomlconsole script for this track (see "Left out on purpose").scripts/moli_report/move, and the logic-heavy scripts the issue names.src/harness/web_search/visual.pyline 63 still saysregenerate with check_search_report_visual.py. Receipts bind that file's hash, so correct the message in a change that already has to invalidate them.Summary
Replaces five Web Search scripts with one entry point:
scripts/build_search_report.pyuv run --frozen python -m harness.web_search reportscripts/check_search_report_visual.pyuv run --frozen python -m harness.web_search visualscripts/judge_search_relevance.pyuv run --frozen python -m harness.web_search judgescripts/review_search_results.pyuv run --frozen python -m harness.web_search reviewscripts/publish_search_report.pyuv run --frozen python -m harness.web_search publishNo aliases remain. Each command's options are unchanged, and
reviewkeeps itsfreeze,runandcollectcommands.One behavior change: checkout precedence. The removed scripts put the checkout's
src/first withsys.path.insert, so they ran checkout code even over a noneditable installed package.python -mhas no such step: it resolvesharnessfromsys.path, so an environment holding a noneditable older package runs that package's__main__. A guard in this checkout cannot fix that, because it would never be loaded. These commands therefore rely on the editable install thatuv run --frozenprovides, and the track guide says so.cli.pyroutes each command to the existingmain(argv)of the module that owns it, instead of moving every option into one parser asharness.web_fetchdoes. That is deliberate:renderer_sha256, the hash ofreport.py, and the golden snapshot covers that manifest. Editingreport.pywould change generated output for a change that has no reader-visible effect.publishdependencies and similar are not loaded for other commands.The router also sets
sys.argv[0]while the owner runs, so owner--helpand errors print the public command name. It restores the value afterwards.Effects on existing evidence
None.
visual.py,report.py,pages.py,runner.pyandpyproject.tomlare byte-identical tomain, so visual receipts, renderer hashes and collection resume bindings keep verifying.Left out on purpose
pyproject.toml.collection_implementation()freezes that file's hash and resume rejects drift, so editing it would block resuming an interrupted Web Search collection. Adding one is an owner decision, and it can be done when no collection is in flight..github/workflows/: no workflow calls any of the five scripts, so no workflow change was needed.harness.web_search.runnerandharness.web_search.example: these module entry points are outside this item's five scripts.Reference search
Searched the whole working tree (excluding
.git,.venv,node_modulesand__pycache__) for the five removed names. After this change there is 1 match:src/harness/web_search/visual.py:63, the regenerate message listed under remaining work. References migrated:src/harness/web_search/README.mdexamples/web_search/README.mdconfigs/report-templates.jsonbuild,check,release_check;entrypointis nowsrc/harness/web_search/cli.py.agents/skills/benchmark-report/SKILL.mdscripts/README.mdtests/benchmarks/test_checkout_entrypoint_precedence.pysrclisted before a stale wheelThe Makefile, CI workflows,
docs/and the root READMEs had no references. Supported entry points for this track's reports are now the five commands above.Test plan
Local, Python 3.11 shared environment:
pytest tests/web_search tests/test_golden_reports.py tests/test_report_templates.py tests/test_wcxb_participant_registry.py tests/benchmarks/test_checkout_entrypoint_precedence.py -n 2, with this checkout'ssrconPYTHONPATH: 590 passed.web-search.PYTHONPATH,python -S -m harness.web_search report --helpran the stale__main__.git diff 27401304 -- src/harness/web_search/visual.pyis empty.tests/web_search/test_cli.pycovers help for every command under its public name, nestedreviewcommands, missing and unknown commands, unknown options reaching the owner, a realreport --checkon the synthetic example, and the template registry.tests/package_smoke.pynow runspython -m harness.web_search report --helpfrom the installed package. It was not run locally; the "Installation and packaging" check runs it.