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:
Celes Renata
2026-04-17 07:10:21 +00:00
parent 913fe8b0b3
commit 419cf7558a
2 changed files with 24 additions and 4 deletions
+22 -2
View File
@@ -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: