chore(repo): 纳入云治理主站运行基线 #27

Merged
zheromiku merged 195 commits from integrate/cloud-main-baseline into main 2026-11-23 14:23:59 +08:00
Showing only changes of commit a1472ff29f - Show all commits
@@ -1006,32 +1006,35 @@ UPDATE knowledge_bases SET embedding_model_id='r38-model',vector_store_id='r38-v
}
heldIndex := recoveryIndexReadback(t, fx)
save("13-index-held.json", heldIndex)
heldDoc, ok := heldIndex["chunk-target"]
if !ok {
t.Fatal("chunk-target missing at held boundary")
}
heldSource := heldDoc["_source"].(map[string]any)
heldContent, _ := heldSource["content"].(string)
if earlyBranch {
// database 阶段失败时索引还没被恢复:既不能有恢复 marker,也不能回到 before-image。
if strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
t.Fatalf("early held index must not carry a restore marker: %q", heldContent)
// database 阶段失败时索引还没被恢复:整份读回必须仍是发布写入后的那一代,
// before-image 的 chunk-target 不能提前出现。
if !reflect.DeepEqual(appliedIndex, heldIndex) {
t.Fatalf("early held index must be exactly the applied publish generation (applied=%d docs, held=%d docs)",
len(appliedIndex), len(heldIndex))
}
appliedSource := appliedIndex["chunk-target"]["_source"]
if !reflect.DeepEqual(appliedSource, heldSource) {
t.Fatal("early held index must still be the applied publish content")
if _, ok := heldIndex["chunk-target"]; ok {
t.Fatal("before-image chunk-target reappeared before the index stage ran")
}
} else if fullShape {
// 对象分支里索引已恢复,marker 不能还在:否则说明失败的其实是 ES 分支。
if strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
t.Fatalf("object branch left the ES restore marker in place: %q", heldContent)
} else {
heldDoc, ok := heldIndex["chunk-target"]
if !ok {
t.Fatal("chunk-target missing at held boundary")
}
oldSource := beforeIndex["chunk-target"]["_source"]
if !reflect.DeepEqual(oldSource, heldSource) {
t.Fatalf("object branch index was not restored to its before-image")
heldSource := heldDoc["_source"].(map[string]any)
heldContent, _ := heldSource["content"].(string)
if fullShape {
// 对象/PG wiki 分支里索引已恢复,marker 不能还在:否则说明失败的其实是 ES 分支。
if strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
t.Fatalf("restored index left the ES restore marker in place: %q", heldContent)
}
oldSource := beforeIndex["chunk-target"]["_source"]
if !reflect.DeepEqual(oldSource, heldSource) {
t.Fatalf("index was not restored to its before-image")
}
} else if !strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
t.Fatalf("held index must still carry the restore marker, got %q", heldContent)
}
} else if !strings.HasPrefix(heldContent, indexRestoreClaimPrefix) {
t.Fatalf("held index must still carry the restore marker, got %q", heldContent)
}
events, refused := proxy.snapshot()
save("14-wire-held.json", map[string]any{"events": events, "refused": refused})