fix(monitor): 修复取件死信无法重排与列表 NULL 标志导致的 500

- platform/postgres: listTestPublicationsSQL 的 can_start/can_retry 在 LEFT JOIN
  内容对象为空时算出 NULL,Go 侧 bool 扫描失败使整个列表接口 500,前端三个 lane
  全空(表现为“待入库 0 / 全部任务 0”)。改为 COALESCE(..., false)。
- 新增 POST /api/v1/job-failures/{id}/requeue:取件任务的幂等键绑在版本上,
  失败那次已占住它,重新标注同一文件不会再入队;现在按新轮次 (…:r<n>) 重排、
  复位意图取件状态并把死信标记为 requeued(幂等信封 + 审计字段)。
- web: 死信区对 artifact.fetch 显示「重新入队」;系统设置新增「知识库绑定」分区,
  挂上一直没被渲染的 RoutingBindingsSection,导入目标库可在页面上切换。
- 测试:真实 PostgreSQL 集成测试(NULL 折叠 + 重排轮次/幂等/拒绝)、前端死信按钮
  与设置分区渲染测试。
This commit is contained in:
hermes
2026-10-08 12:09:34 +08:00
parent 22a6bc5004
commit cddc4c90d1
12 changed files with 495 additions and 8 deletions
+22
View File
@@ -81,3 +81,25 @@ type CancelPublicationsBatchRequest struct {
Reason string `json:"reason"`
Now time.Time `json:"-"`
}
// RequeueArtifactFetchRequest re-enqueues ONE terminal 源头取件 (artifact.fetch)
// dead letter. The fetch job's idempotency key is derived from the version
// ("artifact-fetch:<version_id>"), and the failed attempt permanently occupies
// it — so a plain re-mark of the same file resolves to the same version and its
// ON CONFLICT DO NOTHING insert is silently swallowed. A requeue therefore opens
// a new ROUND ("...:r<n>") instead of replaying the original key.
type RequeueArtifactFetchRequest struct {
FailureID string
OperatorRef string
Reason string
Now time.Time
}
type RequeueArtifactFetchResult struct {
FailureID string `json:"failure_id"`
JobID string `json:"job_id"`
VersionID string `json:"version_id"`
Round int `json:"round"`
DocName string `json:"doc_name,omitempty"`
AlreadyQueued bool `json:"already_queued"`
}