Files
Neo-ZQYY/.kiro/steering/testing-env.md

20 lines
941 B
Markdown
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.
---
inclusion: always
---
# 测试与验证环境规范(强制)
AI 执行测试/验证/调试/一次性脚本时,必须使用与正式运行一致的参数环境。
## 规则
1. 必须 `load_dotenv` 加载根 `.env`;必需变量(`FETCH_ROOT``EXPORT_ROOT``PG_DSN` 等)缺失时立即报错,禁止静默回退空字符串
2. cwd 与正式一致ETL → `apps/etl/connectors/feiqiu/`;后端 → `apps/backend/`
3. 配置走 `AppConfig.load()` 正常流程,不得为测试单独构造简化配置
4. 数据库使用测试库:`test_etl_feiqiu` / `test_zqyy_app``TEST_DB_DSN`),禁止连正式库
## 例外
- 用户明确指定简化环境
- 纯单元测试用 FakeDB/FakeAPI不涉及真实路径/连接)
- `--dry-run` CLI 验证(路径配置仍需完整)
> 背景:曾因 `FETCH_ROOT` 未加载,`or` 链回退空字符串,时区值 `Asia/Shanghai` 被误用为路径,创建了垃圾目录。