From fb238c605f3bb0a43449ec2a6fd0199fb81a3c2c Mon Sep 17 00:00:00 2001 From: Nubenetes Bot Date: Tue, 2 Jun 2026 12:44:19 +0200 Subject: [PATCH] fix: resolve KeyError 'impact_score' for cached inventory items --- src/agentic_curator.py | 2 +- src/main.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/agentic_curator.py b/src/agentic_curator.py index 9e2058f2..82052d27 100644 --- a/src/agentic_curator.py +++ b/src/agentic_curator.py @@ -182,7 +182,7 @@ async def evaluate_extracted_assets(raw_assets: List[Dict]) -> Dict[str, Dict]: "language": data.get("language", "English"), "resource_type": data.get("type", "Reference"), "complexity": data.get("level", "Intermediate"), "hierarchy": data.get("technical_hierarchy", ["General"]), "tags": data.get("tags", []), "is_microservice": data.get("is_microservice", False), "year": data.get("pub_date", "N/A")[:4], - "stars": min(max(score // 20, 0), 5), "content_hash": d["hash"], + "stars": min(max(score // 20, 0), 5), "impact_score": score, "content_hash": d["hash"], "reputation_status": "Vetted" if not data.get("reputation_penalty") else "Suspicious", "reputation_summary": data.get("reputation_summary", ""), "source_provenance": d["asset"].get("source_type", "Social"), "social_preview_url": d["rich_meta"].get("og_image", ""), diff --git a/src/main.py b/src/main.py index 2c15ca43..0d1c63bc 100644 --- a/src/main.py +++ b/src/main.py @@ -308,7 +308,7 @@ async def master_orchestrator(): "related_categories": evaluation.get("related_categories", []), "post_date": asset.get("timestamp"), "source": asset.get("source_type", "Social"), - "impact_score": evaluation.get("impact_score", 0), + "impact_score": evaluation.get("impact_score") or (evaluation.get("stars", 0) * 20) or (80 if evaluation["status"] == "INCLUDED" else 0), "title": evaluation.get("title", "N/A"), "language": evaluation.get("language", "English"), "type": evaluation.get("resource_type", "Reference") @@ -322,7 +322,7 @@ async def master_orchestrator(): "description": evaluation["description"], "year": evaluation.get("year", "N/A"), "category": evaluation.get("category", "kubernetes-tools"), - "impact_score": evaluation["impact_score"], + "impact_score": evaluation.get("impact_score") or (evaluation.get("stars", 0) * 20) or 80, "reasoning": evaluation.get("reasoning") }) existing_urls.add(normalize_url(sanitized_url))