87f97a2f9b
build / build (push) Successful in 1m7s
详情使用共享主表字典,稀疏修改所选字段并保留原始问答及旧复核审计。 月周统计提供文本和下拉双入口;每租户每周一份持久草稿,按技能六节双语模板真实预填。 加入幂等自动保存、冲突保留、未知响应重试、切周及离开保护和schema58非破坏降级保护。 验证:完整make verify、隔离PostgreSQL全mirror竞态回归、真实恢复库浏览器验收通过。 浏览器实测字段精确读回、月周双输入、模板预填、MD/CSV、自动保存、冲突、失败重试与API重启恢复。 未连接或改写DobotAI生产源库,未运行付费模型;提交时尚未部署。
32 lines
2.1 KiB
Go
32 lines
2.1 KiB
Go
package qaopsquality
|
|
|
|
import (
|
|
"knowledge-governance/internal/dobotaiops"
|
|
"testing"
|
|
)
|
|
|
|
func TestMasterInlineEditsOverrideLegacyReviewOnlyForSelectedFields(t *testing.T) {
|
|
v := View{State: "reviewed", Revision: 7, Effective: Fields{Coverage: "covered", Correctness: "incorrect", ProductCategory: "legacy", ProblemType: "故障", RootCause: "知识过期"}, LatestReview: &Review{Revision: 7}}
|
|
edits := map[string]string{"coverage": "否但不计入", "is_correct": "是", "root_cause": "检索不到"}
|
|
got := ProjectMasterWithEdits(v, map[string]string{}, dobotaiops.CoverageCheck{}, edits)
|
|
if got.Effective.Coverage != "excluded" || got.Effective.ExclusionReason == "" || got.Effective.Correctness != "correct" || got.Effective.RootCause != "" || got.Effective.ProductCategory != "legacy" || got.Effective.ProblemType != "故障" || got.LatestReview.Revision != 7 {
|
|
t.Fatalf("inline override/reset dependency/legacy preservation failed: %+v", got)
|
|
}
|
|
reverted := ProjectMasterWithEdits(got, nil, dobotaiops.CoverageCheck{}, map[string]string{"coverage": "否", "is_correct": "待确认", "problem_type": "咨询", "root_cause": "知识缺失"})
|
|
if reverted.Effective.Coverage != "uncovered" || reverted.Effective.ExclusionReason != "" || reverted.Effective.Correctness != "pending" || reverted.Effective.ProblemType != "咨询" || reverted.Effective.RootCause != "知识缺失" {
|
|
t.Fatalf("canonical labels/reset failed: %+v", reverted)
|
|
}
|
|
}
|
|
|
|
func TestMasterInlineEditChangesOnlyChosenFieldWithoutFabricatingReview(t *testing.T) {
|
|
v := View{State: "unreviewed"}
|
|
stored := map[string]string{"coverage": "是", "product_category": "CRV"}
|
|
got := ProjectMasterWithEdits(v, stored, dobotaiops.CheckMasterCoverage("existing answer", true), map[string]string{"product_category": "MG400"})
|
|
if got.Effective.ProductCategory != "MG400" || got.Effective.Correctness != "" || got.Effective.ProblemType != "" || got.State != "unreviewed" || got.LatestReview != nil {
|
|
t.Fatalf("single-field edit lost or implicitly created other conclusions: %+v", got)
|
|
}
|
|
if stored["product_category"] != "CRV" {
|
|
t.Fatal("mutated source labels")
|
|
}
|
|
}
|