Skip to content

fix(web-fetch): build the resource image from the src layout - #231

Merged
lanyue-llk merged 1 commit into
mainfrom
fix/resource-image-source-path
Nov 4, 2026
Merged

lanyue-llk merged 1 commit into
mainfrom
fix/resource-image-source-path

Conversation

@lanyue-llk

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

Copy link
Copy Markdown
Contributor

What, why and how of this PR

Issues

Closes #229

Summary

make resource-image copied a harness/ directory that no longer exists at the repository root. The image now mirrors the src/ layout.

No image was built. No Docker daemon is available here, so docker build and a real validate() against an image have not run. The owner's next make resource-image is the first real build.

File Change
examples/web_fetch/docker/resource.Dockerfile COPY src ./src replaces COPY harness ./harness. Also copies README.md, LICENSE, NOTICE, THIRD_PARTY.md and setup.py, which pyproject.toml declares for the project install
container_resources.py validate() hashes /workspace/src/harness/web_fetch/providers/headless_worker.py
.dockerignore browser_harness_eval.egg-info only matched the root; it now also matches src/, where the install writes it
tests/test_resource_build_context.py Reads the Dockerfile's COPY lines against the real build context instead of a fixture path

The extra COPY was not in the issue. Without those files the editable build still succeeds, but setuptools warns that an unmatched license-files pattern stops being supported after 2027-02-18, and the image build does not pin setuptools.

Paths checked and left unchanged

  • Makefile resource-image: its build context and -f path are correct.
  • /workspace/.venv/bin/python -m harness.web_fetch.providers.headless_worker: the module name does not change, and uv sync installs the project in editable mode from src.
  • repository_root() and the converter's DEFAULT_PACKAGE: on a copy of the image file layout these resolve to the workspace root and node_modules/node-html-markdown there. The import opened no missing file, including the .dockerignored configs/.
  • The other Dockerfiles under examples/trajectory_replay/ copy no harness code.
  • HEADLESS.md, docs/provider-contract.md and configs/providers.headless.json name no container path.

Evidence and receipts

No recorded value changes.

  • validate() returns hashes, limits and image identity, never a container path. A new test asserts this.
  • worker_sha256 hashes file bytes, and the worker file is not changed.
  • Searching the local evidence, implementations and runtime stores under the data home for /workspace/harness found no match. That search covered text files only, so compressed archives and binaries were not read.

Behavior to expect

An image built before this change holds the worker at the old path. validate() now fails on it, with Docker's sha256sum error rather than the "rebuild the declared image" message, and no calls run. Rebuild it. A rebuilt image gets a new image ID; IDs already recorded in evidence stay as they are.

Owner decision left open

The issue asks whether validate() should also bind the modules the worker imports. This PR leaves that as it is, because the hash is part of the recorded environment. So an image holding the current worker but an older headless.py still passes validate(), as described in the issue.

Test plan

  • tests/test_resource_build_context.py and tests/test_container_resources.py: all pass.
  • Negative controls, each applied temporarily and each making the named test fail:
    • old COPY harness ./harness: test_every_copy_source_exists_in_the_build_context
    • removing the new COPY of build inputs: test_image_receives_every_input_of_the_project_install
    • old validate() path: test_runtime_hashes_the_worker_where_the_image_holds_it
    • old .dockerignore pattern: test_build_context_excludes_credentials_and_host_dependencies
  • Layout simulation, not committed: copied the context files the Dockerfile selects into a temporary directory, imported the worker from there, and ran setuptools build_editable. The import and the build both succeeded.
  • tests/test_golden_reports.py: unchanged and passing, with no rendered output affected.
  • ruff, both gate commands: pass.
  • Local failures in the wider run of tests/test_headless.py, tests/test_headless_runner.py, tests/test_headless_engine_routes.py and tests/test_cowagent_isolation.py, 4 in all:
    • test_converter_shared_and_nonzero_not_converted and test_worker_runs_from_source_without_an_installed_harness are already known local failures.
    • test_shipped_main_and_resource_cohorts_validate_their_own_release_pins and test_shipped_cohorts_keep_portable_dns_through_public_boundaries fail only because this worktree sits inside an older checkout, whose evaluation/lexbench-webfetch.json the parent-directory search reaches. All 34 tests in that file pass from a non-nested checkout of the base commit. That run was on the base, not on this branch, so CI is the check for this branch.
  • CI (Linux) is the full-suite gate.

@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 · 5e2d56c

No findings in this review.

@lanyue-llk lanyue-llk left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review, round 1

Reviewed head: 5e2d56c7. No defects found. There are no P0, P1, P2 or P3 findings.

No Docker daemon was available for this review either, so no image was built. make resource-image and a real validate() against an image remain unrun, as the PR states.

What I verified

Paths and build inputs

  • Every context COPY source in resource.Dockerfile exists after .dockerignore filtering. /workspace/harness and COPY harness no longer appear in any tracked file. The Makefile target's context and -f path are correct.
  • The other four Dockerfiles copy only start-chromium.sh or nothing, so they do not depend on harness code.
  • I rebuilt the file layout the Dockerfile selects, using the test's own helpers (504 files), and checked three things there:
    • build_editable succeeds and produces the .pth editable wheel, with LICENSE, NOTICE and THIRD_PARTY.md included.
    • repository_root() resolves to the workspace root, DEFAULT_PACKAGE to node_modules/node-html-markdown under it, and CONVERTER to src/harness/web_fetch/html_to_markdown.mjs.
    • python -m harness.web_fetch.providers.headless_worker starts and reaches request handling. It stops with a KeyError on url for my empty {} request, which shows the imports succeed.
  • The worker import opens no missing non-bytecode file. The only non-Python file it reads is inside src/, so the .dockerignored configs/ and evaluation/ are not needed at import.
  • I repeated the import while blocking every third-party module outside the uv.lock closure of the core dependencies plus headless-eval. It succeeded; only optional probes were blocked (lxml, chardet, cchardet, html5lib, backports_abc, org).

Evidence and frozen bindings

  • validate() returns no path, and worker_sha256 hashes the unchanged worker bytes.
  • No tracked evaluation, research or package-data file binds container_resources.py, resource.Dockerfile or .dockerignore.
  • A text search for /workspace/harness across the local evidence, implementations, runtime, builds, report-builds and reviews stores found no match. Like the author's search, it did not read compressed archives or binaries.

Tests

Each negative control below was reapplied independently and fails the expected test:

Mutation Failing test
Old COPY harness ./harness test_every_copy_source_exists_in_the_build_context, and also test_runtime_hashes_the_worker_where_the_image_holds_it
Removing the new COPY of install inputs test_image_receives_every_input_of_the_project_install
Old validate() path test_runtime_hashes_the_worker_where_the_image_holds_it
Old .dockerignore pattern test_build_context_excludes_credentials_and_host_dependencies

Local runs on this head:

  • tests/test_resource_build_context.py, tests/test_container_resources.py and tests/test_golden_reports.py: 27 passed. The golden snapshots are unchanged.
  • Both ruff gate commands: pass.

Scope

  • The PR meets the path and test items of #229.
  • validate() is deliberately left unchanged, and the PR records the open owner decision about binding more modules, as the work item instructed.
  • The PR's description of what happens with an image built before this change is accurate: sha256sum fails inside the container, Docker raises that error, and no calls run.

CI on this head

  • All checks pass: "Tests and static checks", "Installation and packaging", "Rendered reference and report checks", "Python 3.11", "Select check scope", "OCR dispatch" and ocr-review.
  • main has moved since the PR's base. The only overlap with this PR's inputs is one line in pyproject.toml, and a trial merge shows no conflict.

lanyue-llk added a commit that referenced this pull request Nov 4, 2026
@lanyue-llk
lanyue-llk force-pushed the fix/resource-image-source-path branch from 5e2d56c to 98e4c95 Compare November 4, 2026 07:28

@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 · 98e4c95

No findings in this review.

@lanyue-llk
lanyue-llk merged commit c47c0e0 into main Nov 4, 2026
7 checks passed
@lanyue-llk
lanyue-llk deleted the fix/resource-image-source-path branch November 4, 2026 07:35
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.

Resource image build still copies the old harness path

1 participant