srr84/agent-data-layer
0
1# Makefile — the operator/developer entry points (TechSpec §8 / docs/09 §4).2#3# `make demo` IS the 90-second master-observable demo (docs/09 §4 item 3) on the LOCAL $0 path4# (RUN_MODE=demo_local, app as a plain local process reaching host Ollama at localhost:11434). The5# other targets wrap the gates/guards/CI tools so they are runnable identically locally and in CI.6#7# Toolchain via the venv at the MAIN checkout (.venv is symlinked here). DATASET_VERSION is required8# by Settings (no default), so the targets export the bundled artifact's version.9#10# $0 / INV-C6: the demo + tests + guards use stdlib + the pinned runtime deps only. The CI-only tools11# (bandit/pip-audit/cyclonedx-py/pip-tools) are installed on demand by the `sbom`/`lockfile` targets12# and the CI job — never a runtime dependency.13 14PY := .venv/bin/python15MYPY := .venv/bin/mypy16PYTEST := .venv/bin/pytest17DATASET_VERSION ?= v1.0.018PORT ?= 786019 20export DATASET_VERSION21export PYTHONPATH := src22 23.PHONY: demo serve test typecheck guards smoke sbom lockfile docker-build compose-up compose-down help24 25help:26 @echo "Targets: demo serve test typecheck guards smoke sbom lockfile docker-build compose-up compose-down"27 28# The 90-second master observable a/b/c/d/e end-to-end on the LOCAL $0 path. Precondition (R-B-8):29# host Ollama up with the model pulled (ollama pull qwen2.5:7b-instruct). App as a plain local30# process reaching host Ollama at localhost:11434 (TechSpec §8 DEFAULT demo).31demo:32 RUN_MODE=demo_local MODEL_BASE_URL=http://localhost:11434/v1 $(PY) scripts/run_demo.py33 34# Run the deployable HTTP server (the operational surfaces) as a local process on $(PORT).35serve:36 APP_PORT=$(PORT) $(PY) -m agent_data_layer.app.server37 38# Full pytest suite (unit + integration + the gate suites). Ollama up => GATE-a/GATE-e run live.39test:40 $(PYTEST) -q41 42# Type gate: mypy --strict over src/ + tests/ (the configured files set). DoD gate.43typecheck:44 $(MYPY) --strict45 46# The 3 AEP §6 guards (each must exit 0): no-stub-reachable + INV-C1 dataflow + D-AI-2 taint.47guards:48 $(PY) scripts/check_no_stub_reachable.py49 $(PY) scripts/check_inv_c1_dataflow.py50 $(PY) scripts/check_d_ai2_taint.py51 52# Post-deploy smoke test: /healthz 200 + store loaded (--skip-answer if no model reachable).53# Set BASE_URL to target a deployed env; defaults to the local server.54smoke:55 $(PY) scripts/smoke_deploy.py --base-url $(if $(BASE_URL),$(BASE_URL),http://127.0.0.1:$(PORT))56 57# Emit a CycloneDX SBOM from the hash-pinned lockfile (CI-only tool, installed on demand).58sbom:59 $(PY) -m pip install --quiet cyclonedx-bom60 $(PY) -m cyclonedx_py requirements requirements.lock -o sbom.cyclonedx.json61 @echo "wrote sbom.cyclonedx.json"62 63# Regenerate the hash-pinned runtime lockfile from requirements.txt (pip-tools, CI/dev-only tool).64lockfile:65 $(PY) -m pip install --quiet pip-tools66 $(PY) -m piptools compile --generate-hashes --no-header --output-file=requirements.lock requirements.txt67 68# Build the deployable image (requires a running docker daemon — not available in every env).69docker-build:70 docker build --build-arg DATASET_VERSION=$(DATASET_VERSION) -t agent-data-layer:local .71 72# Local CONTAINERIZED demo (TechSpec §8 ALTERNATIVE): the app container + host Ollama outside it.73compose-up:74 docker compose up --build75 76compose-down:77 docker compose down78 