.PHONY: install test lint format check ci wiki wiki-check shared-table-gate ENV := PolyGateway # 集成测试触碰共享表 llm_calls 的字面量门(issue #18)。 # 这道门是**烟雾报警器,不是隔离证明**: 它拦不住 f"{schema}.{table}" 拼接、 # 参数化查询,或不带限定名的 DELETE 配上 admin 的默认 search_path。真正的隔离 # 来自两处——沙箱工厂不把管理连接交给用例,以及清理脚本以无权角色运行。 # 留着它是因为字面量回归最常见、也最便宜拦。 shared-table-gate: @if grep -rn --include='*.py' 'public\.llm_calls' tests/; then \ echo ""; \ echo "错误: 集成测试不得触碰共享表(见上面的命中行)。"; \ echo "改用 tests/integration/conftest.py 的 pg_sandbox 工厂;注释里提到它请写「共享表 llm_calls」。"; \ exit 1; \ fi install: conda run -n $(ENV) pip install -e ".[redis,postgres,structured,dev]" test: conda run -n $(ENV) pytest tests/ --cov=src/polygateway --cov-report=term-missing lint: shared-table-gate conda run -n $(ENV) ruff check src/ tests/ --fix conda run -n $(ENV) lint-imports format: conda run -n $(ENV) ruff format src/ tests/ check: shared-table-gate conda run -n $(ENV) ruff format --check src/ tests/ conda run -n $(ENV) ruff check src/ tests/ conda run -n $(ENV) lint-imports ci: check test wiki: conda run -n $(ENV) python3 .claude/tools/research_wiki.py rebuild_index research-wiki/ # 用户文档站(Gitea Wiki)与源码的机械对齐校验。wiki 是独立仓库,须显式给路径: # make wiki-check WIKI=~/PolyGateway.wiki # 不并入 ci: 仓库里没有 wiki,自动跳过等于静默降级(违 P5),宁可让人显式跑。 wiki-check: @test -n "$(WIKI)" || (echo "用法: make wiki-check WIKI=" && exit 1) conda run -n $(ENV) python3 tools/check_wiki_alignment.py --wiki $(WIKI)