[PR #4680] [MERGED] fix(personas): normalize decoded API responses #6468

Closed
opened 2026-10-23 04:10:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4680
Author: @Xelvanis
Created: 8/6/2026
Status: ✅ Merged
Merged: 8/6/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/persona-decoded-reads


📝 Commits (7)

  • 9169f8b refactor(personas): establish shared decoded contracts
  • 0a71567 Normalize API responses
  • 2303cec refactor(personas): remove obsolete response parsing
  • f7b5ff5 refactor(personas): type decoded response queries
  • f0109f7 refactor(personas): consume decoded panel responses
  • 467f9c4 fix(personas): validate decoded mutation responses
  • 7946444 Merge branch 'staging' into fix/persona-decoded-reads

📊 Changes

33 files changed (+729 additions, -493 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 package.json (+1 -0)
📝 packages/client/src/components/characters/CharacterLibraryView.tsx (+9 -44)
📝 packages/client/src/components/chat/ChatArea.tsx (+4 -8)
📝 packages/client/src/components/chat/ChatInput.tsx (+3 -2)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+5 -5)
📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+9 -42)
📝 packages/client/src/components/chat/ConversationInput.tsx (+3 -2)
📝 packages/client/src/components/chat/QuickPersonaSwitcher.tsx (+7 -17)
📝 packages/client/src/components/chat/QuickSwitcherMobile.tsx (+6 -15)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+5 -23)
📝 packages/client/src/components/lorebooks/LorebookEditor.tsx (+3 -3)
📝 packages/client/src/components/modals/AboutMeViewerModal.tsx (+4 -5)
📝 packages/client/src/components/noodle/NoodleHome.tsx (+5 -13)
📝 packages/client/src/components/noodle/NoodlerHome.tsx (+1 -1)
📝 packages/client/src/components/panels/PersonasPanel.tsx (+27 -59)
📝 packages/client/src/components/personas/PersonaEditor.tsx (+34 -90)
📝 packages/client/src/features/tracker-panel/hooks/use-tracker-panel-model.ts (+1 -4)
📝 packages/client/src/hooks/use-characters.ts (+22 -29)
📝 packages/client/src/hooks/use-conversation-custom-emojis.ts (+1 -1)

...and 13 more files

📄 Description

Linked issue

Related to #4646 (closed; the reporter does not have permission to reopen it)

Why this change

Persona API endpoints exposed storage-serialized JSON fields on some paths while other client code expected decoded values. That inconsistency forced callers to parse the same fields repeatedly and made ordinary Persona reads, edits, duplication, restoration, and switching vulnerable to semantic field loss.

This is the decoded-read slice of #4646. Decoded write validation and storage-boundary request normalization remain intentionally deferred to the follow-up slice, so this PR does not close the issue.

What changed

  • Distinguished serialized PersonaStorageRow values from the shared decoded Persona contract.
  • Projected every Persona-returning read and mutation response through one tolerant server normalizer.
  • Removed obsolete client response parsing and typed Persona queries as decoded values.
  • Kept the editor decoded internally while serializing the six JSON-backed fields exactly once at existing PATCH and version-snapshot boundaries.
  • Added focused regression coverage for response semantics, malformed legacy storage, mutations, versions, avatar paths, and the client write boundary.
  • Added the required Unreleased changelog entry.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated checks completed locally:

  • pnpm check
  • pnpm version:check
  • pnpm regression:persona-api-reads
  • pnpm regression:avatar-crop-contract
  • pnpm regression:avatar-delete
  • git diff --check origin/staging...HEAD

pnpm smoke:ui was attempted from clean ports but timed out while Playwright waited for its web servers. The mobile API reached port 7972, while the mobile client launcher did not spawn Vite or open port 5179; no browser assertion ran. The failed run left no listener or repository test process behind.

Manual verification notes

  • Manually verify loading, editing, saving, and reopening a Persona preserves tags, stats, saved statuses, conversation behavior, crop, and tracker-card settings.
  • Manually verify the global active Persona changes while an explicitly selected per-chat Persona remains pinned.
  • Manually verify duplicate, version restore/reset, avatar change/delete, and gallery-avatar flows.

User manually verified loading, editing, saving, and reopening a Persona correctly preserves tags, stats, saved statuses, convo behavior, and crop in the Persona Editor. Checked that a selected per-chat Persona remains pinned and is not affected by global active Persona. Verified duplicate and avatar change flows.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

CHANGELOG.md contains the required user-facing Unreleased entry. No version bump or user-documentation change is required for this internal API-contract correction.

UI evidence (if applicable)

No intended visual redesign. The user-facing effect is preservation and consistent consumption of existing Persona data.

Summary by CodeRabbit

  • New Features

    • Persona profiles now include consistent creator details, tags, status options, statistics, tracker-card settings, and conversation behavior.
    • Persona API responses provide normalized, decoded values with safe fallbacks for malformed data.
    • Persona data remains consistent across loading, editing, duplication, restoration, switching, and avatar workflows.
  • Bug Fixes

    • Improved preservation and rendering of avatar crops, descriptions, creator notes, and persona settings.
  • Tests

    • Added regression coverage for decoded Persona API reads and serialized updates.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/4680 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 8/6/2026 **Status:** ✅ Merged **Merged:** 8/6/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/persona-decoded-reads` --- ### 📝 Commits (7) - [`9169f8b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9169f8bf4b621f36e12a04a5354999c024cf46da) refactor(personas): establish shared decoded contracts - [`0a71567`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0a71567ecc1c100dea4bca4bcbcf5b1b3591312e) Normalize API responses - [`2303cec`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2303cec9d0c4f0d306858649883c9a0c750577f3) refactor(personas): remove obsolete response parsing - [`f7b5ff5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f7b5ff543bbe5a9acf85c100dcca35f097613b7f) refactor(personas): type decoded response queries - [`f0109f7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f0109f70078fab501bbf5f64fcad283d82f4af96) refactor(personas): consume decoded panel responses - [`467f9c4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/467f9c483f32a5c9eab0a544047145c298956128) fix(personas): validate decoded mutation responses - [`7946444`](https://github.com/Pasta-Devs/Marinara-Engine/commit/79464448260573352393330f1260fe86e828df49) Merge branch 'staging' into fix/persona-decoded-reads ### 📊 Changes **33 files changed** (+729 additions, -493 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `package.json` (+1 -0) 📝 `packages/client/src/components/characters/CharacterLibraryView.tsx` (+9 -44) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+4 -8) 📝 `packages/client/src/components/chat/ChatInput.tsx` (+3 -2) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+5 -5) 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+9 -42) 📝 `packages/client/src/components/chat/ConversationInput.tsx` (+3 -2) 📝 `packages/client/src/components/chat/QuickPersonaSwitcher.tsx` (+7 -17) 📝 `packages/client/src/components/chat/QuickSwitcherMobile.tsx` (+6 -15) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+5 -23) 📝 `packages/client/src/components/lorebooks/LorebookEditor.tsx` (+3 -3) 📝 `packages/client/src/components/modals/AboutMeViewerModal.tsx` (+4 -5) 📝 `packages/client/src/components/noodle/NoodleHome.tsx` (+5 -13) 📝 `packages/client/src/components/noodle/NoodlerHome.tsx` (+1 -1) 📝 `packages/client/src/components/panels/PersonasPanel.tsx` (+27 -59) 📝 `packages/client/src/components/personas/PersonaEditor.tsx` (+34 -90) 📝 `packages/client/src/features/tracker-panel/hooks/use-tracker-panel-model.ts` (+1 -4) 📝 `packages/client/src/hooks/use-characters.ts` (+22 -29) 📝 `packages/client/src/hooks/use-conversation-custom-emojis.ts` (+1 -1) _...and 13 more files_ </details> ### 📄 Description ## Linked issue Related to #4646 (closed; the reporter does not have permission to reopen it) ## Why this change Persona API endpoints exposed storage-serialized JSON fields on some paths while other client code expected decoded values. That inconsistency forced callers to parse the same fields repeatedly and made ordinary Persona reads, edits, duplication, restoration, and switching vulnerable to semantic field loss. This is the decoded-read slice of #4646. Decoded write validation and storage-boundary request normalization remain intentionally deferred to the follow-up slice, so this PR does not close the issue. ## What changed - Distinguished serialized `PersonaStorageRow` values from the shared decoded `Persona` contract. - Projected every Persona-returning read and mutation response through one tolerant server normalizer. - Removed obsolete client response parsing and typed Persona queries as decoded values. - Kept the editor decoded internally while serializing the six JSON-backed fields exactly once at existing PATCH and version-snapshot boundaries. - Added focused regression coverage for response semantics, malformed legacy storage, mutations, versions, avatar paths, and the client write boundary. - Added the required Unreleased changelog entry. ## Validation - [x] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` Automated checks completed locally: - `pnpm check` - `pnpm version:check` - `pnpm regression:persona-api-reads` - `pnpm regression:avatar-crop-contract` - `pnpm regression:avatar-delete` - `git diff --check origin/staging...HEAD` `pnpm smoke:ui` was attempted from clean ports but timed out while Playwright waited for its web servers. The mobile API reached port 7972, while the mobile client launcher did not spawn Vite or open port 5179; no browser assertion ran. The failed run left no listener or repository test process behind. ### Manual verification notes - Manually verify loading, editing, saving, and reopening a Persona preserves tags, stats, saved statuses, conversation behavior, crop, and tracker-card settings. - Manually verify the global active Persona changes while an explicitly selected per-chat Persona remains pinned. - Manually verify duplicate, version restore/reset, avatar change/delete, and gallery-avatar flows. User manually verified loading, editing, saving, and reopening a Persona correctly preserves tags, stats, saved statuses, convo behavior, and crop in the Persona Editor. Checked that a selected per-chat Persona remains pinned and is not affected by global active Persona. Verified duplicate and avatar change flows. ## Docs and release impact - [ ] No docs changes needed - [x] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `CHANGELOG.md` contains the required user-facing Unreleased entry. No version bump or user-documentation change is required for this internal API-contract correction. ## UI evidence (if applicable) No intended visual redesign. The user-facing effect is preservation and consistent consumption of existing Persona data. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Persona profiles now include consistent creator details, tags, status options, statistics, tracker-card settings, and conversation behavior. * Persona API responses provide normalized, decoded values with safe fallbacks for malformed data. * Persona data remains consistent across loading, editing, duplication, restoration, switching, and avatar workflows. * **Bug Fixes** * Improved preservation and rendering of avatar crops, descriptions, creator notes, and persona settings. * **Tests** * Added regression coverage for decoded Persona API reads and serialized updates. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:10:42 +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#6468
No description provided.