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

@@ -0,0 +1,39 @@
/* Human-readable labels for realism content classes.
*
* Source of truth for the enum values is decnet/realism/taxonomy.py.
* This module is the only place display text lives — every UI surface
* that renders a content_class should call ``contentClassLabel(value)``
* so the label vocabulary stays consistent across the dashboard. */
const LABELS: Record<string, string> = {
// User classes — files written by personas during work hours.
note: 'Note',
todo: 'TODO List',
draft: 'Draft Document',
script: 'Shell / Python Script',
// System classes — plausible OS-side filler.
log_cron: 'Cron Log',
log_daemon: 'Daemon Log',
cache_tmp: 'Cache / Temp File',
// Canary classes — callback-bearing artifacts.
canary_aws_creds: 'Canary · AWS Credentials',
canary_env_file: 'Canary · .env File',
canary_git_config: 'Canary · git config',
canary_ssh_key: 'Canary · SSH Private Key',
canary_honeydoc: 'Canary · HTML Honeydoc',
canary_honeydoc_docx: 'Canary · DOCX Honeydoc',
canary_honeydoc_pdf: 'Canary · PDF Honeydoc',
canary_mysql_dump: 'Canary · MySQL Dump',
};
export function contentClassLabel(value: string): string {
return LABELS[value] ?? value;
}
/* Returns true when the value is a canary class. Used to style canary
* rows differently in tables (subtle red accent, etc). */
export function isCanaryClass(value: string): boolean {
return value.startsWith('canary_');
}