feat: vertical box badge for multi-pass with breakdown

Multi-pass issues show a stacked box badge:
  ┌──────────────┐
  │  #7806 QA    │
  │ ✓ 1 reproduced    │
  │ ⚠ 1 inconclusive  │
  └──────────────┘

Single-pass issues keep the standard horizontal badge.
Badge colors: blue=reproduced, gray=not-repro, yellow=inconclusive.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
snomiao
2026-03-27 00:49:19 +00:00
parent d5360ce45c
commit b578f8d7c4
2 changed files with 74 additions and 12 deletions

View File

@@ -56,7 +56,7 @@ jobs:
# Only run on label events if it's one of our labels
if [ "$EVENT_ACTION" = "labeled" ] && \
[ "$LABEL" != "qa-changes" ] && [ "$LABEL" != "qa-full" ] && [ "$LABEL" != "qa-issue" ]; then
echo "skip=true" >> "$GITHUB_OUTPUT"
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
# Full QA triggers
@@ -612,6 +612,43 @@ jobs:
DUALBADGE
chmod +x /tmp/gen-badge-dual.sh
# Vertical box badge for multi-pass results
cat > /tmp/gen-badge-box.sh <<'BOXBADGE'
#!/bin/bash
# Usage: gen-badge-box.sh <output-path> <label> <repro> <not_repro> <fail> <total>
OUT="$1" LABEL="$2" REPRO="$3" NOREPRO="$4" FAIL="$5" TOTAL="$6"
W=140
ROW=18
HEADER=22
ROWS=0
[ "$REPRO" -gt 0 ] 2>/dev/null && ROWS=$((ROWS+1))
[ "$NOREPRO" -gt 0 ] 2>/dev/null && ROWS=$((ROWS+1))
[ "$FAIL" -gt 0 ] 2>/dev/null && ROWS=$((ROWS+1))
[ "$ROWS" -eq 0 ] && ROWS=1
H=$((HEADER + ROWS * ROW + 4))
Y=$((HEADER + 2))
cat > "$OUT" <<SVGEOF
<svg xmlns="http://www.w3.org/2000/svg" width="${W}" height="${H}" role="img" aria-label="${LABEL}: ${REPRO}/${TOTAL}">
<title>${LABEL}: ${REPRO} reproduced, ${NOREPRO} not-repro, ${FAIL} inconclusive / ${TOTAL}</title>
<rect width="${W}" height="${H}" rx="4" fill="#2a2d35"/>
<rect width="${W}" height="${HEADER}" rx="4" fill="#555"/>
<rect y="$((HEADER-4))" width="${W}" height="4" fill="#555"/>
<text x="$((W/2))" y="15" fill="#fff" text-anchor="middle" font-family="Verdana,sans-serif" font-size="11" font-weight="bold">${LABEL}</text>
SVGEOF
add_row() {
local count="$1" icon="$2" text="$3" color="$4"
[ "$count" -gt 0 ] || return
echo " <rect x='4' y='${Y}' width='$((W-8))' height='$((ROW-2))' rx='3' fill='${color}' opacity='.15'/>" >> "$OUT"
echo " <text x='10' y='$((Y+13))' fill='${color}' font-family='Verdana,sans-serif' font-size='11'>${icon} ${count} ${text}</text>" >> "$OUT"
Y=$((Y+ROW))
}
add_row "$REPRO" "✓" "reproduced" "#58a6ff"
add_row "$NOREPRO" "✗" "not reproducible" "#8b949e"
add_row "$FAIL" "⚠" "inconclusive" "#d29922"
echo "</svg>" >> "$OUT"
BOXBADGE
chmod +x /tmp/gen-badge-box.sh
- name: Resolve target number and type
id: pr
env:

View File

@@ -173,17 +173,36 @@ if [ -d video-reviews ]; then
fi
done
fi
echo "Verdict counts: ${REPRO_COUNT} reproduced, ${NOT_REPRO_COUNT} not-repro, ${INCONC_COUNT} inconclusive out of ${TOTAL_REPORTS} reports"
FAIL_COUNT=$((TOTAL_REPORTS - REPRO_COUNT - NOT_REPRO_COUNT))
[ "$FAIL_COUNT" -lt 0 ] && FAIL_COUNT=0
echo "Verdict: ${REPRO_COUNT}${NOT_REPRO_COUNT}${FAIL_COUNT}⚠ / ${TOTAL_REPORTS}"
# Determine badge text — show pass counts when multiple reports exist
# Badge text:
# Single pass: "REPRODUCED" / "NOT REPRODUCIBLE" / "INCONCLUSIVE"
# Multi pass: "2✓ 0✗ 1⚠ / 3" with color based on dominant result
REPRO_RESULT="" REPRO_COLOR="#9f9f9f"
if [ "$REPRO_COUNT" -gt 0 ]; then
REPRO_RESULT="REPRODUCED" REPRO_COLOR="#2196f3"
[ "$TOTAL_REPORTS" -gt 1 ] && REPRO_RESULT="${REPRO_COUNT}/${TOTAL_REPORTS} REPRODUCED"
elif [ "$NOT_REPRO_COUNT" -gt 0 ]; then
REPRO_RESULT="NOT REPRODUCIBLE" REPRO_COLOR="#9f9f9f"
elif [ "$INCONC_COUNT" -gt 0 ]; then
REPRO_RESULT="INCONCLUSIVE" REPRO_COLOR="#9f9f9f"
if [ "$TOTAL_REPORTS" -le 1 ]; then
# Single report — simple label
if [ "$REPRO_COUNT" -gt 0 ]; then
REPRO_RESULT="REPRODUCED" REPRO_COLOR="#2196f3"
elif [ "$NOT_REPRO_COUNT" -gt 0 ]; then
REPRO_RESULT="NOT REPRODUCIBLE" REPRO_COLOR="#9f9f9f"
elif [ "$FAIL_COUNT" -gt 0 ]; then
REPRO_RESULT="INCONCLUSIVE" REPRO_COLOR="#9f9f9f"
fi
else
# Multi pass — show breakdown: X✓ Y✗ Z⚠ / N
PARTS=""
[ "$REPRO_COUNT" -gt 0 ] && PARTS="${REPRO_COUNT}"
[ "$NOT_REPRO_COUNT" -gt 0 ] && PARTS="${PARTS:+${PARTS} }${NOT_REPRO_COUNT}"
[ "$FAIL_COUNT" -gt 0 ] && PARTS="${PARTS:+${PARTS} }${FAIL_COUNT}"
REPRO_RESULT="${PARTS} / ${TOTAL_REPORTS}"
# Color based on best outcome
if [ "$REPRO_COUNT" -gt 0 ]; then
REPRO_COLOR="#2196f3"
elif [ "$NOT_REPRO_COUNT" -gt 0 ]; then
REPRO_COLOR="#9f9f9f"
fi
fi
# Badge label includes the target number for identification
@@ -191,8 +210,14 @@ BADGE_LABEL="QA"
[ -n "${TARGET_NUM:-}" ] && BADGE_LABEL="#${TARGET_NUM} QA"
if [ "$TARGET_TYPE" = "issue" ]; then
BADGE_STATUS="${REPRO_RESULT:-FINISHED}"
/tmp/gen-badge.sh "$BADGE_STATUS" "${REPRO_COLOR}" "$DEPLOY_DIR/badge.svg" "$BADGE_LABEL"
if [ "$TOTAL_REPORTS" -gt 1 ]; then
# Multi-pass: vertical box badge with breakdown
/tmp/gen-badge-box.sh "$DEPLOY_DIR/badge.svg" "$BADGE_LABEL" \
"$REPRO_COUNT" "$NOT_REPRO_COUNT" "$FAIL_COUNT" "$TOTAL_REPORTS"
else
BADGE_STATUS="${REPRO_RESULT:-FINISHED}"
/tmp/gen-badge.sh "$BADGE_STATUS" "${REPRO_COLOR}" "$DEPLOY_DIR/badge.svg" "$BADGE_LABEL"
fi
else
# Extract the Overall Risk section for fix quality verdict.
# Only look at the "## Overall Risk" section to avoid false matches from