[GH-ISSUE #1550] [Issue]: Deleting a lorebook leaves orphaned entries and folders #792

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

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

Originally assigned to: @Promansis on GitHub.

Summary

Deleting a lorebook removes the lorebook record but leaves its lorebook-entries and lorebook-folders rows behind with the deleted lorebookId.

Expected behavior

Deleting a lorebook should also delete or otherwise clean up its child entries and folders. This matches the catalog UI confirmation copy that says all entries inside the lorebook will be lost.

Actual behavior

Native Tauri QA on origin/refactor created a disposable lorebook with one folder and one entry, then deleted the lorebook through the same storage delete path used by the catalog hooks. The lorebook was gone, but querying lorebook-entries and lorebook-folders by the deleted lorebookId still returned the child records.

Steps to reproduce

  1. Create a lorebook.
  2. Create at least one folder and one entry with lorebookId set to that lorebook.
  3. Delete the lorebook from the catalog, or call storage_delete / storageApi.delete("lorebooks", id).
  4. Query lorebook-entries and lorebook-folders filtered by the deleted lorebook id.
  5. Observe that the child rows remain orphaned.

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: origin/refactor at f120eb33
  • Run mode: Tauri desktop
  • OS + version: Windows desktop, exact version not captured
  • Node + pnpm versions: Node v24.16.0, pnpm 10.33.2
  • Rust version, if relevant: rustc 1.95.0
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No public screenshot needed. Native QA proof showed storageApi.delete("lorebooks", id) returning { "deleted": true }; storageApi.get("lorebooks", id) then returned null, while filtered lorebook-entries and lorebook-folders still returned rows with the deleted lorebookId.

Regression notes

Not checked against an older branch. This was found during a fresh Lorebooks native QA pass on the current refactor branch.

Additional context

Likely owner is the storage delete path for lorebooks, not just the React catalog hook. src-tauri/src/commands/storage/commands/entities.rs has special cascading behavior for chats, but no equivalent cleanup for lorebooks was observed in the delete path.

Acceptance criteria:

  • Deleting a lorebook removes its child lorebook-entries and lorebook-folders, or safely archives/marks them in a way that cannot leak into later scans/import/export results.
  • Add regression coverage for deleting a lorebook with child entries and folders.
  • Confirm bulk delete from catalog selection uses the same fixed behavior.

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 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1550 Originally assigned to: @Promansis on GitHub. ## Summary Deleting a lorebook removes the lorebook record but leaves its `lorebook-entries` and `lorebook-folders` rows behind with the deleted `lorebookId`. ## Expected behavior Deleting a lorebook should also delete or otherwise clean up its child entries and folders. This matches the catalog UI confirmation copy that says all entries inside the lorebook will be lost. ## Actual behavior Native Tauri QA on `origin/refactor` created a disposable lorebook with one folder and one entry, then deleted the lorebook through the same storage delete path used by the catalog hooks. The lorebook was gone, but querying `lorebook-entries` and `lorebook-folders` by the deleted `lorebookId` still returned the child records. ## Steps to reproduce 1. Create a lorebook. 2. Create at least one folder and one entry with `lorebookId` set to that lorebook. 3. Delete the lorebook from the catalog, or call `storage_delete` / `storageApi.delete("lorebooks", id)`. 4. Query `lorebook-entries` and `lorebook-folders` filtered by the deleted lorebook id. 5. Observe that the child rows remain orphaned. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] 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 - [x] 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: `origin/refactor` at `f120eb33` - Run mode: Tauri desktop - OS + version: Windows desktop, exact version not captured - Node + pnpm versions: Node `v24.16.0`, pnpm `10.33.2` - Rust version, if relevant: `rustc 1.95.0` - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No public screenshot needed. Native QA proof showed `storageApi.delete("lorebooks", id)` returning `{ "deleted": true }`; `storageApi.get("lorebooks", id)` then returned `null`, while filtered `lorebook-entries` and `lorebook-folders` still returned rows with the deleted `lorebookId`. ## Regression notes Not checked against an older branch. This was found during a fresh Lorebooks native QA pass on the current refactor branch. ## Additional context Likely owner is the storage delete path for `lorebooks`, not just the React catalog hook. `src-tauri/src/commands/storage/commands/entities.rs` has special cascading behavior for chats, but no equivalent cleanup for lorebooks was observed in the delete path. Acceptance criteria: - Deleting a lorebook removes its child `lorebook-entries` and `lorebook-folders`, or safely archives/marks them in a way that cannot leak into later scans/import/export results. - Add regression coverage for deleting a lorebook with child entries and folders. - Confirm bulk delete from catalog selection uses the same fixed behavior. ## 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:33:27 +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#792
No description provided.