docs(testing): record repo upsert closure
This commit is contained in:
@@ -2339,3 +2339,53 @@
|
||||
- 现在真正剩下的窄点已经进一步收缩为:
|
||||
- `PacksRepo.Upsert` 的剩余更新分支
|
||||
- `ProvidersRepo.Upsert` 的剩余更新分支
|
||||
|
||||
## 2026-05-30 已完成 ProvidersRepo / PacksRepo Upsert 的最后一轮定点补测
|
||||
|
||||
**目标**:把上一轮剩下的最后两个窄点收口,直接命中 `ProvidersRepo.Upsert` 与 `PacksRepo.Upsert` 的回退/错误分支,而不是继续增加普通 happy path
|
||||
|
||||
**本次新增测试点**:
|
||||
|
||||
- `ProvidersRepo.Upsert`
|
||||
- `ExecContext` 返回错误
|
||||
- `LastInsertId` 不可用时回退到 `GetByPackIDAndProviderID`
|
||||
- 回退读取失败时返回 `sql.ErrNoRows`
|
||||
- `PacksRepo.Upsert`
|
||||
- `ExecContext` 返回错误
|
||||
- `LastInsertId` 不可用时回退到 `GetByPackID`
|
||||
- 回退读取失败时返回 `sql.ErrNoRows`
|
||||
|
||||
**实现方式**:
|
||||
|
||||
- 新增测试内 `execQuerierStub`
|
||||
- 新增测试内 `resultStub`
|
||||
- 通过包装真实 SQLite `QueryRowContext`,只替换 `ExecContext / LastInsertId` 行为
|
||||
- 这样能稳定命中 repo 自身的 fallback 分支,而不需要改生产代码
|
||||
|
||||
**验证结果**:
|
||||
|
||||
- 定向测试:
|
||||
- `go test ./internal/store/sqlite -count=1` => `ok`
|
||||
- 定向覆盖率:
|
||||
- `go test -coverprofile=/tmp/sqlite-final-upsert.cover ./internal/store/sqlite` => `78.1%`
|
||||
- 热点函数回读:
|
||||
- `ProvidersRepo.Upsert = 96.0%`
|
||||
- `PacksRepo.Upsert = 95.5%`
|
||||
- 全量门禁:
|
||||
- `gofmt -l .` => clean
|
||||
- `go vet ./...` => `ok`
|
||||
- `go test -cover ./internal/...` => `ok`
|
||||
- `go test ./tests/integration/... -count=1` => `ok`
|
||||
- `bash ./scripts/test/verify_quality_gates.sh` => `PASS`
|
||||
- 真实门禁已在 unrestricted 环境确认
|
||||
|
||||
**覆盖率变化**:
|
||||
|
||||
- `internal/store/sqlite`
|
||||
- 本轮前:`77.5%`
|
||||
- 本轮后:`78.1%`
|
||||
|
||||
**结论**:
|
||||
|
||||
- `ProvidersRepo.Upsert / PacksRepo.Upsert` 已不再是这轮质量治理的主要薄点
|
||||
- 这一波按执行板列出的热点定点补测,到这里已经基本收口
|
||||
|
||||
Reference in New Issue
Block a user