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:
@@ -128,16 +128,20 @@ SELECT p.id, si.title, p.ingest_state, p.processing_state, p.retrieval_state,
|
||||
JOIN source_item_versions other_version ON other_version.id=other.source_item_version_id
|
||||
WHERE other.id<>p.id AND other_version.source_item_id=siv.source_item_id
|
||||
) THEN 'updated' ELSE 'added' END AS change_type,
|
||||
(p.ingest_state='pending' AND p.processing_state IN ('pending','planned')
|
||||
-- Both flags compare against a LEFT-JOINed content object, so the raw
|
||||
-- expression is NULL (not false) for a row whose artifact was never
|
||||
-- fetched; a NULL here makes the whole list fail to scan into a Go bool
|
||||
-- and 500s the endpoint. Fold NULL to false.
|
||||
COALESCE((p.ingest_state='pending' AND p.processing_state IN ('pending','planned')
|
||||
AND p.retrieval_state='unpublished' AND p.knowledge_id=''
|
||||
AND co.content_state='verified' AND co.local_spool_ref<>'' AND co.size_bytes>0
|
||||
AND NOT EXISTS (SELECT 1 FROM processing_confirmations confirmation WHERE confirmation.publication_id=p.id)
|
||||
AND NOT EXISTS (SELECT 1 FROM jobs job WHERE job.type='test.upload' AND job.payload->>'publication_id'=p.id)) AS can_start,
|
||||
AND NOT EXISTS (SELECT 1 FROM jobs job WHERE job.type='test.upload' AND job.payload->>'publication_id'=p.id)), false) AS can_start,
|
||||
p.retry_count, p.last_error,
|
||||
((p.processing_state IN ('failed', 'stalled')
|
||||
COALESCE(((p.processing_state IN ('failed', 'stalled')
|
||||
OR (p.ingest_state = 'failed' AND p.processing_state = 'pending'))
|
||||
AND co.content_state = 'verified'
|
||||
AND co.local_spool_ref <> '') AS can_retry,
|
||||
AND co.local_spool_ref <> ''), false) AS can_retry,
|
||||
p.updated_at
|
||||
FROM test_publications p
|
||||
JOIN source_item_versions siv ON siv.id = p.source_item_version_id
|
||||
|
||||
Reference in New Issue
Block a user