Files
yovision/docs/04-local-development-and-verification.md
T

91 lines
2.9 KiB
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.
<!-- gitea-wiki-mirror:start -->
generated: true (请先修改 Gitea Wiki,禁止直接编辑本文件)
wiki_page: Local-Development-and-Verification
wiki_url: https://git.ilapage.cn/ila/yovision/wiki/Local-Development-and-Verification.-
wiki_revision: be0864a5bdbe06bd8358f2d013aa7313ab13e73b
synchronized_at: 2026-08-11T10:30:41Z
<!-- gitea-wiki-mirror:end -->
# 本地开发与验证
## 环境要求
| 工具 | 当前用途 | 检查命令 |
|---|---|---|
| Git | 版本和工作区保护 | `git --version` |
| Python 3 | Harness 脚本和测试 | `python --version` |
| Gitea | 工单与 Wiki | 浏览仓库或调用 MCP |
| Gitea PAT | Wiki 写入 | 仅由 MCP 或 `GITEA_TOKEN` 提供,不打印 |
Go、Node、CUDA、PostgreSQL、MediaMTX 的精确要求将在对应项目骨架工单冻结;当前不把旧仓库环境当作新项目事实。
## 第一次运行
1. 检查工作区:
```powershell
git status --short --branch
```
预期:显示 `main` 和本任务创建的引导文件,没有来源不明改动。
2. 检查 Harness:
```powershell
python dev_scripts/check_harness.py --strict
```
预期:输出“DevHarness 检查通过”。
3. 运行 Harness 测试:
```powershell
python -m unittest discover -s tests -v
```
预期:全部测试为 `ok`。
4. 对照 Wiki:
```powershell
python dev_scripts/sync_wiki_docs.py --check
```
预期:全部映射一致。
## 子项目命令状态
| 项目 | 构建 | 测试 | 运行 | 当前状态 |
|---|---|---|---|---|
| Sense | 待骨架工单冻结 | 待冻结 | 待冻结 | 未初始化业务代码 |
| Brain | 待骨架工单冻结 | 待冻结 | 待冻结 | 未初始化业务代码 |
| Bell | 待骨架工单冻结 | 待冻结 | 待冻结 | 未初始化业务代码 |
不得复制旧仓库命令来填空。每个骨架工单必须同时建立 README、可复制命令和最小测试。
## 常用调试方式
- Harness 语法:`python -m compileall -q dev_scripts tests`。
- 单测:`python -m unittest tests.test_harness_docs -v`。
- 查看差异:`git diff --check`、`git diff`。
- 查看 Wiki 配置:只查看 `wiki-docs.json`,不得打印 token。
- 跨项目问题先验证契约,再分别验证生产者和消费者,不直接修改两端猜测修复。
## 测试数据与日志
- 只使用合成或脱敏事件、合成 RTSP 和明确授权的实验室设备。
- 不提交真实视频、客户名称、地址、手机号、摄像头密码或通知凭据。
- 日志必须可按 request/event/alert ID 追踪,但不得记录 Authorization、Cookie 或连接密钥。
## 完成修改前
```powershell
python -m unittest discover -s tests -v
python dev_scripts/check_harness.py --strict
python dev_scripts/sync_wiki_docs.py --check
git diff --check
git status --short
```
业务工单还必须运行其声明的子项目测试;跨契约工单必须运行所有受影响项目的契约测试。未执行部分写入工单。