From 0a86edb600d81b6b24d896036947eec147338099 Mon Sep 17 00:00:00 2001 From: elkoled Date: Thu, 28 May 2026 22:04:57 -0700 Subject: [PATCH] car_diff: dedupe errors and render them in a collapsible dropdown A single failing carcontroller raises the same traceback for every segment, printing dozens of identical tracebacks at the top of the report. Group errors by their text, print each unique one once with the affected segment count, and wrap the block in a details dropdown like the diff section so it does not spam the PR comment. Co-Authored-By: Claude Opus 4.8 (1M context) --- opendbc/car/tests/car_diff.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/opendbc/car/tests/car_diff.py b/opendbc/car/tests/car_diff.py index b4424be8975..6bfe4914a78 100755 --- a/opendbc/car/tests/car_diff.py +++ b/opendbc/car/tests/car_diff.py @@ -293,8 +293,16 @@ def main(platform: str | None = None, segments_per_platform: int = 10, update_re icon = "⚠️" if with_diffs else "✅" print(f"\n{icon} {len(with_diffs)} changed, {n_passed} passed, {len(errors)} errors") - for plat, seg, err in errors: - print(f"\nERROR {plat} - {seg}: {err}") + if errors: + # Group identical errors so a single bug doesn't spam the report with one traceback per segment + by_err: dict[str, list[str]] = defaultdict(list) + for plat, seg, err in errors: + by_err[err].append(f"{plat} - {seg}") + print("
Show errors\n\n```") + for err, segs in sorted(by_err.items(), key=lambda kv: -len(kv[1])): + affected = ", ".join(segs[:3]) + (f" (+{len(segs) - 3} more)" if len(segs) > 3 else "") + print(f"\nERROR ({len(segs)}x) {affected}:\n{err.rstrip()}") + print("```\n
") if with_diffs: print("
Show changes\n\n```")