Files
sub2api-cn-relay-manager/docs/TDD_PLAN.md
phamnazage-jpg 71cbaf5fa6 test(project): achieve ≥70% package coverage across all internal packages
- store/sqlite: 75.4% (repos + db coverage)
- host/sub2api: 80.8% (httptest mock server, pure function tests)
- app: 74.2% (handler error paths, NewActionSet closures)
- pack: 72.4%
- provision: 75.2%
- access: 77.3%
- config: 94.7% (lookup mock tests)

All tests pass: build, vet, race, coverage gates.
2026-05-15 19:26:25 +08:00

42 lines
1.3 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.
# TDD 实施计划MVP
日期2026-05-13
## 设计结论
首版采用:
- `packs/openai-cn-pack/`:真实可校验模型包
- `internal/pack`pack 装载、checksum 校验、provider schema 校验
- `internal/provision`:导入编排服务
- `internal/host/sub2api`:宿主 admin/gateway 适配
- `cmd/cli import-provider`:一键导入入口
## TDD 顺序
1. 先写 `internal/pack/loader_test.go`
- 成功装载 pack
- checksum mismatch 失败
- provider schema 非法失败
2. 再写 `internal/provision/import_service_test.go`
- subscription 模式成功导入
- strict 模式探测失败直接失败
- 参数非法拒绝
3. 再补宿主适配器集成测试
- `CheckGatewayAccess()` 能校验 `/v1/models`
4. 最后补 CLI 测试
- `import-provider` 参数解析
- 输出状态摘要
## 当前 MVP 风险
1. 回滚删除链路尚未接入真实宿主 HTTP 路径,当前仅在服务层保留失败状态,不宣称真实宿主回滚已闭环
2. 现有集成验证基于 `httptest` stub尚未对真实 sub2api 版本做兼容性实测
3. 状态库尚未承接 import batch / managed resources / reconcile runs 持久化
## 完成标准
- `go test ./...` 通过
- CLI 能从真实 pack 读取 provider
- 导入报告明确输出 batch/provider/access 三种状态