fix(worker): 封存来源校验失败写入失败终态
build / build (push) Successful in 1m35s

verifyCapturedSource 失败时原实现只 return err:队列作业已是 failed,业务行
library_jobs 却停在 running/export、error 为空,页面永远显示"导出中"(实测
libseal-lib-internal-20261102T234053)。同函数其余四条失败分支都同时写 stage 与
job,这一条漏了。

现在 ensureCapturedSource 在校验失败时按既有惯例写 stage failed + job failed,
原错原样进取值、stage detail 与 job.error,恢复文案指向"修配置后重新封存"(快照
字节完好,不需要重采)。成功路径不变。

验证:
- RED:新增用例在修复前失败于 "stage writes = [], want exactly one failed stage"
- GREEN:TestCapturedSourceMismatchPersistsFailedStageAndJob /
  TestCapturedSourceMatchStaysSuccessful 通过
- make verify:16 项必需检查全绿(tests-go 含新用例)
This commit is contained in:
姚章浩
2026-11-03 07:59:40 +08:00
parent 22fb33aa75
commit 4421dd38ce
4 changed files with 124 additions and 1 deletions
+1 -1
View File
@@ -368,7 +368,7 @@ func workerHandlers(store *postgresstore.Store, config appconfig.Config) (map[st
"快照已产生但来源身份不符,未登记为测试封存;核对执行器后重新封存", "", "", finishedAt)
return identityErr
}
if err := verifyCapturedSource(config.LibraryArchiveRoot, result.SnapshotID, source); err != nil {
if err := ensureCapturedSource(ctx, store, libraryJobID, config.LibraryArchiveRoot, result.SnapshotID, source, finishedAt); err != nil {
return err
}
// 封存产物成版本记录:只登记"测试封存",绝不写成生产生效版本。