From 005bffb677d34dfc4b763d274a31e94a28cf27f2 Mon Sep 17 00:00:00 2001 From: Marius Ciepluch <11855163+norandom@users.noreply.github.com> Date: Thu, 26 Nov 2026 10:15:26 +0100 Subject: [PATCH] build(image): the image leaves the search pilot's git-ignored working files out By the maintainer's decision of 2026-11-25, recorded in the handover. The option as offered: "One line in `.dockerignore` names `benchmarks/search/private/`, with a test that pins it. The local image then holds what a checkout holds." `.gitignore` ignores `benchmarks/search/private/`, where the feasibility pilot keeps its local identities and working files. `.dockerignore` did not, so `COPY --chown=1000 benchmarks` baked the directory of a local tree, 49,961 files, into the local image `openultrasast:dev`; nothing under it is tracked. A checkout has none of these files, so an image built from one never held them. Nothing under `src/` names the directory: the pilot scripts, `benchmarks/search/pilot_run.py` and `pilot_select.py`, run on the host and take the image under test as an argument. Tests: `tests/test_task_images.py::test_search_pilot_files_stay_out_of_the_image` pins the pattern, and that no `!` line with its exact prefix, with or without the trailing slash, lets it back in. It failed before the change (1 failed, 14 deselected) and passes after; with `tests/test_search_image.py`, 16 passed. On scratch copies the test fails when the line is removed, and when `!benchmarks/search/private` or `!benchmarks/search/private/` is appended. ruff, mypy, the three gates and compileall pass, and the gates print what they printed before the change. An independent reviewer approved the change in one round; its remark on the re-include check is applied. Not claimed here: the rebuilt image. It follows in this step's next part, with the check that the directory is absent from it. --- .dockerignore | 4 ++++ tests/test_task_images.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/.dockerignore b/.dockerignore index fae825ab..56ee9ac0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -30,3 +30,7 @@ benchmarks/measurements/* # the hunter's contamination report reads them from a checkout, not from the image. benchmarks/valid benchmarks/unseen + +# The search pilot's working files are git-ignored (.gitignore), so a checkout never has them; a local +# build context does. +benchmarks/search/private/ diff --git a/tests/test_task_images.py b/tests/test_task_images.py index 20e9ab8f..4687aaee 100644 --- a/tests/test_task_images.py +++ b/tests/test_task_images.py @@ -205,3 +205,13 @@ def test_reserved_populations_stay_out_of_the_image(): for population in ("benchmarks/valid", "benchmarks/unseen"): assert population in patterns, f"{population} is not excluded from the build context" assert not any(line.startswith(f"!{population}") for line in patterns), f"{population} is let back in" + + +def test_search_pilot_files_stay_out_of_the_image(): + """The search pilot's working files are git-ignored, so a checkout never has them; a local build context does.""" + patterns = [line.strip() for line in read(".dockerignore").splitlines()] + patterns = [line for line in patterns if line and not line.startswith("#")] + private = "benchmarks/search/private/" + assert private in patterns, f"{private} is not excluded from the build context" + # Docker cleans each line, so `!benchmarks/search/private` lets the directory back in as well. + assert not any(line.startswith(f"!{private}".rstrip("/")) for line in patterns), f"{private} is let back in"