mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1408] Apply the parseChatCharacterIds runtime-cast pattern to message.extra and chat.metadata consumers #698
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#698
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Romuromylus on GitHub (May 27, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1408
Why
#1407 collapsed the slim
Chattype duplicate infeatures/catalog/chats/types.tsonto the canonical engine type. To preserve the existingparseChatCharacterIdsruntime defense against SQLite serialization handing back JSON-stringified arrays, that PR added one local widening cast atsrc/features/modes/shared/chat-ui/hooks/use-chat-surface-data.ts:54.The same rationale applies to two other fields that are typed as strict objects on the engine but pass through the same
normalize_typed_json_fieldscodepath insrc-tauri/src/commands/storage/shared.rs(only normalized on write, not on read). Several consumers still have defensivetypeof X === "string" ? JSON.parse(...) : Xbranches that are now type-unreachable under the engine contract:message.extrasrc/features/modes/shared/chat-ui/hooks/use-chat-timeline-actions.ts:37-44src/features/modes/shared/chat-ui/hooks/use-sprite-metadata-state.ts:24-30src/features/modes/shared/chat-ui/components/ChatMessage.tsx:920-922chat.metadatasrc/features/modes/shared/chat-ui/components/SummariesEditorModal.tsx:115src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx:264,330What to decide
Three reasonable directions. Each has trade-offs:
parseChatCharacterIdsgot in #1407. Minimal change, keeps the runtime fallback honest. Localizes the trade-off to consumers.normalize_json_array_fieldsandnormalize_nullable_json_object_fields(shared.rs:178,184) already coerce columns to typed shapes on write, and that any pre-refactor legacy data already passes throughimport_legacy_profile_tables_with_restored_assetswhich applies the same normalization. Risk: any unmigrated runtime path that bypasses the importer would crash on the dead branch's absence.Option 2 feels most aligned with the engine-contract direction the refactor branch has been moving in, but it touches the storage capability rather than UI code.
Acceptance
message.extrathat arrives as a JSON string and asserts the consumer reads the parsed object).Linked
Refs #1344 (parent audit), follow-up to #1407.
@SpicyMarinara commented on GitHub (May 27, 2026):
Implemented in refactor commit
a49f3fb4. Storage reads now normalize JSON-stringified chat.metadata and message.extra at the storage API boundary, the individual ad hoc parser sites were collapsed back to object reads, and storage-api tests cover round-tripping both shapes.