mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1923] [Bug]: Refactor regressed legacy message swipe sidecar storage #940
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#940
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 @Xelvanis on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1923
Originally assigned to: @SpicyMarinara on GitHub.
Regression summary
This is a bug/regression against legacy Marinara behavior, not a new storage feature request.
Legacy Marinara had message swipe sidecar storage: normal message rows and alternate swipe rows lived separately, with
message_swipesstoring swipe-specific content and metadata. Refactor currently does not preserve that sidecar layout; it stores alternate swipes nested inside eachmessagesrow.That means refactor regressed the legacy storage shape that kept common message rows small and let swipe-heavy data be read only by focused swipe operations.
Expected legacy behavior
Common message list/get paths should be able to read message rows without loading full alternate swipe payloads. Swipe content and swipe-specific metadata should live in sidecar records, or an equivalent separate storage shape, and be fetched through swipe-specific operations when needed.
Legacy evidence:
packages/server/src/db/schema/chats.ts:messagesandmessage_swipeswere separate tables.packages/server/src/services/storage/chats.storage.ts: list/paginated message paths queried message rows first and fetched only swipe counts frommessage_swipes; full swipe rows were fetched through focused swipe operations such asgetSwipes,setActiveSwipe, and edit/remove helpers.Actual refactor behavior
Refactor stores message swipes nested inside each
messagesrow. Any path that needs active swipe content, active swipe extra, swipe count, or swipe previews depends on reading the row'sswipesarray, even when the caller only requested narrow message fields.This came up while fixing #1919. Projected
storage_getcan now skip unrequested top-level row fields, but message-derived swipe fields still needswipesas an internal read field. Large swipe histories can therefore keep projected message gets/list reads heavier than the legacy sidecar shape.Refactor evidence:
src-tauri/src/commands/storage/shared.rs:materialize_message_swipe_fieldsderivescontent,extra,swipeCount, andswipePreviewsfrom nestedswipes.src-tauri/src/commands/storage/commands/entities.rs: projected message list/get paths needmessage_projection_fields_for_materialization(...), which addsswipeswhen caller-visible fields depend on swipe materialization.src-tauri/crates/storage/src/lib.rs: nested projection currently cannot cheaply project array element subfields into the derived message shape;ProjectedNestedVisitor::visit_seqconsumes arrays as ignored values when projected directly, soswipeshas to be read as a full top-level field when materialization needs it.Requested fix
Restore legacy parity by moving refactor message swipes back toward a sidecar storage shape, or an equivalent layout with the same read behavior, so message rows stay small and swipe-heavy data is read only by swipe-specific operations.
Suggested target shape:
messages:id,chatId,role,characterId, activecontent,activeSwipeIndex, activeextra, timestamps, and other message metadata.messageId,index,content,extra, timestamps, and any swipe-specific metadata.storage_get/storage_listmessage response compatibility for current callers by materializingswipeCount,swipePreviews, activecontent, and activeextraat the command/service boundary./api/invokebehavior.Expected owner or impact area
Refactor branch considerations
This is user-data and storage-layout work. It should not be folded into #1919 or another narrow projection fix.
Required proof should include:
messages[].swipesdataArchitecture expectation: keep storage behavior in
src-tauri/storage capability modules. Feature/UI callers should keep using focused shared API wrappers rather than learning the physical swipe storage layout.Alternatives considered
Keep nested
swipesand optimize array projection/materialization in-place. That would be less invasive, but it still leaves every message row carrying potentially large alternate content and metadata, and it does not restore the legacy separation that already kept common message reads small.Treat #1919 as enough. That fixes projected gets for large character/resource rows and normal top-level projections, but it does not remove the nested-swipe read amplification for swipe-derived message fields.
Additional context
Related: #1919.
This is a legacy parity regression in refactor's storage shape, not a request to block the current projected
storage_getfix. The safer sequence is to land the narrow projected-get fix first, then handle this as a dedicated storage migration branch.@SpicyMarinara commented on GitHub (Jun 2, 2026):
Closing as not planned for this issue pass. Splitting message swipes into a separate physical storage shape is a large user-data migration requiring backfill, rollback/recovery, import/export/profile parity, cascade behavior, swipe CRUD proof, and embedded/remote parity. I intentionally did not fold that migration into the current regression pass. The narrower projected storage_get work remains separate (#1924); this can be reopened or refiled when we want a dedicated storage-migration branch.
@Xelvanis commented on GitHub (Jun 3, 2026):
https://github.com/Pasta-Devs/Marinara-Engine/pull/2008 Storage prep PR