feat(admin): collapsible JSON viewer for utterance meta#38
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Detail pages render JSONB
metaas a single flatjson.dumpsblob — a generation snapshot with a week of chat history is effectively unreadable.What
app/console/static/json_viewer.js, served from/console/static/— self-hosted to match SQLAdmin's no-CDN asset pattern._fmt_meta_detailnow returnsMarkup: dict/list meta values render as a collapsible JSON tree (expanded one level, toolbar with copy/expand-all), scalars stay as labelledkey: valuelines. Same friendly labels (e.g. "Generation Snapshot") kept.markupsafebefore 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