fix(qaops): 点踩问题统一判为不正确
build / build (push) Successful in 1m11s

通过持久来源关联读取最新本地反馈,强制总表有效正确性为否,保留原问答和人工证据。统一列表、详情、指标和两阶段读取的反馈快照,拒绝冲突选择并保留其他字段编辑。已通过完整本地门禁、隔离PG竞态和真实恢复库52条点踩逐条读回、桌面及手机验收;未调用模型或连接源生产库。
This commit is contained in:
姚章浩
2026-10-20 08:18:03 +08:00
parent 87f97a2f9b
commit 2c0bb32183
22 changed files with 403 additions and 35 deletions
+19 -2
View File
@@ -68,9 +68,26 @@ func enrichQAQualityRecord(ctx context.Context, c Config, item *dobotaiops.Recor
if !ok {
return qaopsquality.ErrUnavailable
}
item.Quality, err = json.Marshal(v)
return attachQAQualityView(item, v)
}
func attachQAQualityView(item *dobotaiops.Record, view qaopsquality.View) error {
// A vote may change between the payload and quality reads; return the vote
// that actually produced this decision, not a contradictory older snapshot.
if view.MasterFeedback != nil && item.RecordOrigin != "" {
item.Feedback = *view.MasterFeedback
fields := make(map[string]string, len(item.MasterFields)+1)
for key, value := range item.MasterFields {
fields[key] = value
}
fields["is_correct"] = map[string]string{"correct": "是", "incorrect": "否", "pending": "待确认"}[view.Effective.Correctness]
item.MasterFields = fields
}
raw, err := json.Marshal(view)
item.Quality = raw
return err
}
func enrichQAQualityPage(ctx context.Context, c Config, page *dobotaiops.RecordPage) error {
if c.QAQuality == nil {
return nil
@@ -84,7 +101,7 @@ func enrichQAQualityPage(ctx context.Context, c Config, page *dobotaiops.RecordP
if !ok {
return qaopsquality.ErrUnavailable
}
page.Items[i].Quality, err = json.Marshal(v)
err = attachQAQualityView(&page.Items[i], v)
if err != nil {
return err
}