M27: Guard uv build & Local Wheel Staging in run_e2e.sh When INSTALL_SOURCE=pypi¶
- Task ID:
M27 - Priority:
P3(Master Rank#16, Track B — Simple Fixes, Docs & CI Hygiene) - Status:
Done - Dependencies:
M8,M11 - Target Repository:
/Users/ivan/Project/3t.tools.intellij/verityredteam-free(verity-redteam-core) - GitHub Project #5: Verity RedTeam Free Task Board
1. Context & Problem Statement¶
tests/e2e_containers/run_e2e.sh (lines 21–36) unconditionally runs uv build and stages the freshly built wheel into the local staging directory (.wheel_stage/) before invoking Docker Compose, regardless of INSTALL_SOURCE.
When INSTALL_SOURCE=pypi:
- The wheel build is never consumed by any customer container (they install from PyPI), so build time is wasted on every run.
- Staging still copies a wheel, and stale *.whl files left in dist/ can be selected and staged — or picked up later when the same checkout is rerun in wheel mode — leading to tests exercising an outdated artifact.
The build and staging steps must be guarded behind if [ "$INSTALL_SOURCE" = "wheel" ]; then … fi, while still ensuring the staging directory exists so the Docker build context never fails.
2. Requirements & Target Files¶
- Guard build + staging in
tests/e2e_containers/run_e2e.sh(lines 21–36):uv build, wheel discovery, and wheel copy into.wheel_stage/must run only inwheelmode. - Directory invariant:
.wheel_stage/(or the configured staging dir) must always exist (mkdir -p) regardless ofINSTALL_SOURCE, so the Docker build context and DockerfileCOPYnever fail inpypimode. - Stale artifact hygiene: before building, remove previous wheel(s) from both
dist/and the staging directory (e.g.rm -f dist/verity_redteam_core-*.whland clearing staged wheels) to guarantee a fresh artifact is used. - Fail-fast preserved: in
wheelmode, ifuv buildproduces noverity_redteam_core-*.whl, exit non-zero with a clear message. Inpypimode, no wheel check is performed and the run proceeds. - Compose wiring unchanged:
docker compose build --build-arg INSTALL_SOURCE="$INSTALL_SOURCE"continues to receive the selected mode in both branches. - Testability: build/staging logic must be observable from a shell/unit test in
tests/unit/test_e2e_runner_hygiene.py(e.g. static assertions on the script plus an executable harness that stubsuvanddocker compose).
3. Automated Tests to Verify (tests/unit/test_e2e_runner_hygiene.py)¶
INSTALL_SOURCE=pypi:uv buildis not invoked, no wheel is copied into.wheel_stage/, anddocker compose buildstill receivesINSTALL_SOURCE=pypi(parametrized with default/unset value resolving towheelor documented default).INSTALL_SOURCE=wheel: staledist/verity_redteam_core-*.whland staged wheels are removed beforeuv build; fresh wheel is discovered and copied into.wheel_stage/.- Staging directory (
.wheel_stage/) exists after the script's setup phase in both modes. INSTALL_SOURCE=wheelwith a stubbeduv buildproducing no wheel → script exits non-zero with the expected message;INSTALL_SOURCE=pypiunder the same stub → script does not fail on missing wheel.- Script hygiene:
bash -n tests/e2e_containers/run_e2e.shand (if available)shellcheckpass.
4. Acceptance Scenario in Clean Container with Real MCP Server Config¶
Run the container E2E suite in both install modes from a clean checkout:
- Wheel mode
uv buildruns, stale wheels are cleared first,.wheel_stage/contains exactly the freshly builtverity_redteam_core-*.whl.-
All customer containers (
customer-pip,customer-uvx,customer-full-workstation) pass. -
PyPI mode
uv buildis not invoked and no local wheel is staged;.wheel_stage/still exists so the Docker build context is valid.-
All customer containers install from PyPI and pass.
-
Stale-wheel regression
- Seed
dist/with an olderverity_redteam_core-0.0.0-*.whl, then runINSTALL_SOURCE=wheel ./tests/e2e_containers/run_e2e.sh. - Assertions: the stale artifact is removed before build, no log/line references the seeded stale version, and the run passes using only the newly built wheel.
5. Verification Commands¶
cd /Users/ivan/Project/3t.tools.intellij/verityredteam-free
uv run ruff check src tests
uv run pytest tests/unit/test_e2e_runner_hygiene.py -v
uv run pytest tests/
INSTALL_SOURCE=wheel ./tests/e2e_containers/run_e2e.sh
INSTALL_SOURCE=pypi ./tests/e2e_containers/run_e2e.sh
6. Acceptance Criteria¶
- [ ]
uv buildand wheel staging intests/e2e_containers/run_e2e.shrun only whenINSTALL_SOURCE=wheel. - [ ]
.wheel_stage/always exists beforedocker compose build, regardless ofINSTALL_SOURCE. - [ ] Stale wheels in
dist/and the staging directory are removed before building; a seeded stale wheel is never used. - [ ] Missing wheel in
wheelmode fails fast;pypimode proceeds without any build or wheel check. - [ ]
tests/unit/test_e2e_runner_hygiene.py, fullpytest tests/,ruff check src tests, and container E2E runs for bothINSTALL_SOURCE=wheelandINSTALL_SOURCE=pypipass cleanly.