abinazebinoy commited on
Commit
402e6dc
·
1 Parent(s): 5852df6

fix(BUG-03/08): RiskScorer() takes no args; scorer.score()→use get_risk() route

Browse files
api/routes/adversarial.py CHANGED
@@ -32,10 +32,14 @@ def adversarial_analysis(entity_id: str, driver=Depends(get_db)):
32
  # Pull findings from risk scorer to pass into adversarial engine
33
  findings = []
34
  try:
35
- scorer = RiskScorer(driver=driver)
36
- result = scorer.score(entity_id, name)
37
- findings = result.get("findings", [])
 
 
 
 
38
  except Exception as e:
39
- logger.warning(f"[Adversarial] Could not load findings from risk scorer: {e}")
40
 
41
  return engine.analyze(entity_id, name, findings, driver=driver)
 
32
  # Pull findings from risk scorer to pass into adversarial engine
33
  findings = []
34
  try:
35
+ # BUG-03 FIX: RiskScorer() takes no constructor args; use score_entity() not score()
36
+ from api.routes.risk import get_risk
37
+ risk_result = get_risk(entity_id, driver)
38
+ findings = [
39
+ {"name": f.name, "score": f.score, "description": f.description}
40
+ for f in risk_result.factors
41
+ ]
42
  except Exception as e:
43
+ logger.warning(f"[Adversarial] Could not load findings from risk route: {e}")
44
 
45
  return engine.analyze(entity_id, name, findings, driver=driver)
api/routes/debate.py CHANGED
@@ -30,10 +30,13 @@ def run_debate(entity_id: str, driver=Depends(get_db)):
30
 
31
  findings = []
32
  try:
33
- from ai.risk_scorer import RiskScorer
34
- scorer = RiskScorer(driver=driver)
35
- result = scorer.score(entity_id, name)
36
- findings = result.get("findings", [])
 
 
 
37
  except Exception as e:
38
  logger.warning(f"[Debate] Could not load findings: {e}")
39
 
 
30
 
31
  findings = []
32
  try:
33
+ # BUG-03 FIX: RiskScorer() takes no constructor args; use risk route instead
34
+ from api.routes.risk import get_risk
35
+ risk_result = get_risk(entity_id, driver)
36
+ findings = [
37
+ {"name": f.name, "score": f.score, "description": f.description}
38
+ for f in risk_result.factors
39
+ ]
40
  except Exception as e:
41
  logger.warning(f"[Debate] Could not load findings: {e}")
42