fix(snapshot): 阻止旧策略作业重放冒充新验收口径
This commit is contained in:
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 开发快照 snapshot/v0.1.105 - 2026-10-28
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- 修复成功作业重放遗漏验收策略检查的问题:旧快照缺少当前策略标识时明确拒绝,不静默升级验收口径,不返回成功状态或快照 ID,也不重新暂停测试写入服务。
|
||||||
|
- 新策略的正常重放与跨库、归档丢失等保护保持有效;此修复不代表内容/问答/性能验收绑定或整库业务链已经完成。
|
||||||
|
|
||||||
## 开发快照 snapshot/v0.1.104 - 2026-10-28
|
## 开发快照 snapshot/v0.1.104 - 2026-10-28
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ func CaptureLibrary(ctx context.Context, freeze *libraryfreeze.Coordinator, arch
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return libraryfreeze.Result{}, errors.New("captured library archive no longer verifies")
|
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) {
|
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")
|
return libraryfreeze.Result{}, errors.New("library capture request conflicts with existing job")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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" {
|
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")
|
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")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user