[PR #2214] [MERGED] Reparent lorebook entries on folder delete #5476

Closed
opened 2026-10-22 04:16:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2214
Author: @Promansis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @Promansis

Base: refactor ← Head: fix/lorebook-folder-delete-reparent


📝 Commits (2)

  • ed0aa86 Reparent lorebook entries on folder delete
  • ed2a4d6 Make lorebook folder delete reparent atomic

📊 Changes

1 file changed (+221 additions, -0 deletions)

View changed files

📝 src-tauri/src/commands/storage/commands/entities.rs (+221 -0)

📄 Description

Linked issue

Closes #2187

Why this change

  • Deleting a lorebook folder removed the folder row but left child lorebook-entries.folderId values pointing at the deleted folder in storage.

What changed

  • Registers a storage delete cleanup for lorebook-folders.
  • When a folder is deleted, entries in the same lorebook and folder are patched to folderId: null.
  • Adds Rust coverage for the positive reparent path and a negative-control entry in another lorebook.

Refactor impact

Primary owner:

  • Rust storage entity delete cleanup

Impact areas reviewed:

  • Generic storage_delete cleanup dispatch
  • Lorebook folder/entry persistence invariants
  • Existing connection-folder cleanup pattern

Boundary notes:

  • The fix stays inside the Rust storage command layer, so embedded Tauri and remote runtime callers using storage_delete share the same behavior.
  • No React, engine, shared API, or remote-runtime allowlist changes were needed.

Pressure points touched:

  • None.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo test --manifest-path src-tauri/Cargo.toml deleting_lorebook_folder_reparents_entries_for_that_lorebook_only passes locally.
  • cargo check --manifest-path src-tauri/Cargo.toml passes locally.
  • pnpm check was attempted locally but stopped at check:line-endings because the working tree reports pre-existing CRLF line endings across many unrelated files before reaching architecture/frontend/Rust/docs checks.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix only; no new user-discoverable feature or workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

  • No visible UI change; storage cleanup behavior only.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2214 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/lorebook-folder-delete-reparent` --- ### 📝 Commits (2) - [`ed0aa86`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ed0aa865e10d497117260d57c6e89800d882f15b) Reparent lorebook entries on folder delete - [`ed2a4d6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ed2a4d6bfacc628996536b1032801d239e10e630) Make lorebook folder delete reparent atomic ### 📊 Changes **1 file changed** (+221 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+221 -0) </details> ### 📄 Description ## Linked issue Closes #2187 ## Why this change - Deleting a lorebook folder removed the folder row but left child `lorebook-entries.folderId` values pointing at the deleted folder in storage. ## What changed - Registers a storage delete cleanup for `lorebook-folders`. - When a folder is deleted, entries in the same lorebook and folder are patched to `folderId: null`. - Adds Rust coverage for the positive reparent path and a negative-control entry in another lorebook. ## Refactor impact Primary owner: - Rust storage entity delete cleanup Impact areas reviewed: - Generic `storage_delete` cleanup dispatch - Lorebook folder/entry persistence invariants - Existing connection-folder cleanup pattern Boundary notes: - The fix stays inside the Rust storage command layer, so embedded Tauri and remote runtime callers using `storage_delete` share the same behavior. - No React, engine, shared API, or remote-runtime allowlist changes were needed. Pressure points touched: - None. ## Validation - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo test --manifest-path src-tauri/Cargo.toml deleting_lorebook_folder_reparents_entries_for_that_lorebook_only` passes locally. - `cargo check --manifest-path src-tauri/Cargo.toml` passes locally. - `pnpm check` was attempted locally but stopped at `check:line-endings` because the working tree reports pre-existing CRLF line endings across many unrelated files before reaching architecture/frontend/Rust/docs checks. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [ ] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix only; no new user-discoverable feature or workflow. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [ ] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence - No visible UI change; storage cleanup behavior only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:40 +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#5476
No description provided.