feat(snapshot): 按已确认口径保留索引产物并标记验收策略
build / build (push) Successful in 1m12s

This commit is contained in:
姚章浩
2026-10-28 08:01:46 +08:00
parent 2fc6dc068b
commit 76f687b52d
6 changed files with 130 additions and 35 deletions
@@ -5,7 +5,8 @@ import (
"testing"
)
func TestLibraryCandidateValidatesPersistedTextIndexTransform(t *testing.T) {
// Scheme A archives artifact bytes; these cases do not certify semantic quality.
func TestLibraryCandidatePreservesArtifactContentWithoutReconstruction(t *testing.T) {
for _, tc := range []struct {
name, kind, body, index string
valid bool
@@ -13,11 +14,12 @@ func TestLibraryCandidateValidatesPersistedTextIndexTransform(t *testing.T) {
{"current title prefix", "text", "\n chunk \t", "Document title\nchunk", true},
{"legacy raw body", "text", "\n chunk \t", "\n chunk \t", true},
{"trimmed body", "text", "\n chunk \t", "chunk", true},
{"wrong title", "text", "chunk", "Other title\nchunk", false},
{"missing body", "text", "chunk", "Document title\n", false},
{"different body", "text", "chunk", "Document title\nchanged", false},
{"unverifiable context header", "text", "chunk", "Document title\nTransient heading\n\nchunk", false},
{"nontext transform not assumed", "faq", "chunk", "Document title\nchunk", false},
{"wrong title", "text", "chunk", "Other title\nchunk", true},
{"missing body", "text", "chunk", "Document title\n", true},
{"different body", "text", "chunk", "Document title\nchanged", true},
{"unverifiable context header", "text", "chunk", "Document title\nTransient heading\n\nchunk", true},
{"nontext transform not assumed", "faq", "chunk", "Document title\nchunk", true},
{"empty artifact content", "text", "chunk", " \n", false},
} {
t.Run(tc.name, func(t *testing.T) {
pg, es, _ := libraryCandidateFixture()
@@ -33,7 +35,7 @@ func TestLibraryCandidateValidatesPersistedTextIndexTransform(t *testing.T) {
t.Fatalf("valid indexed text refused: %v", err)
}
if !tc.valid && err == nil {
t.Fatal("unverifiable index content accepted")
t.Fatal("empty index content accepted")
}
})
}