fix: reports 500, NaN scores, hypothesis dedup blocking

Reports 500 (Internal Server Error):
- app.py: Replace NaN/Infinity->null before json.loads() in both
  /reports and /api/runs routes. Old summary.json files with invalid
  NaN are now handled transparently.
- reports/writer.py: Added _safe_val() helper using math.isfinite().
  All summary.json values now use safe rounding (NaN->0, Inf->0).

No new hypotheses (optimizer stops after 1 iter):
- optimizer_loop.py: Changed dedup from DB-wide history to
  session-scoped (self.session_tested_deltas). Previous runs from
  old sessions no longer block new hypothesis proposals.
- Each tested hypothesis is tracked within the session only.

Result: optimizer now runs multiple iterations, scores are valid
numbers, reports page loads without 500.
This commit is contained in:
LEGSTECH Optimizer
2026-04-13 03:29:33 +00:00
parent 26e5f9d0c4
commit cf8613eb49
4 changed files with 26 additions and 7 deletions
BIN
View File
Binary file not shown.