[GH-ISSUE #1250] [Issue]: Refactor ST and direct imports can leave partial rows or files after mid-import failure #614

Closed
opened 2026-10-20 17:30:45 +07:00 by bsakaguchi · 0 comments
Owner

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

Originally assigned to: @cha1latte on GitHub.

Summary

Several import paths create storage rows or managed files before the full import succeeds and do not appear to roll those writes back on later failure. A mid-import error can leave orphaned lorebook rows, character assets, chats, messages, or partially patched chat state.

Expected behavior

Per-item imports should either complete atomically or roll back rows/files created during the failed import. Existing chat state should not be patched until branch/message import succeeds, or it should be restored if a later step fails.

Actual behavior

The audited import paths create parent rows, child rows, files, or chat patches across multiple steps without an obvious transaction/rollback boundary for later failures.

Steps to reproduce

  1. On the refactor branch, run a focused import test with an injected storage failure after an early write succeeds.
  2. Test at least one direct character/lorebook import path and one ST bulk import path.
  3. Inspect storage and managed asset files after the injected failure.
  4. Observe whether parent rows, child rows, copied files, or chat patches remain after the import returns an error.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor, identified during 2026-05-26 failpath audit
  • Run mode: Tauri/Rust import paths
  • OS + version: not OS-specific
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not captured
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

Relevant code paths:

src-tauri/src/commands/storage/imports/service.rs
src-tauri/src/commands/storage/imports/bulk_imports.rs

Audit finding:

Direct imports create lorebooks/entries and character/avatar data across multiple writes.
Bulk imports create chats/messages and patch chat state during branch import.
No rollback/transaction boundary was found around those multi-step writes.

Regression notes

Found by source inspection during the 2026-05-26 failpath audit. Needs injected-failure tests to prove the exact leftover rows/files.

Additional context

This is separate from #1161 and #1162. Those issues cover import UI/drop/cache behavior; this issue covers storage consistency after a failed import.

Template check

Please uncheck 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 (May 26, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1250 Originally assigned to: @cha1latte on GitHub. ## Summary Several import paths create storage rows or managed files before the full import succeeds and do not appear to roll those writes back on later failure. A mid-import error can leave orphaned lorebook rows, character assets, chats, messages, or partially patched chat state. ## Expected behavior Per-item imports should either complete atomically or roll back rows/files created during the failed import. Existing chat state should not be patched until branch/message import succeeds, or it should be restored if a later step fails. ## Actual behavior The audited import paths create parent rows, child rows, files, or chat patches across multiple steps without an obvious transaction/rollback boundary for later failures. ## Steps to reproduce 1. On the `refactor` branch, run a focused import test with an injected storage failure after an early write succeeds. 2. Test at least one direct character/lorebook import path and one ST bulk import path. 3. Inspect storage and managed asset files after the injected failure. 4. Observe whether parent rows, child rows, copied files, or chat patches remain after the import returns an error. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [x] Chat mode - [x] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor`, identified during 2026-05-26 failpath audit - Run mode: Tauri/Rust import paths - OS + version: not OS-specific - Node + pnpm versions: not relevant - Rust version, if relevant: not captured - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video Relevant code paths: ```text src-tauri/src/commands/storage/imports/service.rs src-tauri/src/commands/storage/imports/bulk_imports.rs ``` Audit finding: ```text Direct imports create lorebooks/entries and character/avatar data across multiple writes. Bulk imports create chats/messages and patch chat state during branch import. No rollback/transaction boundary was found around those multi-step writes. ``` ## Regression notes Found by source inspection during the 2026-05-26 failpath audit. Needs injected-failure tests to prove the exact leftover rows/files. ## Additional context This is separate from #1161 and #1162. Those issues cover import UI/drop/cache behavior; this issue covers storage consistency after a failed import. ## Template check Please uncheck 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-20 17:30:45 +07:00
  • closed this issue
  • added the
    server
    bug
    labels
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#614
No description provided.