feat(realism-ui): human-readable content_class labels

Single source of truth in decnet_web/src/realism/labels.ts: maps each
ContentClass enum value to a friendly display name ("Note",
"Cron Log", "Canary · AWS Credentials", …). Used by RealismConfig
(weight tables + class filter dropdown) and SyntheticFiles (table row
+ drawer detail).

Canary classes get a subtle amber accent so the dashboard's read of
"this row is callback-bearing" doesn't depend on prefix-spotting in
mono text. Raw enum value still appears in dim mono next to the label
so an operator copy/pasting from logs or grepping the codebase still
finds it.

No backend change: the wire shape is still the snake_case enum; the
beautification is render-time only.
This commit is contained in:
2026-04-27 18:04:33 -04:00
parent 56a88d7bd4
commit 2950fc216e
3 changed files with 66 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import api from '../../utils/api';
import { useToast } from '../Toasts/useToast';
import { Sliders, Save, RotateCcw } from '../../icons';
import { contentClassLabel, isCanaryClass } from '../../realism/labels';
// ─── Types ───────────────────────────────────────────────────────────────────
@@ -70,8 +71,15 @@ const WeightTable: React.FC<{
<tbody>
{weights.map((w, i) => (
<tr key={w.content_class} style={{ borderBottom: '1px solid rgba(255,255,255,0.04)' }}>
<td className="mono" style={{ padding: '6px 12px', width: '40%' }}>
{w.content_class}
<td style={{ padding: '6px 12px', width: '45%' }}>
<span style={{ color: isCanaryClass(w.content_class) ? '#ffaa66' : 'inherit' }}>
{contentClassLabel(w.content_class)}
</span>
<span className="mono" style={{
marginLeft: 8, fontSize: '0.7rem', color: 'var(--dim-color)',
}}>
{w.content_class}
</span>
</td>
<td style={{ padding: '6px 12px', width: '30%' }}>
<input