fix: evidence articles missing on recommendations + Lucide title prop CI failure
- recommendation worker: filter out non-UUID document IDs (synthetic pattern:* IDs from competitive signals) before inserting into recommendation_evidence table — the uuid cast was failing and silently dropping all evidence rows - wrap executemany in try/except so partial failures don't lose all evidence - SqlExplorer: wrap Lucide icons in <span title=...> instead of passing title prop directly (not supported by lucide-react, broke CI build)
This commit is contained in:
@@ -10,6 +10,7 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import uuid as _uuid
|
||||
from datetime import datetime, timezone
|
||||
|
||||
import asyncpg
|
||||
@@ -560,17 +561,36 @@ async def persist_recommendation(
|
||||
)
|
||||
rec_id = str(row["id"])
|
||||
|
||||
# Insert evidence citations with position-based weighting
|
||||
# Insert evidence citations with position-based weighting.
|
||||
# Filter out non-UUID document IDs (e.g. synthetic "pattern:..." IDs from
|
||||
# competitive signal propagation) — the recommendation_evidence table
|
||||
# requires a valid UUID foreign key to the documents table.
|
||||
evidence_rows: list[tuple[str, str, str, float]] = []
|
||||
for idx, doc_id in enumerate(supporting_ids):
|
||||
try:
|
||||
_uuid.UUID(doc_id)
|
||||
except (ValueError, AttributeError):
|
||||
continue
|
||||
weight = round(1.0 / (1.0 + idx * 0.1), 4) # rank decay
|
||||
evidence_rows.append((rec_id, doc_id, "supporting", weight))
|
||||
for idx, doc_id in enumerate(opposing_ids):
|
||||
try:
|
||||
_uuid.UUID(doc_id)
|
||||
except (ValueError, AttributeError):
|
||||
continue
|
||||
weight = round(1.0 / (1.0 + idx * 0.1), 4)
|
||||
evidence_rows.append((rec_id, doc_id, "opposing", weight))
|
||||
|
||||
if evidence_rows:
|
||||
await pool.executemany(_INSERT_REC_EVIDENCE, evidence_rows)
|
||||
try:
|
||||
await pool.executemany(_INSERT_REC_EVIDENCE, evidence_rows)
|
||||
except Exception:
|
||||
logger.warning(
|
||||
"Failed to insert %d evidence rows for recommendation %s",
|
||||
len(evidence_rows),
|
||||
rec_id,
|
||||
exc_info=True,
|
||||
)
|
||||
|
||||
# Persist the eligibility/risk evaluation for audit trail
|
||||
if eligibility_result is not None:
|
||||
|
||||
Reference in New Issue
Block a user