- 回收 SQL 占位符改为 $1/$2,消除 pgx 扩展协议 42P18(手动/定时对账 500) - 直接写入 finding 时归一空 confirmation_state,避免 23514 - 修正 R6/overview 同谓词用例夹具,两条台账各自持有 source version - 页面顶部统一服务与队列单行状态条,删除 Embedding/LLM 常量卡 - 平台阶段筛选合并为「WeKnora 处理中」,后端支持 stage=weknora - weknora_url 由测试 WeKnora 源构造,详情与 503 提供跳转链接 - 补 1000/页线上查询、R8 合法收养、weknora 阶段筛选用例
This commit is contained in:
@@ -145,7 +145,7 @@ const monitorTasksCTE = `WITH history_publications AS (
|
||||
SELECT * FROM projected WHERE ($1='' OR strpos(lower(title || ' ' || path),lower($1))>0)
|
||||
AND ($2='' OR source_id=$2) AND ($3='' OR target_scope=$3) AND ($4='' OR action=$4)
|
||||
AND ($5='' OR ($5='active' AND status NOT IN ('completed','cancelled')) OR status=$5)
|
||||
AND ($6='' OR stage=$6) AND ($7='' OR id=$7) AND ($10='' OR target_kb=$10)
|
||||
AND ($6='' OR stage=$6 OR ($6='weknora' AND stage IN ('parsing','indexing'))) AND ($7='' OR id=$7) AND ($10='' OR target_kb=$10)
|
||||
AND ($11='' OR updated_at>=NULLIF($11,'')::timestamptz) AND ($12='' OR updated_at<=NULLIF($12,'')::timestamptz)
|
||||
) `
|
||||
|
||||
|
||||
@@ -97,8 +97,8 @@ func (s *Store) ReapStaleReconciliationRuns(ctx context.Context, now time.Time,
|
||||
return 0, nil
|
||||
}
|
||||
tag, err := s.db.Exec(ctx, `UPDATE reconciliation_runs
|
||||
SET state='failed',finished_at=$2,error_code='stale_timeout'
|
||||
WHERE state='running' AND started_at < $3`, now, now.Add(-threshold))
|
||||
SET state='failed',finished_at=$1,error_code='stale_timeout'
|
||||
WHERE state='running' AND started_at < $2`, now, now.Add(-threshold))
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("reap stale reconciliation runs: %w", err)
|
||||
}
|
||||
@@ -222,6 +222,13 @@ WHERE id=$1 AND state='running'`, run.ID, run.FinishedAt, run.LedgerCount, run.K
|
||||
return ErrReconciliationNotRunning
|
||||
}
|
||||
for _, finding := range findings {
|
||||
// The column default only applies when the insert omits the column; the
|
||||
// service always fills it, but direct callers may pass "" and must not
|
||||
// violate the check constraint.
|
||||
confirmation := finding.ConfirmationState
|
||||
if confirmation == "" {
|
||||
confirmation = "confirmed"
|
||||
}
|
||||
if _, err := tx.Exec(ctx, `INSERT INTO reconciliation_findings
|
||||
(id,run_id,finding_type,publication_id,knowledge_id,title,path,source,target_scope,
|
||||
ledger_state,weknora_parse_status,normalized_state,ledger_sha256,declared_sha256,
|
||||
@@ -231,7 +238,7 @@ VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,'open'
|
||||
finding.ID, finding.RunID, finding.Type, finding.PublicationID, finding.DocumentID,
|
||||
finding.Title, finding.Path, finding.Source, finding.TargetScope, finding.LedgerState,
|
||||
finding.WeKnoraParseState, finding.NormalizedState, finding.LedgerSHA256, finding.DeclaredSHA256,
|
||||
finding.WeKnoraFileMD5, finding.EvidenceLevel, finding.ConfirmationState, finding.Detail,
|
||||
finding.WeKnoraFileMD5, finding.EvidenceLevel, confirmation, finding.Detail,
|
||||
finding.SuggestedAction, finding.WeKnoraURL, run.FinishedAt); err != nil {
|
||||
return fmt.Errorf("insert reconciliation finding: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user