test(quality): promote sqlite coverage to core gate

This commit is contained in:
phamnazage-jpg
2026-05-30 17:04:45 +08:00
parent b371c698cc
commit 249ad5938f
2 changed files with 59 additions and 1 deletions

View File

@@ -2020,3 +2020,61 @@
- 下一批候选可继续看: - 下一批候选可继续看:
- `internal/store/sqlite` - `internal/store/sqlite`
- `internal/overlay` - `internal/overlay`
## 2026-05-30 已将 internal/store/sqlite 从 watch 提升为 core
**目标**:把 SQLite repo 层从“高覆盖观察项”提升为“硬门槛”,因为这层已经承载:
- `logical_group / route`
- `route logs / sticky audit / failover events`
- `provider_accounts`
- `provider_drafts / import_batches / reconcile_runs`
它已经是控制面和运行态的共同底座,回归代价过高,不适合继续只做告警
**评估结果**
- `go test -coverprofile=/tmp/internal-store-sqlite.cover ./internal/store/sqlite` => `coverage: 76.1% of statements`
- 现有测试面已覆盖:
- `db` 打开、迁移、外键、ledger、legacy backfill
- `logical_groups / routes / route_models`
- `provider_accounts` 与 inventory sync
- `route_decision_logs / route_failover_events / route_sticky_audit`
- `providers / packs / hosts / import_batches / import_runs`
- 当前低覆盖点主要集中在:
- `provider_accounts_sync.go`
- `SyncProviderAccountsFromLatestImportBatches`
- 个别 `Upsert / Update / normalize` 分支
- `hosts_repo.go` 中很窄的 error helper
- 这些缺口已记录,但不阻碍把该包提升为 `core`,因为包级覆盖率显著高于阈值,且高杠杆 repo 主路径已有系统测试
**本次调整**
- `tests/quality/coverage_thresholds.tsv`
- `internal/store/sqlite`
- tier`watch -> core`
- threshold`75.0` 保持不变
**验证结果**
- `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`
- 统一门禁回读:
- `internal/store/sqlite = 76.1%`
- 高于新的 `core` 门槛 `75.0%`
**结论**
- `internal/store/sqlite` 已完成第三批 `watch -> core` 升级
- 当前 `core` 包集合变为:
- `internal/access`
- `internal/pack`
- `internal/provision`
- `internal/app`
- `internal/routing`
- `internal/store/sqlite`
- 剩余 `watch` 候选只剩:
- `internal/overlay`

View File

@@ -5,4 +5,4 @@ internal/provision core 70.0 provider import orchestration
internal/app core 70.0 HTTP control plane is now above 70 and must stay as a hard gate internal/app core 70.0 HTTP control plane is now above 70 and must stay as a hard gate
internal/overlay watch 70.0 utility package should stay above a healthy baseline internal/overlay watch 70.0 utility package should stay above a healthy baseline
internal/routing core 70.0 route resolve and sticky runtime are product-critical and must stay above the hard gate internal/routing core 70.0 route resolve and sticky runtime are product-critical and must stay above the hard gate
internal/store/sqlite watch 75.0 sqlite repo layer is high leverage and should stay well-covered internal/store/sqlite core 75.0 sqlite repo layer is high leverage and must stay as a hard gate
1 # package tier min_coverage note
5 internal/app core 70.0 HTTP control plane is now above 70 and must stay as a hard gate
6 internal/overlay watch 70.0 utility package should stay above a healthy baseline
7 internal/routing core 70.0 route resolve and sticky runtime are product-critical and must stay above the hard gate
8 internal/store/sqlite watch core 75.0 sqlite repo layer is high leverage and should stay well-covered sqlite repo layer is high leverage and must stay as a hard gate