通过持久来源关联读取最新本地反馈,强制总表有效正确性为否,保留原问答和人工证据。统一列表、详情、指标和两阶段读取的反馈快照,拒绝冲突选择并保留其他字段编辑。已通过完整本地门禁、隔离PG竞态和真实恢复库52条点踩逐条读回、桌面及手机验收;未调用模型或连接源生产库。
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package qaopsquality
|
||||
|
||||
import (
|
||||
"knowledge-governance/internal/dobotaiops"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMasterDownvoteRuleOverridesOnlyCorrectnessWithoutChangingReviewEvidence(t *testing.T) {
|
||||
for _, test := range []struct {
|
||||
name string
|
||||
feedback dobotaiops.RecordFeedback
|
||||
correctness string
|
||||
want string
|
||||
}{
|
||||
{"asker-down-without-counter", dobotaiops.RecordFeedback{AskerValue: "down"}, "correct", "incorrect"},
|
||||
{"someone-else-down", dobotaiops.RecordFeedback{AskerValue: "up", Up: 10, Down: 1}, "pending", "incorrect"},
|
||||
{"no-vote-keeps-pending", dobotaiops.RecordFeedback{}, "pending", "pending"},
|
||||
{"up-is-not-proof-of-correctness", dobotaiops.RecordFeedback{AskerValue: "up", Up: 1}, "incorrect", "incorrect"},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
original := Fields{Coverage: "covered", Correctness: test.correctness, ProductCategory: "MG400", ProblemType: "参数"}
|
||||
review := Review{Revision: 3, Fields: original}
|
||||
v := View{State: "reviewed", Revision: 3, LatestReview: &review, Effective: original}
|
||||
got := ProjectMasterWithEdits(v, map[string]string{}, dobotaiops.CoverageCheck{}, map[string]string{}, test.feedback)
|
||||
if got.Effective.Correctness != test.want || review.Fields != original || got.LatestReview.Fields != original || got.State != "reviewed" || got.Revision != 3 || got.Effective.Coverage != "covered" || got.Effective.ProductCategory != "MG400" {
|
||||
t.Fatalf("feedback rule changed unrelated quality or evidence: %+v", got)
|
||||
}
|
||||
if FeedbackForcesIncorrect(test.feedback) != (got.FeedbackRule == "downvote-is-incorrect-v1") {
|
||||
t.Fatal("feedback provenance missing or invented")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user