Skip to content

Commit 032b2a8

Browse files
committed
bugbot fixes
1 parent 5792a09 commit 032b2a8

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

scripts/test/diff_corpora_results.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,18 @@ def status_emoji(new_count, removed_count, unique_main):
102102

103103

104104
def build_top_line_summary(rows, changed):
105-
regressed = sum(1 for r in rows if not r["is_new"] and r["emoji"] in ("🔴", "⚠️"))
105+
regressed = sum(1 for r in rows if not r["is_new"] and r["emoji"] == "🔴")
106+
warned = sum(1 for r in rows if not r["is_new"] and r["emoji"] == "⚠️")
106107
new_count = sum(1 for r in rows if r["is_new"])
107108
clean = sum(1 for r in rows if r["emoji"] == "✅")
108109
scoped = ", ".join(f"`{d}`" for d in sorted(changed)) if changed else ""
109-
summary = f"**{regressed} regressed · {new_count} new · {clean} clean**"
110+
parts = []
111+
if regressed:
112+
parts.append(f"{regressed} regressed")
113+
if warned:
114+
parts.append(f"{warned} warned")
115+
parts += [f"{new_count} new", f"{clean} clean"]
116+
summary = f"**{' · '.join(parts)}**"
110117
if scoped:
111118
summary += f" \u00a0|\u00a0 Scoped to: {scoped}"
112119
return summary
@@ -131,7 +138,13 @@ def render(main, pr, changed=None, new_detectors=None):
131138
rows = []
132139
has_diff = False
133140
for d in sorted(all_names):
134-
is_new = d.lower() in new_detectors
141+
# A detector is only treated as fully new if the new_detectors set
142+
# says so AND main produced no findings for it. When a PR modifies an
143+
# existing version and adds a new version of the same detector (e.g.
144+
# jdbc.v1 + jdbc.v2), both collapse to "jdbc" in new_detectors but
145+
# main still ran against the existing version — its results must not
146+
# be discarded.
147+
is_new = d.lower() in new_detectors and d not in main
135148
m = main.get(d, _empty)
136149
p = pr.get(d, _empty)
137150
new_ids = p["identities"] - m["identities"]

0 commit comments

Comments
 (0)