Files
meida_backend/Makefile
T
xsl 9c1802130d chore(prep): shared groundwork for batch-3 (admin/golden/cache)
第三批(T12 后台/T13 黄金集/T14 检索缓存)协调提交:
- kb:KbAssetService(登记/审核,tryon_ready 只能随 approved 打开)+ Asset 模型与 repo
- retrieval:list_gaps 缺口看板查询 + invalidate_cache() 钩子(T14 背后实现真缓存)
- 配置:ADMIN_TOKEN(空=后台 404)+ 检索缓存三参数
- pytest golden marker(默认跳过,CI 强制跑)+ Makefile golden + CI 防线 5c
- 测试隔离修复:test_auth_sms 加 autouse 清 sms:* 键夹具(频控计数跨运行
  累积会毒化后续运行——随机 IP 空间仅 254 且部分用例固定 device_id)
2026-08-14 20:57:52 +08:00

83 lines
3.3 KiB
Makefile
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
.PHONY: help install up down logs migrate downgrade revision run worker \
test test-unit test-integration lint fmt typecheck imports secrets check smoke psql redis-cli
COMPOSE := docker compose -f deploy/docker-compose.dev.yml
help: ## 列出所有目标
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
# ── 环境 ────────────────────────────────────────────────────────────────────
install: ## 安装依赖(uv 管理,含开发依赖)
uv sync --extra dev
uv run pre-commit install
up: ## 起 PostgreSQL(pgvector) + Redis
$(COMPOSE) up -d postgres redis
down: ## 停容器(保留数据卷)
$(COMPOSE) down
logs: ## 跟踪容器日志
$(COMPOSE) logs -f --tail=100
psql: ## 连进数据库
$(COMPOSE) exec postgres psql -U meida -d meida
redis-cli: ## 连进 Redis
$(COMPOSE) exec redis redis-cli
# ── 数据库 ──────────────────────────────────────────────────────────────────
migrate: ## 迁移到最新版本
uv run alembic upgrade head
downgrade: ## 回退一个版本
uv run alembic downgrade -1
revision: ## 生成迁移脚本:make revision m="描述"
uv run alembic revision --autogenerate -m "$(m)"
# ── 运行 ────────────────────────────────────────────────────────────────────
run: ## 本地起 API(热重载)
uv run uvicorn apps.api.main:app --reload --host 0.0.0.0 --port 8000
worker: ## 本地起 Celery worker
uv run celery -A apps.worker.celery_app.celery_app worker -Q cpu,io -l INFO
# ── 质量防线(与 CI 一致,见 .github/workflows/ci.yml)─────────────────────
lint: ## ruff 检查 + 格式校验
uv run ruff check .
uv run ruff format --check .
fmt: ## 自动修复与格式化
uv run ruff check --fix .
uv run ruff format .
typecheck: ## mypy(domain 与 llm 为 strict)
uv run mypy packages/domain packages/llm
uv run mypy apps packages/shared packages/identity packages/billing packages/task \
packages/agent packages/compliance packages/analytics packages/storage
imports: ## 分层依赖契约(架构文档 §4.2)
uv run lint-imports
secrets: ## 敏感信息扫描
uv run detect-secrets scan --baseline .secrets.baseline
test: test-unit ## 默认只跑单测(不连库、不发网络请求)
test-unit:
uv run pytest
test-integration: ## 需要 make up && make migrate
MEIDA_RUN_INTEGRATION=1 uv run pytest -m integration
golden: ## 黄金集回归(需要 PG;指标退化即失败,T-P2-11)
MEIDA_RUN_INTEGRATION=1 uv run pytest -m golden --no-cov
check: lint typecheck imports test secrets ## 提交前一把过
# ── 真实链路验证(会花钱)──────────────────────────────────────────────────
smoke: ## 真调 DeepSeek,打印 ob_ai_call 与 bl_ledger
bash scripts/smoke.sh