2c0bb32183
build / build (push) Successful in 1m11s
通过持久来源关联读取最新本地反馈,强制总表有效正确性为否,保留原问答和人工证据。统一列表、详情、指标和两阶段读取的反馈快照,拒绝冲突选择并保留其他字段编辑。已通过完整本地门禁、隔离PG竞态和真实恢复库52条点踩逐条读回、桌面及手机验收;未调用模型或连接源生产库。
70 lines
2.5 KiB
Go
70 lines
2.5 KiB
Go
package qaopsquality
|
|
|
|
import "knowledge-governance/internal/dobotaiops"
|
|
|
|
func FeedbackForcesIncorrect(feedback dobotaiops.RecordFeedback) bool {
|
|
return feedback.Down > 0 || feedback.AskerValue == "down"
|
|
}
|
|
|
|
func ProjectMasterWithEdits(v View, stored map[string]string, derived dobotaiops.CoverageCheck, edits map[string]string, feedback ...dobotaiops.RecordFeedback) View {
|
|
v = ProjectMaster(v, stored, derived)
|
|
v.FeedbackRule = ""
|
|
v.MasterFeedback = nil
|
|
if len(feedback) > 0 {
|
|
current := feedback[0]
|
|
v.MasterFeedback = ¤t
|
|
}
|
|
if value, ok := edits["coverage"]; ok {
|
|
v.Effective.Coverage = map[string]string{"是": "covered", "否": "uncovered", "否但不计入": "excluded"}[value]
|
|
v.Effective.ExclusionReason = ""
|
|
if value == "否但不计入" {
|
|
v.Effective.ExclusionReason = "详情字段选择:否但不计入"
|
|
}
|
|
}
|
|
if value, ok := edits["is_correct"]; ok {
|
|
v.Effective.Correctness = map[string]string{"是": "correct", "否": "incorrect", "待确认": "pending"}[value]
|
|
}
|
|
if value, ok := edits["product_category"]; ok {
|
|
v.Effective.ProductCategory = value
|
|
}
|
|
if value, ok := edits["problem_type"]; ok {
|
|
v.Effective.ProblemType = value
|
|
}
|
|
if value, ok := edits["root_cause"]; ok {
|
|
v.Effective.RootCause = value
|
|
}
|
|
if len(feedback) > 0 && FeedbackForcesIncorrect(feedback[0]) {
|
|
v.Effective.Correctness = "incorrect"
|
|
v.FeedbackRule = "downvote-is-incorrect-v1"
|
|
}
|
|
if v.Effective.Correctness == "correct" {
|
|
v.Effective.RootCause = ""
|
|
}
|
|
return v
|
|
}
|
|
|
|
// Stored master labels remain their original provenance, not synthetic reviews.
|
|
func ProjectMaster(v View, stored map[string]string, derived dobotaiops.CoverageCheck) View {
|
|
v.EffectiveSource = "master-effective-fields-v1"
|
|
if v.State != "reviewed" {
|
|
v.Effective.Coverage = map[string]string{"是": "covered", "否": "uncovered", "部分覆盖": "partial", "待确认": "pending"}[stored["coverage"]]
|
|
if v.Effective.Coverage == "" {
|
|
v.Effective.Coverage = derived.Verdict
|
|
}
|
|
v.Effective.Correctness = map[string]string{"是": "correct", "否": "incorrect", "待确认": "pending"}[stored["is_correct"]]
|
|
}
|
|
if v.Effective.ProductCategory == "" {
|
|
v.Effective.ProductCategory = stored["product_category"]
|
|
}
|
|
if v.Effective.ProblemType == "" {
|
|
v.Effective.ProblemType = stored["problem_type"]
|
|
}
|
|
if v.Effective.RootCause == "" && v.Effective.Correctness != "correct" {
|
|
v.Effective.RootCause = stored["root_cause"]
|
|
}
|
|
if v.Effective.Correctness == "correct" {
|
|
v.Effective.RootCause = ""
|
|
}
|
|
return v
|
|
}
|