Files
knowledge-governance/internal/qaopsquality/master_feedback_test.go
T
姚章浩 09b2c1dce5
build / build (push) Successful in 1m17s
fix(qa): 表头筛选并统一未覆盖正确性待确认
修正筛选入口位置:五项条件在表头就地选择,保持完整集筛选与无感续载。
统一固定规则:未覆盖一律待确认,原问答/人工模型证据不改写,已覆盖仍保留点踩优先。
验证:行为红绿、前端/Go全套及隔离PostgreSQL全mirror竞态通过;完整本地门禁与原生备份真实恢复通过。
2026-10-25 13:58:08 +08:00

34 lines
1.6 KiB
Go

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"},
{"covered-no-vote-cannot-keep-pending", dobotaiops.RecordFeedback{}, "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")
}
})
}
}