Skip to content

Commit 77cb51a

Browse files
feat(dashboard): render exact-review pressure
Co-authored-by: brokemac79 <[email protected]>
1 parent b79c1cf commit 77cb51a

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

‎dashboard/worker.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8642,6 +8642,7 @@ h2::before { content: ""; flex: 0 0 auto; width: 14px; height: 2px; border-radiu
86428642
.exact-handoff-title { display: grid; gap: 3px; }
86438643
.exact-handoff-title strong { font-size: 13px; font-weight: 650; }
86448644
.exact-handoff-title span { color: var(--muted); font-size: 12px; }
8645+
.exact-handoff-badges { display: flex; flex-wrap: wrap; gap: 6px; }
86458646
.health-badge {
86468647
flex: 0 0 auto;
86478648
padding: 3px 8px;
@@ -8654,8 +8655,10 @@ h2::before { content: ""; flex: 0 0 auto; width: 14px; height: 2px; border-radiu
86548655
}
86558656
.health-badge.healthy,
86568657
.health-badge.idle { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
8657-
.health-badge.degraded { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
8658-
.health-badge.stalled { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
8658+
.health-badge.degraded,
8659+
.health-badge.congested { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
8660+
.health-badge.stalled,
8661+
.health-badge.saturated { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
86598662
.handoff-phases {
86608663
display: grid;
86618664
grid-template-columns: repeat(3, minmax(0, 1fr));
@@ -9467,6 +9470,8 @@ function renderExactReviewHandoff(queue) {
94679470
return;
94689471
}
94699472
const status = ["idle", "healthy", "degraded", "stalled"].includes(health.status) ? health.status : "unknown";
9473+
const pressure = queue?.pressure;
9474+
const pressureStatus = ["idle", "congested", "saturated", "unknown"].includes(pressure?.status) ? pressure.status : "unknown";
94709475
const labels = {
94719476
pending: ["Pending", "waiting for admission"],
94729477
dispatching: ["Dispatching", "waiting for run claim"],
@@ -9480,8 +9485,9 @@ function renderExactReviewHandoff(queue) {
94809485
return '<div class="handoff-phase"><span>' + esc(labels[phase][0]) + '</span><strong>' + fmt.format(summary.count || 0) + '</strong><small>' + esc(labels[phase][1] + " · " + age) + '</small></div>';
94819486
}).join("");
94829487
const slots = fmt.format(health.available_slots || 0) + " of " + fmt.format(health.capacity || 0) + " exact-review slots open";
9488+
const backlog = fmt.format(queue?.pending || 0) + " total · " + fmt.format(queue?.ready_pending || 0) + " ready · " + fmt.format(queue?.admissible_pending || 0) + " admissible";
94839489
const threshold = "stalled after " + elapsed((health.stalled_after_seconds || 0) * 1000);
9484-
target.innerHTML = '<div class="exact-handoff"><div class="exact-handoff-head"><div class="exact-handoff-title"><strong>Exact-review handoff</strong><span>' + esc(health.message || "Queue phase telemetry") + '</span></div><span class="health-badge ' + esc(status) + '">' + esc(status) + '</span></div><div class="handoff-phases">' + phases + '</div><div class="handoff-foot"><span>' + esc(slots) + '</span><span>' + esc(threshold) + '</span></div></div>';
9490+
target.innerHTML = '<div class="exact-handoff"><div class="exact-handoff-head"><div class="exact-handoff-title"><strong>Exact-review handoff</strong><span>' + esc(health.message || "Queue phase telemetry") + '</span></div><div class="exact-handoff-badges"><span class="health-badge ' + esc(status) + '">' + esc(status) + '</span><span class="health-badge ' + esc(pressureStatus) + '">pressure ' + esc(pressureStatus) + '</span></div></div><div class="handoff-phases">' + phases + '</div><div class="handoff-foot"><span>' + esc(slots) + '</span><span>' + esc(backlog) + '</span><span>' + esc(threshold) + '</span></div></div>';
94859491
}
94869492
function renderWorkers(rows) {
94879493
workerIndex = new Map(rows.map(worker => [String(worker.id), worker]));

‎test/dashboard-worker.test.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4330,6 +4330,18 @@ test("dashboard hero treats apply and exact-review handoff health as attention",
43304330
automatic_work: [],
43314331
pipeline: [],
43324332
exact_review_queue: {
4333+
pending: 4,
4334+
ready_pending: 3,
4335+
admissible_pending: 2,
4336+
pressure: {
4337+
status: "congested",
4338+
reason: "capacity_full_with_backlog",
4339+
capacity: 28,
4340+
active: 28,
4341+
pending: 4,
4342+
ready_pending: 3,
4343+
admissible_pending: 2,
4344+
},
43334345
handoff_health: {
43344346
status: "healthy",
43354347
message: "Dispatch-to-claim handoffs are within the expected window.",
@@ -4440,16 +4452,20 @@ test("dashboard hero treats apply and exact-review handoff health as attention",
44404452
assert.match(elementFor("exact-review-handoff").innerHTML, /Dispatching/);
44414453
assert.match(elementFor("exact-review-handoff").innerHTML, /2 of 28 exact-review slots open/);
44424454
assert.match(elementFor("exact-review-handoff").innerHTML, /health-badge healthy/);
4455+
assert.match(elementFor("exact-review-handoff").innerHTML, /pressure congested/);
4456+
assert.match(elementFor("exact-review-handoff").innerHTML, /4 total · 3 ready · 2 admissible/);
44434457

44444458
status.recent.apply_health.items = [];
44454459
status.exact_review_queue.handoff_health.status = "stalled";
4460+
status.exact_review_queue.pressure.status = "saturated";
44464461
status.exact_review_queue.handoff_health.message =
44474462
"A dispatched review has not been claimed within the expected handoff window.";
44484463
context.renderDashboard(status, "");
44494464

44504465
assert.equal(elementFor("hero-dot").className, "hero-dot red");
44514466
assert.match(elementFor("hero-headline").textContent, /^Needs attention/);
44524467
assert.match(elementFor("exact-review-handoff").innerHTML, /health-badge stalled/);
4468+
assert.match(elementFor("exact-review-handoff").innerHTML, /pressure saturated/);
44534469

44544470
Object.assign(status, { exact_review_queue: null });
44554471
status.diagnostics.exact_review_queue_error = "exact-review queue timed out";

0 commit comments

Comments
 (0)