Repository navigation
refactor(webarena): pass Map ports through the contract and move the host alias to its owner - #168
Conversation
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 1
Reviewed head d2e73d1a against base a239d1cc. Two P2 findings, both test coverage. I found no defect in the production code.
Findings
P2: the mounted-script test does not check that the script runs alone
tests/environments/test_webarena_map_detail.py:99 (docstring at line 78)
Problem: The docstring says the container has "neither this package nor the topology registry", and the PR test plan cites this test. But -I only ignores PYTHONPATH, user site and the current directory. It keeps the venv's site-packages, where the project is installed, so harness still imports.
I added from harness.web_fetch.safety import unlinked_path, write_new_file to map_detail.py, which is the same import #167 reports for map_setup.py. The test still passed (1 passed). python -I map_setup.py --help also succeeds in this environment, so the same check would not catch #167 either.
Fix: Run the script with -I -S. map_detail.py --help works that way, because it only needs the standard library, and map_setup.py --help then fails with ModuleNotFoundError: No module named 'harness'. Please also correct #167's suggested test, which recommends the same -I approach.
P2: no test covers the __main__ wiring from contract to scripts
src/harness/environments/webarena/map_setup.py:602-603, :613, :615, :626
Problem: This block is the only production route from the contract into the scripts, and nothing runs it. The helpers are tested only with a literal LOCAL_SERVICES dict or an explicit port. I changed the keys to component["local_servicez"] and component["service_portz"], and test_webarena_map_setup.py, test_webarena_topology.py, test_webarena_environment_config.py and test_webarena_env_contract.py all still passed (91 passed). In production, that typo would stop the Map container at boot. The PR also records that the scripts were not run against the real image, so nothing else would catch it before deployment.
Fix: Move the block into main(argv=None), as map_detail.py now does. Add a test that patches setup, configure_*, version_browser_assets and serve, passes the repository's site-delivery-contract.json, and asserts the port, Apache and detail-command values each call receives.
Verified with no defect
- Generated values: The old and new code produce the same values for the asset check bytes, the Apache
ProxyPassandProxyPassMatchlines, the Nominatim lookup URL, the detail bind address,extra_hostsand both fixture origins. The new tests pin these to the previous literals. - Scope of
Closes #154: Both issue items are done.- No literal service port remains in
map_setup.pyormap_detail.py. host.docker.internalno longer appears in code outside the WebArena owner. It remains only in comments inwebarena/runtime.py, which is inside the owner.map-bootstrap.shdoes pass no ports, so it needs no change, and no other caller startsmap_detail.py.
- No literal service port remains in
- Hash bindings:
- The pre-change SHA-256 of each production file in the diff has no match in
evaluation,research,configs,deploy,src,testsorexamples, or in the JSON under the local evidence directory. - The canonical JSON hashes of the contract and
topology.jsonalso have no match in the repository paths; I did not search the evidence directory for those. - None of these files is in
HASH_BOUNDorcollection_implementation.
- The pre-change SHA-256 of each production file in the diff has no match in
- Public replay isolation: The public runner gains one import from the topology module, which other modules in that package already use. It shares no report target or denominator with the curated suite.
- Import of the topology module from
browser.py: This adds no import cycle in tests.topology.pyonly pulls inenv_file, andpython-dotenvis a core dependency.topology.jsonis in the package data. - Deployment check:
verify_deployment_contractrejects drift inlocal_services, and the negative control exercises that.
Tests and CI
- Lint: both gate commands pass.
- Local tests:
tests/environments,tests/test_golden_reports.py,tests/trajectory_replay,tests/test_webarena_state.py,tests/test_explicit_utf8_io.pyandtests/test_remaining_public_boundaries.pygave 2358 passed, 6 skipped. - Golden snapshots: unchanged, with no regeneration.
- CI on this head: all checks pass, including "Tests and static checks", "Installation and packaging" and "Rendered reference and report checks".
- Not run: the scripts against the real upstream Map image, as the PR also states.
|
Review round 1: both findings are fixed and none is disputed. P2, mounted-script test ( P2, untested entry point (
Misspelling Still not covered:
|
There was a problem hiding this comment.
✅ Re-review complete · c41f6b3
No findings in this incremental review.
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 2
Reviewed head c41f6b35 against base a239d1cc.
Findings
P3, PR body, "Hash-bound files" section: the evidence check is not supported as written.
- Problem: the PR says the pre-change hashes do not appear in the JSON files under the local current evidence directory. On the review machine
~/.browser-eval/evidence/currentdoes not exist andWEB_FETCH_EVIDENCE_DIRis not set, so that search covers nothing. A wider search of the JSON and JSONL files under 50 MB in the data home's evidence, datasets, builds, reviews and runtime directories finds the pre-changemap_detail.pyhash in three historical pre-call contracts. They are from one Web Fetch research cohort and the hash sits in aharness_filessnapshot. - Impact: none on the code. The snapshot lists 246 files from an older commit, and at the base commit 197 of them already differ and 24 are gone, including
map_setup.py. Nothing in the repository readsharness_files, so this change invalidates no check. - Fix: correct the section to say the old hash appears only in that unverified historical snapshot, and state which directories were searched. No code change is needed.
Verified
- Round 1 fixes: the mounted-script test runs with
-I -S, andmap_setup.maintests check the values passed to each step. #167 now suggests-I -S. - Issue scope: no literal service ports remain in
map_setup.pyormap_detail.py. Outside recorded data,host.docker.internalremains only in comments inwebarena/runtime.py. Nothing still callsmap_detail.pywithout its new arguments. - Generated values:
configure_tilesoutput from base and head was byte-identical for the same input. The browser-asset check builds the same byte strings for port 8080. - Contract:
setuponly reads archive fields and receipts, so the newlocal_serviceskey does not affect existing volumes.verify_deployment_contractrejects port drift. - Imports: importing
topologyfrombrowser.pyreads no file at import time, adds no cycle, andtopology.jsonis package data. - Local runs: both ruff commands pass.
tests/environments,tests/test_golden_reports.py,tests/test_webarena_state.py,tests/test_explicit_utf8_io.pyandtests/trajectory_replay/public_webarenagave 954 passed, 3 skipped.tests/trajectory_replayandtests/browser_usegave 2426 passed, 5 skipped. Golden snapshots are unchanged.
Not verified
- The scripts were not run against the real upstream Map image.
- The hash search skipped files over 50 MB and the data home's implementations, private-originals and reference-inputs directories.
- CI at time of writing, Tests and static checks / Installation and packaging: pass pass .
|
Review round 2: the one finding is fixed in the PR body. There are no new commits, so the head stays at c41f6b3 and the code is unchanged. Fixed: Hash-bound files section (P3). The section claimed a search of the local current evidence directory, but that directory does not exist on this machine and I repeated the wider search and got the same result as the review:
Disputed: nothing. |
lanyue-llk
left a comment
There was a problem hiding this comment.
Independent review, round 3
Reviewed head c41f6b35 against base a239d1cc, which is still the tip of main. No defects found.
What I verified
Issue #154
- Both items are done. A search of
src,scriptsanddeployfindshost.docker.internalonly in comments inwebarena/runtime.py, apart from JSON data files, which the search excluded. - The two Map scripts no longer hold literal local service ports.
localhostand127.0.0.1remain, as the PR body says.
Old and new behaviour
- I ran the base and head versions of
configure_tileson four Apache inputs: plain, already configured, wrong Rails port, and a duplicate catch-all line. The results were identical, including the error cases. - I ran both versions of
configure_browser_assetson five asset bodies. The results were identical, including the rejectednominatimandosrmURLs. - The
map_detail.pyhandler changes only in how it receives the Nominatim origin. main()makes the same calls in the same order. The one intended difference is the earlierKeyErrorfor a contract withoutlocal_services, which the PR body discloses.map-bootstrap.shis the only caller ofmap_setup.py, andmap_setup.pyis the only starter ofmap_detail.py, so the new required arguments reach every route.
Contract and imports
verify_deployment_contractcompareslocal_serviceswith the registry. The contract'sservice_portwas already checked against the registry.- No import cycle: importing
harness.environments.browserloads only thewebarenapackage andtopology.python-dotenv, whichtopologypulls in throughenv_file, is a core dependency, andtopology.jsonis declared package data. - The public replay gains only one import from the topology module, and it already imports that module elsewhere.
harness/browser_use/is not changed.
Hash-bound files
- The pre-change SHA-256 of each changed file under
srcanddeployhas no match in any tracked file at the base commit. - None of those files is in
HASH_BOUNDorcollection_implementation. - I did not repeat the data-home search; round 2 reproduced the snapshot figures it relies on.
Test strength
Each of these six mutations made at least one test fail:
map_detail.pyignores--port.map_detail.pyignores--nominatim-port.detail_service_commandpasses the wrong port.- The asset check uses a hard-coded port.
- The Apache detail route uses the wrong port.
- The asset check drops
osrm.
Local runs
- Both
ruffcommands pass. tests/environments,tests/test_golden_reports.py,tests/trajectory_replay,tests/test_webarena_state.py,tests/test_explicit_utf8_io.pyandtests/test_cowagent_isolation.py: 2362 passed, 5 skipped, 1 failed. The failure istest_worker_runs_from_source_without_an_installed_harness, which is on the known local macOS failure list.- Golden snapshots are unchanged, with no regeneration.
CI on this head
All checks pass, including "Tests and static checks", "Installation and packaging" and "Rendered reference and report checks".
Standing rules
- The PR body says
Closes #154. - The diff adds no internal hostnames, local paths or credentials, and the PR text has no attribution lines.
- #167 is open and now recommends
-I -S.
Not verified
The changed scripts have not been run against the real upstream Map image, as the PR's test plan says. #167 tracks the existing harness import in the mounted map_setup.py. If the pinned image has no harness package, that import stops the script at startup with or without this PR.
…host alias to its owner map_setup.py and map_detail.py run in the upstream Map image without the topology registry. Their container-local ports now live in the registry, reach the scripts through the mounted delivery contract and a detail-service command, and verify_deployment_contract rejects drift between the two. The Docker host alias in browser extra_hosts and both fixture-server origins now comes from the topology module. Generated values are unchanged.
c41f6b3 to
a482d94
Compare
Issues
Closes #154
Part of #87. Follow-up found during this work: #167.
Summary
Every issue item was checked against the current code and still applied.
Map container ports
topology.jsonnow holds the ports used inside the Map container: Rails 3000, Nominatim 8085 and the detail service 8091.map_setup.pycannot read the registry in the upstream image, so it reads these ports from the Map component of the mounted delivery contract. It also takes the 8080 browser-asset check from the contract's existingservice_port.map_setup.pypasses the Nominatim and detail ports tomap_detail.pyas required--portand--nominatim-portarguments.map-bootstrap.shneeds no change.verify_deployment_contractrejects a contract whoselocal_servicesdiffer from the registry.Docker host alias
environments/browser.pyextra_hostsnow usesCONTAINER_HOST_ALIASfrom the topology module.topology.container_host_origin.Generated values do not change. New tests pin the Apache configuration, the detail-service command,
extra_hostsand both fixture origins to the previous literal values.Deployment note: the contract and both Map scripts must be mounted from the same revision. A contract without
local_servicesnow stopsmap_setup.pywith aKeyErrorbefore any download starts.Hash-bound files
None of the changed files needed to be left alone:
~/.browser-eval), I searched the plain-text files inevidence,datasets,reference-inputs,implementations,builds,reviews,runtime,build-cacheandreport-builds. I did not searchprivate-originals,vmortoolchains, and I did not open archives.evidence/currentdoes not exist on this machine andWEB_FETCH_EVIDENCE_DIRis not set, so the search coveredevidence/researchand no current evidence.map_detail.pyhash is in theharness_filessnapshot of three historical pre-call contracts from one Web Fetch research cohort. No other changed file's old hash appears.lexbench_webfetchreadsharness_files. The contracts are not changed.HASH_BOUNDlist intests/test_explicit_utf8_io.pyor incollection_implementation.Not changed
host.docker.internalURLs in frozen trajectories and profiles stay as recorded.127.0.0.1andlocalhoststay in the two Map scripts, because only the ports move to the contract.harnessimport inmap_setup.pyis unchanged. With only the standard library (python -I -S) the script stops withModuleNotFoundError, and fix(webarena): mounted map_setup.py imports the harness package #167 tracks that because this PR must not change behaviour.Test plan
Local, Python 3.11 from the shared locked environment:
ruff checkcommands pass.pytest tests/environments tests/test_golden_reports.py tests/trajectory_replay tests/test_webarena_state.py tests/test_explicit_utf8_io.py -n 2: 2357 passed, 5 skipped.map_detail.pywith-I -Sagainst a stub Nominatim on the ports it was given. Adding aharnessimport to the script makes it fail.map_setup.mainwith the repository contract and check the values each step receives, in order. Misspellinglocal_servicesorservice_port, or dropping the detail command, makes them fail.map_setup.pyas a script with a contract that lackslocal_services: it exits 1 with theKeyErrorand creates nothing under--root.service_port.