[GH-ISSUE #4646] [Issue]: Persona API exposes serialized storage fields and inconsistent contracts #2542

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

Originally created by @Xelvanis on GitHub (Aug 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4646

Originally assigned to: @SpicyMarinara on GitHub.

Summary

The Persona HTTP API exposes several file-storage JSON fields as serialized strings even though the application treats them as structured values. Clients compensate with duplicated local Persona types and inconsistent parsers, which makes reads and writes asymmetric and has caused silent field-loss bugs.

Expected behavior

Persona API responses should follow one shared decoded Persona contract: structured fields should arrive as arrays, objects, or nullable values rather than storage strings. Built-in callers should send decoded values, the server should validate them, and serialization should happen only at the server/storage boundary.

Legacy persisted rows and imported files should continue to decode safely without changing the file-table storage format.

Actual behavior

  • Persona list, detail, active, and mutation responses can expose storage-shaped strings for fields such as trackerCardColors, personaStats, tags, savedStatusOptions, convoBehavior, and avatarCrop.
  • Different client files define their own partial Persona response types and parse different subsets of those fields.
  • Built-in callers manually serialize structured writes, while server routes largely cast request bodies instead of enforcing one shared write contract.
  • Reconstructing known fields manually has caused import fidelity and nested metadata preservation bugs.

Steps to reproduce

  1. Request a Persona from the current staging API, such as GET /api/characters/personas/:id or the Persona list endpoint.
  2. Inspect the structured Persona fields listed above.
  3. Compare their serialized response values with the decoded shapes expected by shared types and individual client consumers.
  4. Trace create/update callers and observe repeated JSON.stringify logic and local response interfaces.

Environment

  • Marinara Engine version: staging at 02b111ff9
  • Install type: source
  • OS + version: Platform-independent code path; verified from a Windows source checkout
  • Browser or app shell: Browser-independent API/client contract

Logs, screenshots, or video

No runtime logs or screenshots. Confirmed through the server route/storage boundary and client caller/type traces.

Additional context

This is planned as three reviewable parts:

  1. Correctness prerequisites: preserve Persona import fields, keep optional media restore failures non-fatal after row creation, and retain nested extension metadata — draft PR #4644.
  2. Decoded reads: establish the shared decoded Persona type and project every Persona response through one server boundary.
  3. Decoded writes: validate decoded inputs, serialize only at the server/storage boundary, update callers, and remove obsolete client parsing.

Marinara ships its matching client and server together, so this does not require compatibility headers or parallel response formats. Existing serialized storage and legacy import compatibility remain in scope.

Related history: #3857 identified the broader raw-storage transport mismatch while fixing a chat symptom; #3051 and #2705 document earlier Persona import field-loss cases.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Xelvanis on GitHub (Aug 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4646 Originally assigned to: @SpicyMarinara on GitHub. <!-- task-id: persona-api-normalization-three-part --> ## Summary The Persona HTTP API exposes several file-storage JSON fields as serialized strings even though the application treats them as structured values. Clients compensate with duplicated local Persona types and inconsistent parsers, which makes reads and writes asymmetric and has caused silent field-loss bugs. ## Expected behavior Persona API responses should follow one shared decoded `Persona` contract: structured fields should arrive as arrays, objects, or nullable values rather than storage strings. Built-in callers should send decoded values, the server should validate them, and serialization should happen only at the server/storage boundary. Legacy persisted rows and imported files should continue to decode safely without changing the file-table storage format. ## Actual behavior - Persona list, detail, active, and mutation responses can expose storage-shaped strings for fields such as `trackerCardColors`, `personaStats`, `tags`, `savedStatusOptions`, `convoBehavior`, and `avatarCrop`. - Different client files define their own partial Persona response types and parse different subsets of those fields. - Built-in callers manually serialize structured writes, while server routes largely cast request bodies instead of enforcing one shared write contract. - Reconstructing known fields manually has caused import fidelity and nested metadata preservation bugs. ## Steps to reproduce 1. Request a Persona from the current staging API, such as `GET /api/characters/personas/:id` or the Persona list endpoint. 2. Inspect the structured Persona fields listed above. 3. Compare their serialized response values with the decoded shapes expected by shared types and individual client consumers. 4. Trace create/update callers and observe repeated `JSON.stringify` logic and local response interfaces. ## Environment - Marinara Engine version: staging at `02b111ff9` - Install type: source - OS + version: Platform-independent code path; verified from a Windows source checkout - Browser or app shell: Browser-independent API/client contract ## Logs, screenshots, or video No runtime logs or screenshots. Confirmed through the server route/storage boundary and client caller/type traces. ## Additional context This is planned as three reviewable parts: 1. Correctness prerequisites: preserve Persona import fields, keep optional media restore failures non-fatal after row creation, and retain nested extension metadata — draft PR #4644. 2. Decoded reads: establish the shared decoded Persona type and project every Persona response through one server boundary. 3. Decoded writes: validate decoded inputs, serialize only at the server/storage boundary, update callers, and remove obsolete client parsing. Marinara ships its matching client and server together, so this does not require compatibility headers or parallel response formats. Existing serialized storage and legacy import compatibility remain in scope. Related history: #3857 identified the broader raw-storage transport mismatch while fixing a chat symptom; #3051 and #2705 document earlier Persona import field-loss cases. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:49:50 +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#2542
No description provided.