Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
156 lines (134 loc) · 7.11 KB
/
Copy pathMakefile
File metadata and controls
156 lines (134 loc) · 7.11 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
.PHONY: setup quality quality-ci quality-full pre-pr lint-fix lint typecheck test-fast test-full
.PHONY: test-stack-up test-stack-down test-all test-cov test-entity
.PHONY: test-int test-bdd test-e2e creative-formats-refresh mutation-check-breaker
setup:
uv run python scripts/setup-dev.py
# Recapture the reference format fixture from the pinned creative agent. Run only when
# the pin or the agent's catalog changes; the reviewed fixture diff is the drift gate.
# Brings up the pinned agent if needed (idempotent). See issue #1418.
creative-formats-refresh:
@./scripts/creative-agent-stack.sh up
uv run python scripts/refresh-reference-formats.py --url $$(./scripts/creative-agent-stack.sh url)
quality-ci:
uv run ruff format --check .
uv run ruff check .
uv run ruff check --config ruff-egress.toml --ignore-noqa --no-respect-gitignore src/ scripts/
uv run ruff check --config ruff-boundary.toml --no-respect-gitignore src/ scripts/
uv run ruff check --config ruff-ownership.toml --no-respect-gitignore src/ scripts/
uv run ruff check --config ruff-serialization.toml --no-respect-gitignore src/ scripts/
uv run ruff check --config ruff-environment.toml --no-respect-gitignore src/ scripts/
# Structural rules, for the checks ruff cannot express. TID251 bans imports and
# attributes, which is what makes the egress line above work; a credential header is
# a dict-key string literal, so nothing in ruff or mypy can see it. .ast-grep/rules/
# is scoped by each rule's own `files:`. Runs HERE and not only at the pre-push stage
# the hook declares, because this repo's workflow merges locally and never pushes, so
# a pre-push-only rule never executes at all.
uv run ast-grep scan --config sgconfig.yml
uv run mypy src/ --config-file=mypy.ini
# Layer-2 ratchets. These are declared stages:[pre-push] in .pre-commit-config.yaml, and
# this repo's documented workflow (ephemeral branches merged LOCALLY, `git push` never run)
# means the pre-push stage NEVER FIRES. They therefore ran nowhere, and drift accumulated
# unseen: measured on 2026-09-01, mypy --check-untyped-defs was 15 above its committed
# baseline on origin/main itself. Running them here is what makes `make quality` the gate
# the workflow already assumes it is (salesagent-aemue.13).
uv run python .pre-commit-hooks/check_type_ignore_count.py
uv run python .pre-commit-hooks/check_fixme_citation_count.py
uv run python .pre-commit-hooks/check_mypy_untyped_defs_count.py
uv run python .pre-commit-hooks/check_ruff_complexity_count.py
uv run python .pre-commit-hooks/check_route_conflicts.py
uv run python .pre-commit-hooks/check_migration_completeness.py
uv run python .pre-commit-hooks/check_code_duplication.py
uv run python .pre-commit-hooks/check-gam-auth-support.py
uv run python scripts/hooks/check_response_attribute_access.py $$(find src -name '*.py')
# ALL 38 feature files, bound and unbound, at ZERO -- no --uc filter and no
# baseline. Widened in three steps: UC-002/UC-003 -> the 16 bound files
# (salesagent-3dawm.17) -> everything (salesagent-yz8mo), once the 529
# non-canonical occurrences across 148 invented codes in the 20 unbound files
# were corrected rather than allowlisted. An invented error code is now
# unaddable ANYWHERE, including in a file no test module runs -- which is
# where they were hiding, since an unbound file grades nothing and so never
# failed on them.
uv run python scripts/verify_feature_error_codes.py
uv run python .pre-commit-hooks/check_route_conflicts.py
uv run python .pre-commit-hooks/check_type_ignore_count.py
uv run python .pre-commit-hooks/check_ruff_complexity_count.py
uv run python .pre-commit-hooks/check_mypy_untyped_defs_count.py
uv run python .pre-commit-hooks/check_fixme_citation_count.py
uv run python .pre-commit-hooks/check_admin_raw_session_count.py
uv run python .pre-commit-hooks/check_docs_links.py
uv run python .pre-commit-hooks/check_hardcoded_urls.py $$(find templates static -type f \( -name '*.html' -o -name '*.js' \) 2>/dev/null)
# tests/harness/ is NOT optional here: tox's `unit` env runs
# `pytest tests/unit/ tests/harness/`, so anything under tests/harness/ was
# graded ONLY by a full-suite run and was invisible to the per-change gate.
# That gap is not theoretical -- tests/harness/test_forward_compat_acceptance.py
# went red on 2026-08-13 and stayed red across 47 commits and 4+ days, because
# every per-bead `make quality` ran a path that did not contain it. Keep this
# target's scope identical to tox's unit env.
quality:
$(MAKE) quality-ci
uv run pytest tests/unit/ tests/harness/ -x
quality-full:
$(MAKE) quality
./run_all_tests.sh ci
pre-pr: quality-full
@echo ""
@echo "✅ All CI checks passed — safe to push and create PR"
lint-fix:
uv run ruff format .
uv run ruff check --fix .
lint:
uv run ruff check .
typecheck:
uv run mypy src/ --config-file=mypy.ini
test-fast:
uv run pytest tests/unit/ -x
test-full:
./run_all_tests.sh ci
# ─── tox-based test targets ──────────────────────────────────────
test-stack-up:
@echo "Starting Docker test stack..."
@./scripts/test-stack.sh up
test-stack-down:
@echo "Stopping Docker test stack..."
@./scripts/test-stack.sh down
test-all: test-stack-up
tox -p; rc=$$?; $(MAKE) test-stack-down; exit $$rc
test-cov:
@echo "Opening coverage report..."
@open htmlcov/index.html 2>/dev/null || xdg-open htmlcov/index.html 2>/dev/null || echo "Open htmlcov/index.html in your browser"
# ─── Single-suite convenience targets ──────────────────────────
# Usage:
# make test-int>
# make test-int ARGS="-k test_brand -v"
# make test-bdd ARGS="-k uc004"
# make test-e2e>
test-int:
ifndef TARGET
$(error TARGET is required. Usage: make test-int>
endif
scripts/run-test.sh --db $(TARGET) $(ARGS)
test-bdd:
ifndef TARGET
scripts/run-test.sh --db tests/bdd/ $(ARGS)
else
scripts/run-test.sh --db $(TARGET) $(ARGS)
endif
test-e2e:
ifndef TARGET
$(error TARGET is required. Usage: make test-e2e>
endif
scripts/run-test.sh --stack $(TARGET) $(ARGS)
# ─── Mutation gate (explicitly invoked, never part of a suite) ──
# Proves the e2e_rest circuit-breaker scenario actually grades the DEPLOYED
# server's breaker: deletes circuit_breaker.record_failure() from the server,
# rebuilds its image, and requires the scenario to REDDEN. Deliberately not in
# `quality`, `quality-full` or run_all_tests.sh — it runs the in-network bdd_e2e
# suite twice against two builds. See the script header for why it is a script.
mutation-check-breaker:
scripts/mutation-check-webhook-breaker.sh
# ─── Entity-scoped test runs ────────────────────────────────────
# Usage: make test-entity ENTITY=delivery
# make test-entity ENTITY="creative and unit"
ENTITY ?= ""
test-entity:
uv run pytest tests/unit/ tests/integration/ tests/e2e/ tests/admin/ -m "$(ENTITY)" -x -v
You can’t perform that action at this time.