Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .changeset/dashboard-surfaces-verdict-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
---

Dashboard `/dashboard/agents` surfaces the new `verdict_source` field on the
compliance tile and a per-run "Your test / Heartbeat / Manual / Webhook"
badge in the History panel. PR 2 of the #4247 unification stack —
read-side cleanup that lets owners distinguish their own on-demand
runs from scheduled heartbeat verdicts at a glance.

**Context.** PR #4250 added `verdict_source` to
`/api/registry/agents/:url/compliance` and `triggered_by` to each row
returned by `/api/registry/agents/:url/compliance/history`. Both fields
were unrendered in the dashboard until this PR.

**What changes.**

- Compliance tile shows `Last checked: 3m ago (your test)` /
`(heartbeat)` / `(manual)` / `(webhook)` after the timestamp. Empty
string when `verdict_source` is null (never run).
- History panel renders a colored badge per run row:
- `Your test` (info-blue) for `triggered_by = 'owner_test'`
- `Heartbeat` (neutral) for `triggered_by = 'heartbeat'`
- `Manual` / `Webhook` (neutral) for the other enum values

No backend changes; this is pure UI surfacing of fields the API already
emits. Pre-PR-1 rows (which only have `'heartbeat'` / `'manual'` /
`'webhook'`) render with the neutral badge — no regression.

**Out of scope** (PR 3 of #4247): dropping `agent_test_history` and
backfilling owner-triggered rows. Tracked separately so the destructive
migration soaks behind the read-only UI change.
31 changes: 30 additions & 1 deletion server/public/dashboard-agents.html
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,19 @@ <h1>Agents</h1>
? timeAgo(new Date(cs.last_checked_at))
: 'never';

// Surface the verdict source so the operator knows whether the
// current status came from the scheduled heartbeat or their own
// owner-triggered test run. PR #4250 populates cs.verdict_source
// ('heartbeat' | 'owner_test' | 'manual' | 'webhook' | null when
// never run). Displayed inline with "Last checked" so the
// semantic shift on the public compliance contract is visible
// to the operator without having to read the changelog.
const verdictSourceLabel = cs.verdict_source === 'owner_test' ? ' (your test)'
: cs.verdict_source === 'heartbeat' ? ' (heartbeat)'
: cs.verdict_source === 'manual' ? ' (manual)'
: cs.verdict_source === 'webhook' ? ' (webhook)'
: '';

const isPublic = cs.status !== 'opted_out';

return `
Expand All @@ -1527,7 +1540,7 @@ <h1>Agents</h1>
${visibilitySelectorHtml}
<div class="agent-meta-row">
<div class="agent-meta-row-left">
<span>Last checked: ${escapeHtml(lastChecked)}</span>
<span>Last checked: ${escapeHtml(lastChecked)}${escapeHtml(verdictSourceLabel)}</span>
<span class="agent-meta-sep" aria-hidden="true">·</span>
<label class="agent-toggle" title="${isPublic ? 'Pause automated compliance and health checks' : 'Re-enable monitoring (Show on registry) before pausing'}">
<input type="checkbox" class="monitoring-pause-toggle" data-agent-url="${escapeHtml(agent.url)}" ${cs.monitoring_paused ? 'checked' : ''} ${isPublic ? '' : 'disabled'}>
Expand Down Expand Up @@ -2870,6 +2883,21 @@ <h1>Agents</h1>
: 'var(--color-warning-500)';
const date = new Date(run.tested_at).toLocaleString();

// Distinguish owner-triggered tests from scheduled heartbeat runs
// so the operator sees their own on-demand evaluations interleaved
// with the cron-driven verdicts. `triggered_by` enum is populated
// by the unification PR 1 (#4250); pre-PR-1 rows have
// 'heartbeat'/'manual'/'webhook' only — surface those neutrally.
const triggeredBy = run.triggered_by || 'heartbeat';
const sourceLabel = triggeredBy === 'owner_test' ? 'Your test'
: triggeredBy === 'heartbeat' ? 'Heartbeat'
: triggeredBy === 'manual' ? 'Manual'
: triggeredBy === 'webhook' ? 'Webhook'
: escapeHtml(String(triggeredBy));
const sourceBg = triggeredBy === 'owner_test' ? 'var(--color-info-50)' : 'var(--color-neutral-100)';
const sourceBorder = triggeredBy === 'owner_test' ? 'var(--color-info-200)' : 'var(--color-neutral-200)';
const sourceFg = triggeredBy === 'owner_test' ? 'var(--color-info-700)' : 'var(--color-text-secondary)';

let runTracks = '';
if (run.tracks_json) {
for (const t of run.tracks_json) {
Expand All @@ -2886,6 +2914,7 @@ <h1>Agents</h1>
html += '<span>' + escapeHtml(date) + '</span>';
html += '<span>' + escapeHtml(run.overall_status) + '</span>';
html += '<span>' + parseInt(run.tracks_passed, 10) + '/' + (parseInt(run.tracks_passed, 10) + parseInt(run.tracks_failed, 10) + parseInt(run.tracks_partial, 10)) + ' tracks</span>';
html += '<span class="history-run-source" style="font-size:var(--text-xs);padding:2px 8px;border-radius:var(--radius-full);background:' + sourceBg + ';border:1px solid ' + sourceBorder + ';color:' + sourceFg + ';">' + sourceLabel + '</span>';
html += '</div>';
if (runTracks) {
html += '<div style="padding:var(--space-1) 0 var(--space-2) var(--space-5);display:flex;gap:3px;flex-wrap:wrap;">' + runTracks + '</div>';
Expand Down
Loading