File size: 10,715 Bytes
b2e19c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
.PHONY: help dev test test-smoke lint docker-up docker-down consortium-up consortium-down consortium-test migrate clean benchmark benchmark-all reproduce-all reproduce-verify benchmark-matrix benchmark-verify benchmark-factorial benchmark-download benchmark-fraud benchmark-fl benchmark-fl-paysim benchmark-fl-ieeecis benchmark-fl-creditcard benchmark-graphsage benchmark-amlsim benchmark-synthaml benchmark-amlnet benchmark-crossbank benchmark-dp benchmark-byzantine benchmark-graph benchmark-latency generate-charts benchmark-security experiment-all experiment-clean

SHELL := /bin/bash

help: ## Show this help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

# ──────────────────────────────────────────────
# Development
# ──────────────────────────────────────────────

dev: ## Start all services in development mode
	docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build

dev-backend: ## Start backend services only
	docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build backend postgres redis

dev-frontend: ## Start frontend dev server only
	cd frontend && npm run dev

# ──────────────────────────────────────────────
# Docker
# ──────────────────────────────────────────────

docker-up: ## Start all services (production mode)
	docker compose up --build -d

docker-down: ## Stop all services
	docker compose down

docker-logs: ## Tail logs from all services
	docker compose logs -f

docker-clean: ## Remove all containers, volumes, and images
	docker compose down -v --rmi all

consortium-up: ## Start 10-service multi-bank consortium deployment
	docker compose -f docker-compose.consortium.yml up -d

consortium-down: ## Stop 10-service multi-bank consortium deployment
	docker compose -f docker-compose.consortium.yml down

consortium-test: ## Run multi-bank consortium deployment integration tests
	pytest backend/tests/integration/test_consortium_multi_bank_deployment.py -v

kafka-up: ## Start Kafka and Redis streaming services
	docker compose up -d kafka redis

kafka-topics: ## List Kafka event topics
	docker compose exec kafka /opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list

# ──────────────────────────────────────────────
# Backend
# ──────────────────────────────────────────────

test: ## Run backend tests
	cd backend && python -m pytest tests/ -v --cov=app --cov-report=term-missing

test-smoke: ## Run deterministic CI smoke gates (dataloaders, model serialization, schemas)
	pytest backend/tests/unit/test_ci_smoke_gates.py -v

test-unit: ## Run unit tests only
	cd backend && python -m pytest tests/unit/ -v

test-integration: ## Run integration tests only
	cd backend && python -m pytest tests/integration/ -v

test-core-banking: ## Run Cloud Core Banking gateway tests (Mambu & Thought Machine)
	cd backend && python -m pytest tests/unit/test_core_banking_gateway.py -v

test-hsm: ## Run Hardware Security Module (HSM) PKCS#11 & Vault Transit tests
	cd backend && python -m pytest tests/unit/test_hsm_key_service.py -v

test-iso20022: ## Run Extended ISO 20022 Financial Rails tests (camt.053, pacs.002, pacs.003)
	cd backend && python -m pytest tests/unit/test_extended_iso20022_parser.py tests/unit/test_financial_message_parser_hardening.py -v

test-regulatory-dossier: ## Run EU AI Act & SR 11-7 Regulatory Dossier generator tests
	cd backend && python -m pytest tests/unit/test_regulatory_dossier_generator.py -v

test-poc-simulator: ## Run Interactive POC Sandbox Replay & Multi-Bank Simulator tests
	cd backend && python -m pytest tests/unit/test_multi_bank_simulator.py -v

lint: ## Run linters (matching CI pipeline)
	cd backend && ruff check app/ tests/
	cd backend && mypy app/ --ignore-missing-imports

lint-fix: ## Auto-fix lint issues
	cd backend && ruff check --fix app/ tests/

format: ## Format backend code with ruff
	cd backend && ruff format app/ tests/

format-check: ## Check formatting with ruff
	cd backend && ruff format --check app/ tests/


# ──────────────────────────────────────────────
# Frontend
# ──────────────────────────────────────────────

frontend-install: ## Install frontend dependencies
	cd frontend && npm install

frontend-lint: ## Lint frontend code
	cd frontend && npm run lint

frontend-test: ## Run frontend test suite (Vitest)
	cd frontend && npm test

frontend-responsive-test: ## Run multi-device Playwright responsive tests
	cd frontend && npm run test:responsive

frontend-visual-test: ## Run Playwright visual regression tests
	cd frontend && npm run test:visual

frontend-visual-update: ## Update Playwright baseline snapshots
	cd frontend && npm run test:visual:update

frontend-build: ## Build frontend for production
	cd frontend && npm run build

frontend-typecheck: ## Run TypeScript type checking
	cd frontend && npx tsc --noEmit

test-all: ## Run all backend, frontend, visual, and verification test suites
	python scripts/run_all_tests.py --all


# ──────────────────────────────────────────────
# Database
# ──────────────────────────────────────────────

migrate: ## Run database migrations
	cd backend && alembic upgrade head

migrate-create: ## Create a new migration (usage: make migrate-create MSG="add users table")
	cd backend && alembic revision --autogenerate -m "$(MSG)"

migrate-rollback: ## Rollback last migration
	cd backend && alembic downgrade -1

# ──────────────────────────────────────────────
# Benchmarks & Reproducibility Suite
# ──────────────────────────────────────────────

reproduce-all: ## Master one-line command to verify reproducibility, run tests, and validate master matrix
	python scripts/run_all_tests.py
	python -m experiments.harness.compile_reports --verify
	python benchmarks/generate_master_benchmark_matrix.py --verify
	python scripts/verify_reproducibility.py --all

reproduce-verify: ## Master 38-item platform reproducibility and integrity verification sweep
	python scripts/verify_reproducibility.py --all

benchmark-all: benchmark-fraud benchmark-fl benchmark-dp benchmark-byzantine benchmark-graph benchmark-crossbank benchmark-latency benchmark-factorial benchmark-matrix generate-charts ## Run complete reproducible benchmark suite

benchmark: benchmark-all ## Alias for benchmark-all

benchmark-matrix: ## Generate and verify the master empirical comparative benchmark matrix
	python benchmarks/generate_master_benchmark_matrix.py --verify

benchmark-verify: ## Audit standardized 5-artifact hierarchy across all 8 canonical benchmark datasets
	python -m experiments.harness.compile_reports --verify

benchmark-factorial: ## Run 16-configuration architectural component factorial ablation sweep
	python benchmarks/runners/run_factorial_ablation.py

benchmark-download: ## Download and verify real benchmark datasets via CLI
	python scripts/download_real_benchmarks.py --all

benchmark-fraud: ## Run PaySim & IEEE-CIS fraud detection benchmarks
	python benchmarks/runners/run_fraud_benchmark.py --dataset paysim --synthetic-eval
	python benchmarks/runners/run_fraud_benchmark.py --dataset ieee_cis --synthetic-eval

benchmark-fl: ## Run Federated Learning (FedAvg, FedProx, SCAFFOLD) benchmark
	python benchmarks/runners/run_fl_benchmark.py --rounds 10 --alpha 0.5

benchmark-dp: ## Run Differential Privacy privacy-utility tradeoff sweep
	python benchmarks/runners/run_dp_tradeoff.py

benchmark-byzantine: ## Run Byzantine resilience benchmark under model poisoning
	python benchmarks/runners/run_byzantine_benchmark.py

benchmark-graph: ## Run GraphSAGE inductive graph intelligence benchmark
	python benchmarks/runners/run_graph_benchmark.py

benchmark-crossbank: ## Run CFI-CrossBank-01 flagship consortium cross-bank research benchmark
	python experiments/cross_bank/run_flagship_experiment.py

benchmark-latency: ## Run Inference Gateway concurrency and latency harness
	python benchmarks/runners/run_latency_benchmark.py --mock-load

generate-charts: ## Generate publication-grade figures from raw benchmark JSONs
	python scripts/generate_charts.py

benchmark-security: ## Run comprehensive security regression test suite
	python -m pytest backend/tests/unit/test_perimeter_waf.py backend/tests/unit/test_multi_tenancy.py -v

# ──────────────────────────────────────────────
# Unified Experiment Harness Suite
# ──────────────────────────────────────────────

experiment-all: ## Run unified experiment harness across multiple seeds and compile dossiers
	python -m experiments.harness.runner --name ProductionFraudMLP --rounds 5 --seeds 42 123 456
	python scripts/generate_charts.py --include-experiments

experiment-clean: ## Clean generated experiment runs and temporary traces
	rm -rf experiments/results/*/.tmp* experiments/results/*/*.tmp

# ──────────────────────────────────────────────
# Utilities
# ──────────────────────────────────────────────

clean: ## Remove build artifacts and caches
	find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name .mypy_cache -exec rm -rf {} + 2>/dev/null || true
	find . -type d -name htmlcov -exec rm -rf {} + 2>/dev/null || true
	find . -name "*.pyc" -delete 2>/dev/null || true