mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2500] [Feature]: Add batch message and swipe creation for transcript imports #1241
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#1241
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 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2500
What problem does this solve?
Refactor still creates imported/copied transcript messages one message at a time through
message_swipes::create_message. The new uncached append helper improves the single-message path, but imports and transcript-copy workflows still repeat message+sidecar preparation, temp-file staging, locking, backup work, and parent chat timestamp decisions for every row.Legacy had a dedicated
createMessagesBatchstorage path for this class of work. Its comments explicitly call out Windows/NTFS transaction/fsync cost and the need to preserve message timestamps, message extras, active swipe index, and full swipe lists during clone/import workflows.Proposed behavior
Add a refactor batch message+swipe creation API owned by the storage/message-swipe layer. It should accept a target chat and prepared message inputs, produce both
messagesandmessage-swipesrows, and write the affected collections in one coherent operation.Expected behavior for the batch path:
createdAt, messageextra,activeSwipeIndex, per-swipecontent, per-swipeextra, per-swipecreatedAt, and character IDs where provided.updatedAtonce using an explicit caller policy, such as latest trusted imported timestamp or fresh branch timestamp.Expected owner or impact area
Refactor branch considerations
Keep the owner in
src-tauristorage/message-swipe commands. Feature/UI callers should continue using shared command/API surfaces rather than mutatingmessage-swipesdirectly.The storage operation should respect the current refactor sidecar design: message output can be materialized for compatibility, but durable storage should keep swipes in the sidecar collection. The batch write should also avoid fake success or partial import success when rollback/cleanup fails.
Alternatives considered
Keep using repeated
create_messagecalls plus the newappend_many_uncachedshortcut. That is a useful single-message optimization, but it does not fully match legacy's batch-import surface and still spreads batch timestamp/rollback/performance concerns across import and copy callers.Additional context
Static parity evidence:
packages/server/src/services/storage/chats.storage.tshascreateMessagesBatch, including comments about Windows/NTFS cost and preserving copied/imported message+swipe metadata.packages/server/src/services/import/st-chat.importer.tsusescreateMessagesBatchfor SillyTavern chat import.packages/server/src/routes/scene.routes.tsusescreateMessagesBatchfor scene copy/export-to-standalone style workflows.src-tauri/src/commands/storage/imports/bulk_imports.rsloops over parsed rows and callsmessage_swipes::create_messageper message.src-tauri/src/commands/storage/imports/marinara_chat_bulk.rsalso loops through imported messages and callsmessage_swipes::create_messageper message.src-tauri/src/commands/storage/message_swipes.rscurrently uses the newappend_many_uncachedonly for one created message plus its swipes at a time.Related but distinct from #2301: this asks for a durable batch transcript creation surface, not only removal of full-collection deep clone/rewrite work in individual message operations.
Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: