828c2c5fa0
build / build (push) Successful in 1m6s
使用完整筛选范围的当前有效结论计算覆盖率和正确率,人工优先,失效与对应待确认/未评估/不计入排除;零分母返回null,界面展示原始分子分母和排除构成,前端拒绝不守恒或比例不一致的响应。 验证:make verify退出码0,Go658及前端257通过,91项声明可选集成跳过;隔离PG、三包竞态及合成/真实只读源浏览器验证通过。无新增迁移,不接AI模型,不改绩效,不写源库;本批未推送或部署,8088运行版保持0.1.21。
100 lines
3.2 KiB
Go
100 lines
3.2 KiB
Go
package qaopsquality
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
"knowledge-governance/internal/dobotaiops"
|
|
"time"
|
|
)
|
|
|
|
var ErrInvalid = errors.New("invalid quality request")
|
|
var ErrConflict = errors.New("quality input or review revision changed")
|
|
var ErrUnavailable = errors.New("quality store unavailable")
|
|
var ErrNotFound = errors.New("quality input snapshot not found")
|
|
var ErrSnapshotMissing = errors.New("only quality metadata was observed for this input")
|
|
|
|
type Fields struct {
|
|
Coverage string `json:"coverage"`
|
|
Correctness string `json:"correctness"`
|
|
ProductCategory string `json:"product_category"`
|
|
ProblemType string `json:"problem_type"`
|
|
RootCause string `json:"root_cause"`
|
|
ExclusionReason string `json:"exclusion_reason"`
|
|
}
|
|
type SaveRequest struct {
|
|
InputHash string `json:"input_hash"`
|
|
InputEpoch int64 `json:"input_epoch"`
|
|
BaseRevision int64 `json:"base_revision"`
|
|
Nonce string `json:"nonce"`
|
|
Fields Fields `json:"fields"`
|
|
Reason string `json:"reason"`
|
|
}
|
|
type Review struct {
|
|
Revision int64 `json:"revision"`
|
|
InputEpoch int64 `json:"input_epoch"`
|
|
InputHash string `json:"input_hash"`
|
|
Fields Fields `json:"fields"`
|
|
Reason string `json:"reason"`
|
|
Reviewer string `json:"reviewer"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
type Check struct {
|
|
InputAvailable bool `json:"input_available"`
|
|
ID int64 `json:"id"`
|
|
InputEpoch int64 `json:"input_epoch"`
|
|
InputHash string `json:"input_hash"`
|
|
Result dobotaiops.CoverageCheck `json:"result"`
|
|
Source dobotaiops.SourceCoverage `json:"source"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
type View struct {
|
|
InputHash string `json:"input_hash"`
|
|
InputEpoch int64 `json:"input_epoch"`
|
|
Revision int64 `json:"revision"`
|
|
State string `json:"state"`
|
|
Automatic Check `json:"automatic"`
|
|
LatestReview *Review `json:"latest_review"`
|
|
Effective Fields `json:"effective"`
|
|
}
|
|
type History struct {
|
|
Reviews []Review `json:"reviews"`
|
|
Checks []Check `json:"checks"`
|
|
NextReview int64 `json:"next_review"`
|
|
NextCheck int64 `json:"next_check"`
|
|
}
|
|
type Summary struct {
|
|
Rates Rates `json:"rates"`
|
|
Total int `json:"total"`
|
|
Reviewed int `json:"reviewed"`
|
|
Unreviewed int `json:"unreviewed"`
|
|
Stale int `json:"stale"`
|
|
PendingConfirmation int `json:"pending_confirmation"`
|
|
RuleUncovered int `json:"rule_uncovered"`
|
|
}
|
|
type Receipt struct {
|
|
View View `json:"view"`
|
|
SavedRevision int64 `json:"saved_revision"`
|
|
Replayed bool `json:"replayed"`
|
|
}
|
|
type Evidence struct {
|
|
Result dobotaiops.CoverageCheck
|
|
Hash string
|
|
Payload json.RawMessage
|
|
Record dobotaiops.Record
|
|
}
|
|
|
|
type Snapshot struct {
|
|
InputEpoch int64 `json:"input_epoch"`
|
|
InputHash string `json:"input_hash"`
|
|
Payload json.RawMessage `json:"payload"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type Store struct {
|
|
pool *pgxpool.Pool
|
|
tenant string
|
|
}
|
|
|
|
func NewStore(pool *pgxpool.Pool, tenant string) *Store { return &Store{pool: pool, tenant: tenant} }
|