fix: resolve KeyError 'impact_score' for cached inventory items

This commit is contained in:
Nubenetes Bot
2026-06-02 12:44:19 +02:00
parent 937610a4e5
commit fb238c605f
2 changed files with 3 additions and 3 deletions

View File

@@ -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", ""),

View File

@@ -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))