fix(rectification): narrate the credible range and stop scoring periods by length (BUG-569–570)

Choice copy was comparing the search window, so every answer said the range had not changed. Block-scan summed raw scores, so longer afternoon windows won before any evidence difference.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jesse_Chen
2026-09-07 10:03:28 +08:00
parent d6ee8cbb26
commit 517df002b5
17 changed files with 312 additions and 46 deletions
+5 -1
View File
@@ -427,6 +427,8 @@ def block_scan(request: RectificationRequest) -> dict[str, Any]:
row for row in scored.get("candidate_scores") or []
if isinstance(row, dict) and str(row.get("time") or "")[:5]
]
day_scores = [float(row.get("score") or 0) for row in rows]
min_day = min(day_scores) if day_scores else 0.0
raw_support: list[float] = []
blocks: list[dict[str, Any]] = []
for period, start_time, end_time in BLOCK_SCAN_PERIODS:
@@ -448,7 +450,9 @@ def block_scan(request: RectificationRequest) -> dict[str, Any]:
"domain": event.get("domain"),
"summary": event.get("summary"),
})
raw_support.append(sum(float(row.get("score") or 0) for row in members))
member_scores = [float(row.get("score") or 0) for row in members]
mean = (sum(member_scores) / len(member_scores)) if member_scores else 0.0
raw_support.append(max(mean - min_day, 0.0))
blocks.append({
"period": period,
"start_time": start_time,