Skip to content

feat(admin): collapsible JSON viewer for utterance meta#38

Merged
1xabhay merged 1 commit into
mainfrom
feat/admin-json-viewer
Jun 11, 2026
Merged

feat(admin): collapsible JSON viewer for utterance meta#38
1xabhay merged 1 commit into
mainfrom
feat/admin-json-viewer

Conversation

@1xabhay

@1xabhay 1xabhay commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Why

Detail pages render JSONB meta as a single flat json.dumps blob — a generation snapshot with a week of chat history is effectively unreadable.

What

  • Vendor @andypf/json-viewer 2.1.1 (32K zero-dependency web component) at app/console/static/json_viewer.js, served from /console/static/ — self-hosted to match SQLAdmin's no-CDN asset pattern.
  • _fmt_meta_detail now returns Markup: dict/list meta values render as a collapsible JSON tree (expanded one level, toolbar with copy/expand-all), scalars stay as labelled key: value lines. Same friendly labels (e.g. "Generation Snapshot") kept.
  • Applied to Utterance, Speaker, Conversation, and AdminExport detail views (AdminExport previously had no formatter at all).
  • JSON payloads are escaped via markupsafe before embedding — user-authored SMS text inside snapshots can't inject markup (covered by a dedicated XSS test).

Testing

206 tests pass; new tests cover the collapsible rendering, scalar lines, escaping of user content, empty meta, and the static route serving the vendored JS.

🤖 Generated with Claude Code

Utterance/Speaker/Conversation/AdminExport detail pages rendered JSONB
meta as one flat escaped json.dumps blob — unreadable for generation
snapshots with 30+ history turns. Vendor @andypf/json-viewer (32K IIFE
web component, self-hosted under /console/static to match SQLAdmin's
no-CDN asset pattern) and emit it from the meta detail formatter:
dict/list values become a collapsible tree (expanded one level, with
toolbar), scalars stay as labelled lines. JSON payloads pass through
markupsafe escaping, so user-authored SMS content in snapshots cannot
inject markup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@1xabhay 1xabhay merged commit 1e61857 into main Jun 11, 2026
1 check passed
@1xabhay 1xabhay deleted the feat/admin-json-viewer branch June 11, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant