Skip to content

Commit 3fde6ba

Browse files
baibaichenclaude
andcommitted
Fix classify_test: use last record's offload status for failed tests
For failed tests, failure always occurs at the last record. The previous logic used any(FALLBACK) across all records, misclassifying tests where intermediate records were FALLBACK but the failing last record was OFFLOAD. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
1 parent c98b701 commit 3fde6ba

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

.github/scripts/analyze-ansi.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,24 +205,29 @@ def _infer_job_name(xml_path):
205205
# ANALYSIS LAYER
206206
# ===========================================================================
207207

208-
def classify_test(status, has_fallback, has_offload_data):
209-
"""Unified three-color classification."""
208+
def classify_test(status, has_fallback, has_offload_data, last_record_fallback=None):
209+
"""Unified three-color classification.
210+
211+
For failed tests, last_record_fallback (bool) determines Offload vs Fallback
212+
because failure always occurs at the last record.
213+
"""
210214
is_pass = status in ("PASSED", "PASS")
211215
is_skip = status in ("SKIPPED", "SKIP")
216+
is_fail = status in ("FAILED", "ERROR", "FAIL")
212217
if is_skip:
213218
return "⚪", "Skipped"
214-
if has_fallback:
215-
if is_pass:
216-
return "🔴", "Passed+Fallback"
217-
return "🔴", "Failed+Fallback"
218219
if not has_offload_data:
219220
if is_pass:
220221
return "⚪", "Passed (no data)"
221222
return "🟡", "Failed (no data)"
223+
if is_fail:
224+
if last_record_fallback:
225+
return "🔴", "Failed+Fallback"
226+
return "🟡", "Failed+Offload"
227+
if has_fallback:
228+
return "🔴", "Passed+Fallback"
222229
if is_pass:
223230
return "🟢", "Passed+Offload"
224-
if status in ("FAILED", "ERROR", "FAIL"):
225-
return "🟡", "Failed+Offload"
226231
return "🟡", "Failed"
227232

228233

@@ -236,8 +241,10 @@ def analyze_json_tests(suites):
236241
records = t.get("records", [])
237242
has_fallback = any(r.get("offload") == "FALLBACK" for r in records)
238243
has_offload_data = len(records) > 0
244+
last_record_fallback = (records[-1].get("offload") == "FALLBACK") if records else None
239245
color, label = classify_test(
240-
t.get("status", "PASSED"), has_fallback, has_offload_data)
246+
t.get("status", "PASSED"), has_fallback, has_offload_data,
247+
last_record_fallback)
241248
tests.append({
242249
"suite": suite_name,
243250
"test": t["name"],
@@ -469,8 +476,10 @@ def format_summary(summary, json_tests, suites=None):
469476
has_fallback = any(r.get("offload") == "FALLBACK"
470477
for r in records)
471478
has_offload_data = len(records) > 0
479+
last_fb = (records[-1].get("offload") == "FALLBACK") if records else None
472480
_, label = classify_test(
473-
t.get("status", "PASSED"), has_fallback, has_offload_data)
481+
t.get("status", "PASSED"), has_fallback, has_offload_data,
482+
last_fb)
474483
counts[label] += 1
475484
total = sum(counts.values())
476485
po = counts.get("Passed+Offload", 0)

0 commit comments

Comments
 (0)