-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
139 lines (107 loc) · 4.47 KB
/
Copy pathMakefile
File metadata and controls
139 lines (107 loc) · 4.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# TheraPy dev tasks. Run `make` (or `make help`) to list targets.
#
# Source (incl. the PWA static assets), tests, and scripts are bind-mounted into
# the container, so UI/code/test/script edits are live — no image rebuild needed
# except when dependencies change (then `make rebuild`).
#
# UI edit (JS/CSS/HTML) → just reload the browser
# Python edit → `make restart`
# Test edit → `make test` / `make test-e2e` (pytest reads it directly)
#
# Tests live under tests/suites/{unit,integration,e2e} and are auto-marked by
# folder. Select any subset with ARGS, e.g.:
# make test ARGS="-k memory -x" make test-e2e ARGS="-k hold" make test-unit
COMPOSE := docker compose
SVC := therapy
EXEC := $(COMPOSE) exec -T $(SVC)
RUN := $(EXEC) uv run
VENV := .venv/bin
ARGS ?=
# Coverage floor for `make coverage` / `make check`; ratchet upward as gaps close.
COV_MIN ?= 85
.DEFAULT_GOAL := help
.PHONY: help
help: ## List available targets
@grep -hE '^[a-zA-Z0-9_-]+:.*?## ' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN{FS=":.*?## "}{printf " \033[36m%-30s\033[0m %s\n", $$1, $$2}'
# ---- Container lifecycle ----------------------------------------------------
.PHONY: up
up: ## Build if needed + (re)start the stack in the background
$(COMPOSE) up -d --build $(SVC)
.PHONY: rebuild
rebuild: ## Force a clean image rebuild (use when dependencies change)
$(COMPOSE) build --no-cache $(SVC)
$(COMPOSE) up -d $(SVC)
.PHONY: restart
restart: ## Restart the server to pick up Python edits (no rebuild)
$(COMPOSE) restart $(SVC)
.PHONY: down
down: ## Stop the stack
$(COMPOSE) down
.PHONY: status
status: ## Show container status + health
$(COMPOSE) ps
.PHONY: logs
logs: ## Follow the server logs
$(COMPOSE) logs -f $(SVC)
.PHONY: shell
shell: ## Open an interactive shell in the running container
$(COMPOSE) exec $(SVC) bash
# ---- Tests & quality --------------------------------------------------------
# ARGS passes extra pytest flags: `make test ARGS="-k memory"`, `make test-e2e ARGS="-k hold"`.
.PHONY: test
test: ## Unit + integration in the container (the real test bed)
$(RUN) pytest $(ARGS)
.PHONY: test-unit unit
test-unit: ## Just the unit suite
$(RUN) pytest -m unit $(ARGS)
unit: test-unit
.PHONY: test-integration integration
test-integration: ## Just the integration suite
$(RUN) pytest -m integration $(ARGS)
integration: test-integration
.PHONY: test-e2e e2e
test-e2e: ## ALL browser e2e (auto-installs Chromium if missing)
$(RUN) playwright install --with-deps chromium firefox >/dev/null # WebKit deps are unavailable in the pinned image.
$(RUN) pytest -m e2e $(ARGS)
e2e: test-e2e
.PHONY: test-fast
test-fast: ## Quick framework-free run on the host slim venv
$(VENV)/python -m pytest $(ARGS)
.PHONY: lint
lint: ## Ruff lint (host)
$(VENV)/ruff check .
.PHONY: typecheck
typecheck: ## Pyright in the Linux container (the supported runtime)
$(RUN) pyright --warnings
.PHONY: verify-longitudinal-loop
verify-longitudinal-loop: ## Verify longitudinal self-knowledge loop (host, isolated data)
$(VENV)/python scripts/verify_longitudinal_loop.py
.PHONY: coverage
coverage: ## Full in-container suite + coverage report + COV_MIN fail-under gate
$(RUN) pytest --cov=therapy --cov-report=term-missing \
--cov-report=xml --cov-fail-under=$(COV_MIN) -p no:cacheprovider $(ARGS)
.PHONY: check
check: lint typecheck coverage ## Pre-push gate: lint + strict types + suite w/ coverage floor
.PHONY: hooks
hooks: ## Install the repo git hooks (.githooks) into this clone
git config core.hooksPath .githooks
chmod +x .githooks/*
@echo "Installed: core.hooksPath=.githooks (bypass any hook with --no-verify)."
# --- observability gate tooling (obs plan §11) -------------------------------
.PHONY: obs-canary-scan
obs-canary-scan: ## Routing/secret canary gate over the fixture corpus
$(VENV)/python scripts/observability/canary_scan.py fixtures
.PHONY: obs-fixture-hash
obs-fixture-hash: ## Reproducible identity of the observability fixture corpus
$(VENV)/python scripts/observability/fixture_hash.py
.PHONY: obs-baseline
obs-baseline: ## Telemetry-off/on workload baseline against a running instance
$(VENV)/python scripts/observability/baseline.py --label off
.PHONY: obs-dashboards
obs-dashboards: ## Regenerate the six Grafana dashboards deterministically
$(VENV)/python scripts/observability/gen_dashboards.py
.PHONY: obs-fixtures
obs-fixtures: ## Regenerate golden interaction fixtures + canaries
$(VENV)/python scripts/observability/gen_interaction_fixtures.py