[GH-ISSUE #2161] [Issue]: parseCharacterDisplayData drops JSON-string parsing and try/catch guard (name resolves to Unknown) #1070

Closed
opened 2026-10-21 05:26:18 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Romuromylus on GitHub (Jun 4, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2161

Originally assigned to: @cha1latte on GitHub.

Summary

The display-name resolver in the refactor only handles raw.data when it is already an object. The legacy version also parsed raw.data when it arrived as a JSON string and wrapped resolution in try/catch so malformed payloads fell back to "Unknown" instead of silently losing the name.

Expected behavior

Given a character whose data is a JSON string (e.g. an unparsed DB/cache row), parseCharacterDisplayData should JSON.parse it and resolve the real name, falling back to "Unknown" only on genuine failure.

Actual behavior

The refactor does raw.data && typeof raw.data === "object" only; a string data value is treated as non-object and the name resolves to "Unknown". The string path is still a live case in the refactor: sibling callers (ChatSettingsDrawer.tsx:1057, CreatorNotesCssInjector.tsx:51) still defensively run typeof char.data === "string" ? JSON.parse(char.data) : char.data on the same objects.

Steps to reproduce

  1. Reach parseCharacterDisplayData with a character object whose data field is a JSON string (TTS config, tracker color manager, chat surface, setup wizards).
  2. The character's name displays as "Unknown" instead of the real name.

Impact area

  • Catalog resources
  • Shared API wrapper or remote runtime routing

Environment

  • Branch or commit: refactor @ 93555d4b
  • Run mode: Tauri desktop
  • OS + version: Windows 11
  • Node + pnpm versions: n/a (static parity audit, main vs refactor)
  • Rust version, if relevant: n/a
  • Remote Runtime URL configured? not relevant

Regression notes

Worked in legacy (main @ c49f1d95). main: packages/client/src/lib/character-display.ts:51-62 (try/catch + typeof raw.data === "string" ? JSON.parse(raw.data) : raw.data). refactor @ 93555d4b: src/shared/lib/character-display.ts:120-126 dropped both the JSON.parse and the try/catch.

Originally created by @Romuromylus on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2161 Originally assigned to: @cha1latte on GitHub. ## Summary The display-name resolver in the refactor only handles `raw.data` when it is already an object. The legacy version also parsed `raw.data` when it arrived as a JSON string and wrapped resolution in try/catch so malformed payloads fell back to "Unknown" instead of silently losing the name. ## Expected behavior Given a character whose `data` is a JSON string (e.g. an unparsed DB/cache row), `parseCharacterDisplayData` should `JSON.parse` it and resolve the real name, falling back to "Unknown" only on genuine failure. ## Actual behavior The refactor does `raw.data && typeof raw.data === "object"` only; a string `data` value is treated as non-object and the name resolves to "Unknown". The string path is still a live case in the refactor: sibling callers (`ChatSettingsDrawer.tsx:1057`, `CreatorNotesCssInjector.tsx:51`) still defensively run `typeof char.data === "string" ? JSON.parse(char.data) : char.data` on the same objects. ## Steps to reproduce 1. Reach `parseCharacterDisplayData` with a character object whose `data` field is a JSON string (TTS config, tracker color manager, chat surface, setup wizards). 2. The character's name displays as "Unknown" instead of the real name. ## Impact area - [x] Catalog resources - [x] Shared API wrapper or remote runtime routing ## Environment - Branch or commit: refactor @ 93555d4b - Run mode: Tauri desktop - OS + version: Windows 11 - Node + pnpm versions: n/a (static parity audit, main vs refactor) - Rust version, if relevant: n/a - Remote Runtime URL configured? not relevant ## Regression notes Worked in legacy (main @ c49f1d95). main: `packages/client/src/lib/character-display.ts:51-62` (try/catch + `typeof raw.data === "string" ? JSON.parse(raw.data) : raw.data`). refactor @ 93555d4b: `src/shared/lib/character-display.ts:120-126` dropped both the JSON.parse and the try/catch.
bsakaguchi 2026-10-21 05:26:18 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1070
No description provided.