From 3dc854de4bc7899f69b02a8e0d333c5a4ba97702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9A=E7=AB=A0=E6=B5=A9?= Date: Wed, 28 Oct 2026 08:05:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(snapshot):=20=E9=98=BB=E6=AD=A2=E6=97=A7?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E4=BD=9C=E4=B8=9A=E9=87=8D=E6=94=BE=E5=86=92?= =?UTF-8?q?=E5=85=85=E6=96=B0=E9=AA=8C=E6=94=B6=E5=8F=A3=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ .../releaseadapter/v071/library_capture.go | 3 +++ .../v071/library_capture_test.go | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 870f878..d9b9545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 开发快照 snapshot/v0.1.105 - 2026-10-28 + +### Fixed + +- 修复成功作业重放遗漏验收策略检查的问题:旧快照缺少当前策略标识时明确拒绝,不静默升级验收口径,不返回成功状态或快照 ID,也不重新暂停测试写入服务。 +- 新策略的正常重放与跨库、归档丢失等保护保持有效;此修复不代表内容/问答/性能验收绑定或整库业务链已经完成。 + ## 开发快照 snapshot/v0.1.104 - 2026-10-28 ### Changed diff --git a/internal/releaseadapter/v071/library_capture.go b/internal/releaseadapter/v071/library_capture.go index 8ba5c7b..f657ec2 100644 --- a/internal/releaseadapter/v071/library_capture.go +++ b/internal/releaseadapter/v071/library_capture.go @@ -64,6 +64,9 @@ func CaptureLibrary(ctx context.Context, freeze *libraryfreeze.Coordinator, arch if err != nil { return libraryfreeze.Result{}, errors.New("captured library archive no longer verifies") } + if saved.ValidationPolicy != librarysnapshot.ArtifactAcceptancePolicy { + return libraryfreeze.Result{}, errors.New("library capture validation policy conflicts with existing job") + } if saved.Scope != req.Scope || saved.TenantID != req.Identity.TenantID || saved.KnowledgeBaseID != req.Identity.KnowledgeBaseID || saved.Compatibility != req.Compatibility || !saved.CreatedAt.Equal(req.CreatedAt) { return libraryfreeze.Result{}, errors.New("library capture request conflicts with existing job") } diff --git a/internal/releaseadapter/v071/library_capture_test.go b/internal/releaseadapter/v071/library_capture_test.go index 275f2d3..865207e 100644 --- a/internal/releaseadapter/v071/library_capture_test.go +++ b/internal/releaseadapter/v071/library_capture_test.go @@ -133,6 +133,24 @@ func TestLibraryCaptureMaintenanceOwnsArchiveAndRestoresOnFailure(t *testing.T) if got, err := CaptureLibrary(context.Background(), freeze, archive, db, search, &libraryCandidateReader{}, ready, req); err == nil || got.State == "succeeded" { t.Fatal("missing archive returned a successful candidate") } + // Simulate a durable successful job created before the policy marker. + // Replaying it must not silently upgrade its validation contract. + saved.ValidationPolicy = "" + legacyID, err := archive.Seal(saved) + if err != nil { + t.Fatal(err) + } + req.JobID = "legacy-capture-job" + if _, err := freeze.RunPrepared(context.Background(), req.JobID, func(context.Context) error { return nil }, func(context.Context) (string, error) { return legacyID, nil }); err != nil { + t.Fatal(err) + } + stops, previousChecks := writer.stops, checks + if got, err := CaptureLibrary(context.Background(), freeze, archive, db, search, &libraryCandidateReader{}, ready, req); err == nil || got.State == "succeeded" || got.SnapshotID != "" { + t.Fatal("legacy policy replay silently upgraded to artifact acceptance") + } + if writer.stops != stops || checks != previousChecks { + t.Fatal("policy conflict touched current source") + } }) } }