Skip to content

Commit 51be8f2

Browse files
committed
test(ci): drop retired staging build context
1 parent 5a9d274 commit 51be8f2

1 file changed

Lines changed: 32 additions & 49 deletions

File tree

‎tests/unit/test_contract_dependencies.py‎

Lines changed: 32 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -243,55 +243,38 @@ def test_runtime_and_sdk_package_identities_are_split():
243243
]
244244

245245

246-
def test_docker_build_contexts_prepare_root_package_metadata():
247-
docker_contexts = [
248-
PROJECT_ROOT / "Dockerfile.api",
249-
PROJECT_ROOT / "scripts" / "k8s_staging_up.sh",
250-
]
251-
252-
for docker_context in docker_contexts:
253-
text = docker_context.read_text(encoding="utf-8")
254-
relative_path = docker_context.relative_to(PROJECT_ROOT).as_posix()
255-
256-
if relative_path == "Dockerfile.api":
257-
assert "COPY README.md /build/README.md" in text
258-
assert "python -m build --wheel" in text
259-
assert "pip install --no-cache-dir -e" not in text
260-
assert "setuptools==82.0.1" in text
261-
assert "wheel==0.47.0" in text
262-
assert "COPY contracts /app/contracts" in text
263-
assert "AGENTFLOW_ENTITY_CONTRACTS_DIR=/app/contracts/entities" in text
264-
# Audit P1-3: third-party packages come only from the hash-pinned
265-
# export of uv.lock; the project wheel installs with --no-deps and
266-
# pip check proves the environment is consistent.
267-
assert "--require-hashes -r /tmp/requirements-docker.lock" in text
268-
assert 'pip install --no-cache-dir --no-deps "${wheel}"' in text
269-
assert "pip check" in text
270-
# Runtime image must not ship installer tooling: Trivy SBOM tied
271-
# GHSA-6v7p-g79w-8964 (msgpack via pip vendor) and CVE-2025-47273
272-
# (setuptools) to the final-layer pip/setuptools/wheel tree, not
273-
# to requirements-docker.lock. Uninstall only after installs and
274-
# pip check so the hash-locked environment is still verified.
275-
final_stage = text.rsplit("FROM ", maxsplit=1)[-1]
276-
uninstall = "python -m pip uninstall --yes pip setuptools wheel"
277-
assert uninstall in final_stage
278-
assert final_stage.index("pip check") < final_stage.index(uninstall)
279-
# Q0.2 / S9: scale profile needs the Postgres control-plane driver
280-
# baked in (kind 2-pod previously required a docker-commit psycopg
281-
# hack). The wheel installs --no-deps, so the guarantee now lives
282-
# in the lock export the image installs from — pool included
283-
# (audit P1-1).
284-
lock_text = (PROJECT_ROOT / "requirements-docker.lock").read_text(encoding="utf-8")
285-
assert "psycopg==" in lock_text
286-
assert "psycopg-pool==" in lock_text
287-
assert "boto3==" in lock_text # the cloud extra is in the export too
288-
else:
289-
assert "COPY README.md /app/README.md" in text, (
290-
f"{relative_path} must copy README.md before installing the root package"
291-
)
292-
assert '".[postgres]"' in text or "[postgres]" in text, (
293-
f"{relative_path} must install the postgres extra (psycopg) for scale profile"
294-
)
246+
def test_api_dockerfile_prepares_root_package_metadata():
247+
text = (PROJECT_ROOT / "Dockerfile.api").read_text(encoding="utf-8")
248+
249+
assert "COPY README.md /build/README.md" in text
250+
assert "python -m build --wheel" in text
251+
assert "pip install --no-cache-dir -e" not in text
252+
assert "setuptools==82.0.1" in text
253+
assert "wheel==0.47.0" in text
254+
assert "COPY contracts /app/contracts" in text
255+
assert "AGENTFLOW_ENTITY_CONTRACTS_DIR=/app/contracts/entities" in text
256+
# Audit P1-3: third-party packages come only from the hash-pinned
257+
# export of uv.lock; the project wheel installs with --no-deps and
258+
# pip check proves the environment is consistent.
259+
assert "--require-hashes -r /tmp/requirements-docker.lock" in text
260+
assert 'pip install --no-cache-dir --no-deps "${wheel}"' in text
261+
assert "pip check" in text
262+
# Runtime image must not ship installer tooling: Trivy SBOM tied
263+
# GHSA-6v7p-g79w-8964 (msgpack via pip vendor) and CVE-2025-47273
264+
# (setuptools) to the final-layer pip/setuptools/wheel tree, not
265+
# to requirements-docker.lock. Uninstall only after installs and
266+
# pip check so the hash-locked environment is still verified.
267+
final_stage = text.rsplit("FROM ", maxsplit=1)[-1]
268+
uninstall = "python -m pip uninstall --yes pip setuptools wheel"
269+
assert uninstall in final_stage
270+
assert final_stage.index("pip check") < final_stage.index(uninstall)
271+
# Q0.2 / S9: scale profile needs the Postgres control-plane driver
272+
# baked in. The wheel installs --no-deps, so the guarantee now lives
273+
# in the lock export the image installs from — pool included (audit P1-1).
274+
lock_text = (PROJECT_ROOT / "requirements-docker.lock").read_text(encoding="utf-8")
275+
assert "psycopg==" in lock_text
276+
assert "psycopg-pool==" in lock_text
277+
assert "boto3==" in lock_text # the cloud extra is in the export too
295278

296279

297280
def test_prod_compose_api_build_reuses_dockerfile_api():

0 commit comments

Comments
 (0)