package qaopsquality import "knowledge-governance/internal/dobotaiops" func ProjectMasterWithEdits(v View, stored map[string]string, derived dobotaiops.CoverageCheck, edits map[string]string) View { v = ProjectMaster(v, stored, derived) 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 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 }