Skip to content

Commit d49b279

Browse files
MDA2AVclaude
andcommitted
Fix summary bar: show pass/warn/fail out of total tests
Bar now has three segments (green/amber/red) adding up to 100%. Score shows colored counts (pass warn fail / total) instead of the confusing pass/scored denominator that excluded warnings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f4f524f commit d49b279

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

docs/static/probe/render.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -192,54 +192,57 @@ window.ProbeRender = (function () {
192192
}
193193
var sorted = servers.slice().sort(function (a, b) {
194194
var sa = a.summary, sb = b.summary;
195-
var pa = sa.passed / (sa.scored || sa.total || 1);
196-
var pb = sb.passed / (sb.scored || sb.total || 1);
195+
var pa = sa.passed / (sa.total || 1);
196+
var pb = sb.passed / (sb.total || 1);
197197
return pb - pa || a.name.localeCompare(b.name);
198198
});
199199

200-
// Bar width is relative to total tests (not top scorer)
201-
var maxTotal = sorted[0] ? sorted[0].summary.total : 1;
202-
203200
var html = '<div style="display:flex;flex-direction:column;gap:6px;max-width:780px;">';
204201
sorted.forEach(function (sv, i) {
205202
var s = sv.summary;
206203
var total = s.total || 1;
207-
var scored = s.scored || total;
208204
var warnings = s.warnings || 0;
205+
var failed = s.failed || 0;
209206
var passPct = (s.passed / total) * 100;
210207
var warnPct = (warnings / total) * 100;
211-
var displayPct = Math.round((s.passed / scored) * 100);
208+
var failPct = (failed / total) * 100;
212209
var rank = i + 1;
213210

214211
html += '<div style="display:flex;align-items:center;gap:10px;">';
215212
html += '<div style="min-width:24px;text-align:right;font-size:13px;font-weight:600;color:#656d76;">' + rank + '</div>';
216213
html += '<div style="min-width:110px;font-size:13px;font-weight:600;white-space:nowrap;">' + sv.name + '</div>';
217214
var trackBg = document.documentElement.classList.contains('dark') ? '#2a2f38' : '#f0f0f0';
218-
html += '<div style="flex:1;height:22px;background:' + trackBg + ';border-radius:3px;overflow:hidden;position:relative;display:flex;">';
215+
html += '<div style="flex:1;height:22px;background:' + trackBg + ';border-radius:3px;overflow:hidden;display:flex;">';
219216
html += '<div style="height:100%;width:' + passPct + '%;background:' + PASS_BG + ';transition:width 0.3s;"></div>';
220217
if (warnings > 0) {
221218
html += '<div style="height:100%;width:' + warnPct + '%;background:' + WARN_BG + ';transition:width 0.3s;"></div>';
222219
}
220+
if (failed > 0) {
221+
html += '<div style="height:100%;width:' + failPct + '%;background:' + FAIL_BG + ';transition:width 0.3s;"></div>';
222+
}
223223
html += '</div>';
224-
html += '<div style="min-width:120px;text-align:right;font-size:13px;font-weight:700;">'
225-
+ s.passed + '/' + scored;
224+
// Score: pass / total
225+
html += '<div style="min-width:130px;text-align:right;font-size:13px;">';
226+
html += '<span style="font-weight:700;color:' + PASS_BG + ';">' + s.passed + '</span>';
226227
if (warnings > 0) {
227-
html += ' <span style="font-weight:400;color:#656d76;font-size:12px;">' + warnings + 'w</span>';
228+
html += ' <span style="color:' + WARN_BG + ';">' + warnings + '</span>';
229+
}
230+
if (failed > 0) {
231+
html += ' <span style="color:' + FAIL_BG + ';">' + failed + '</span>';
228232
}
233+
html += ' <span style="color:#656d76;font-size:12px;">/ ' + total + '</span>';
229234
html += '</div>';
230-
html += '<div style="min-width:40px;text-align:right;font-size:12px;color:#656d76;">' + displayPct + '%</div>';
231235
html += '</div>';
232236
});
233237
html += '</div>';
234238

235-
// Legend + total
239+
// Legend
236240
var totalTests = sorted[0] ? sorted[0].summary.total : 0;
237241
html += '<div style="display:flex;align-items:center;gap:16px;margin-top:10px;font-size:12px;color:#656d76;">';
238-
html += '<span>' + totalTests + ' tests total</span>';
242+
html += '<span>' + totalTests + ' tests</span>';
239243
html += '<span style="display:inline-flex;align-items:center;gap:4px;"><span style="display:inline-block;width:10px;height:10px;border-radius:2px;background:' + PASS_BG + ';"></span> Pass</span>';
240244
html += '<span style="display:inline-flex;align-items:center;gap:4px;"><span style="display:inline-block;width:10px;height:10px;border-radius:2px;background:' + WARN_BG + ';"></span> Warn</span>';
241-
var failBg = document.documentElement.classList.contains('dark') ? '#2a2f38' : '#f0f0f0';
242-
html += '<span style="display:inline-flex;align-items:center;gap:4px;"><span style="display:inline-block;width:10px;height:10px;border-radius:2px;background:' + failBg + ';border:1px solid #656d76;"></span> Fail</span>';
245+
html += '<span style="display:inline-flex;align-items:center;gap:4px;"><span style="display:inline-block;width:10px;height:10px;border-radius:2px;background:' + FAIL_BG + ';"></span> Fail</span>';
243246
html += '</div>';
244247

245248
if (data.commit) {

0 commit comments

Comments
 (0)