fix(admin): show real node tallies on team cards, not dead counters

TeamCard displayed team.stats.{calls,nominal,anomalous,critical}, but
nothing has called recordEvent since the simulator was removed, so every
card read "0 · 0 · 0 · 0" - in the pre-pivot classifier vocabulary.

Admin already had real per-team tallies from useCollective.counts (derived
from the node activity stream, and already used for totalFlashes); they
just were not passed down. Cards now show agent runs / flashes / errors,
with errors only rendered when non-zero.

Same root cause as the AddDocument telemetry removed in 5a5810a.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Omar Sobh
2026-07-20 04:06:30 -07:00
co-authored by Claude Opus 4.8
parent 5a5810a1c8
commit 32750b0d9d
2 changed files with 14 additions and 5 deletions
+13 -5
View File
@@ -17,12 +17,18 @@ export interface TeamCardProps {
team: TeamSnapshot team: TeamSnapshot
submitted: boolean submitted: boolean
scored: boolean scored: boolean
/**
* Real per-team tallies from the node activity stream (useCollective.counts).
* `team.stats` is NOT used here: nothing has called recordEvent since the
* simulator was removed, so those counters are permanently zero.
*/
counts?: { calls: number; flashes: number; errors: number }
/** current wall-clock ms; 0 (default) disables stale dimming */ /** current wall-clock ms; 0 (default) disables stale dimming */
now?: number now?: number
} }
/** One team's live tile in the instructor grid. Pure presentational. */ /** One team's live tile in the instructor grid. Pure presentational. */
export function TeamCard({ team, submitted, scored, now = 0 }: TeamCardProps) { export function TeamCard({ team, submitted, scored, counts, now = 0 }: TeamCardProps) {
const stale = now > 0 && now - new Date(team.updatedAt).getTime() > STALE_MS const stale = now > 0 && now - new Date(team.updatedAt).getTime() > STALE_MS
return ( return (
<div <div
@@ -57,10 +63,12 @@ export function TeamCard({ team, submitted, scored, now = 0 }: TeamCardProps) {
))} ))}
</div> </div>
<div className="font-mono text-[10px] text-muted-foreground tabular-nums"> <div
{team.stats.calls} · <span className="text-teal">{team.stats.nominal}</span>{' '} className="font-mono text-[10px] text-muted-foreground tabular-nums"
<span className="text-amber">{team.stats.anomalous}</span>{' '} title="agent runs · flashes · errors"
<span className="text-rose">{team.stats.critical}</span> >
{counts?.calls ?? 0} runs · <span className="text-primary">{counts?.flashes ?? 0}</span> flashed{' '}
{(counts?.errors ?? 0) > 0 && <span className="text-destructive">{counts?.errors} err</span>}
</div> </div>
{(submitted || scored) && ( {(submitted || scored) && (
+1
View File
@@ -141,6 +141,7 @@ function AdminBoard({ code }: { code: string }) {
team={t} team={t}
submitted={!!submissions[t.id]} submitted={!!submissions[t.id]}
scored={!!submissions[t.id]?.scored} scored={!!submissions[t.id]?.scored}
counts={counts[t.id]}
now={now} now={now}
/> />
))} ))}