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:
@@ -282,8 +282,8 @@ export function SqlExplorerPage() {
|
|||||||
{t.columns.map((c) => (
|
{t.columns.map((c) => (
|
||||||
<div key={c.name} className="flex items-center justify-between text-[10px]">
|
<div key={c.name} className="flex items-center justify-between text-[10px]">
|
||||||
<span className="flex items-center gap-1 text-gray-400">
|
<span className="flex items-center gap-1 text-gray-400">
|
||||||
{c.primary_key && <Key size={9} className="text-amber-500" title="Primary key" />}
|
{c.primary_key && <span title="Primary key"><Key size={9} className="text-amber-500" /></span>}
|
||||||
{c.references && <Link size={9} className="text-blue-400" title={`FK → ${c.references}`} />}
|
{c.references && <span title={`FK → ${c.references}`}><Link size={9} className="text-blue-400" /></span>}
|
||||||
{c.name}
|
{c.name}
|
||||||
</span>
|
</span>
|
||||||
<span className="text-gray-600">{c.type}</span>
|
<span className="text-gray-600">{c.type}</span>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import uuid as _uuid
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
import asyncpg
|
import asyncpg
|
||||||
@@ -560,17 +561,36 @@ async def persist_recommendation(
|
|||||||
)
|
)
|
||||||
rec_id = str(row["id"])
|
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]] = []
|
evidence_rows: list[tuple[str, str, str, float]] = []
|
||||||
for idx, doc_id in enumerate(supporting_ids):
|
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
|
weight = round(1.0 / (1.0 + idx * 0.1), 4) # rank decay
|
||||||
evidence_rows.append((rec_id, doc_id, "supporting", weight))
|
evidence_rows.append((rec_id, doc_id, "supporting", weight))
|
||||||
for idx, doc_id in enumerate(opposing_ids):
|
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)
|
weight = round(1.0 / (1.0 + idx * 0.1), 4)
|
||||||
evidence_rows.append((rec_id, doc_id, "opposing", weight))
|
evidence_rows.append((rec_id, doc_id, "opposing", weight))
|
||||||
|
|
||||||
if evidence_rows:
|
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
|
# Persist the eligibility/risk evaluation for audit trail
|
||||||
if eligibility_result is not None:
|
if eligibility_result is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user