65653e5c01
build / build (push) Successful in 1m14s
已覆盖只允许正确或错误,未覆盖可待确认,缺引用不再阻止正确结论。 复用统一事务写入与不可变审计重评旧待确认,保留原问答和人工结论。 验证:全仓 make verify、真实隔离 PostgreSQL 全包与 race 回归通过。
46 lines
2.2 KiB
Go
46 lines
2.2 KiB
Go
package qaopsai
|
|
|
|
import (
|
|
"knowledge-governance/internal/dobotaiops"
|
|
"knowledge-governance/internal/qaopsquality"
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func TestManualHistoricalAssessmentUsesRealGapsButAutomaticAdmissionRemainsSeparate(t *testing.T) {
|
|
m := recordMeta{Status: "historical_import", Question: "MG400 怎么连接?", Fields: map[string]string{"product_category": "MG400"}, Coverage: dobotaiops.CheckMasterCoverage("已有历史答案", true), View: qaopsquality.View{}}
|
|
got := needs(m, "evaluation")
|
|
want := []string{"is_correct", "problem_type", "root_cause"}
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("manual imported question gaps=%v want=%v", got, want)
|
|
}
|
|
for _, status := range []string{"running", "failed", "cancelled"} {
|
|
m.Status = status
|
|
if len(needs(m, "evaluation")) != 0 {
|
|
t.Fatalf("incomplete source status %s was admitted", status)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestCoveredPendingIsReassessedWithoutTouchingOtherNonemptyFields(t *testing.T) {
|
|
m := recordMeta{Status: "historical_import", Question: "示例问题", Fields: map[string]string{"is_correct": "待确认", "product_category": "MG400", "problem_type": "故障", "root_cause": "结果不清"}, Coverage: dobotaiops.CheckMasterCoverage("完整实际回答", true), View: qaopsquality.View{Effective: qaopsquality.Fields{Coverage: "covered", Correctness: "pending", ProductCategory: "MG400", ProblemType: "故障", RootCause: "结果不清"}}}
|
|
if got := needs(m, "evaluation"); !reflect.DeepEqual(got, []string{"is_correct"}) {
|
|
t.Fatalf("obsolete pending not isolated for rejudgment: %v", got)
|
|
}
|
|
m.View.Effective.Coverage = "uncovered"
|
|
if len(needs(m, "evaluation")) != 0 {
|
|
t.Fatal("uncovered pending was unnecessarily reassessed")
|
|
}
|
|
}
|
|
|
|
func TestSupersededEvaluationPromptIsNotExecuted(t *testing.T) {
|
|
for _, version := range []string{"qa-evaluate-evidence-v1", EvaluationPromptVersion} {
|
|
if currentWorkPrompt(claimedWork{Kind: "evaluation", PromptVersion: version}) != (version == EvaluationPromptVersion) {
|
|
t.Fatalf("prompt provenance not guarded: %s", version)
|
|
}
|
|
}
|
|
if !currentWorkPrompt(claimedWork{Kind: "translation", PromptVersion: TranslationPromptVersion}) {
|
|
t.Fatal("unchanged translator rejected")
|
|
}
|
|
}
|