[PR #2046] [MERGED] Move storage cleanup and defaults into contracts #5410

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2046
Author: @Xelvanis
Created: 6/3/2026
Status: ✅ Merged
Merged: 6/3/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/storage-contract-registry-actions


📝 Commits (1)

  • 12c5fd1 Move delete cleanup and create defaults to contracts

📊 Changes

2 files changed (+420 additions, -228 deletions)

View changed files

📝 src-tauri/src/commands/storage/commands/entities.rs (+278 -28)
📝 src-tauri/src/commands/storage/shared.rs (+142 -200)

📄 Description

Linked issue

Closes #2006

Why this change

  • Storage create defaults and delete cleanup were still executed through inline entity-name branching even though the collection contract registry already describes those behaviors.

What changed

  • Added contract-driven delete cleanup dispatch for registered storage cleanup actions.
  • Applied registered create_default_fields through with_entity_defaults.
  • Added Rust coverage for registered create defaults, delete cleanup actions, and hostable storage delete dispatch.

Refactor impact

Primary owner:

Rust storage commands.

Impact areas reviewed:

  • Generic storage create/delete commands.
  • Collection contract registry defaults and cleanup actions.
  • Message tracker snapshot cleanup through embedded and hostable storage delete paths.
  • Managed media cleanup for avatars, lorebook images, gallery rows, and character gallery rows.

Boundary notes:

  • Behavior stays inside src-tauri; no React, engine, or shared API boundary changes.
  • Hostable HTTP dispatch continues through the existing storage command path and is covered by focused dispatch tests.

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

  • git diff --check origin/refactor...HEAD
  • cargo test --manifest-path src-tauri/Cargo.toml registered_create_defaults_are_executable
  • cargo test --manifest-path src-tauri/Cargo.toml deleting_
  • cargo test --manifest-path src-tauri/Cargo.toml dispatch_storage_delete
  • pnpm check

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:

  • Internal Rust storage wiring only; no new user-discoverable feature, workflow, setting, mode, panel, import path, media capability, or advanced tool.

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

Reason:

  • No docs or release-note change needed because this keeps existing storage create/delete behavior contract-driven without changing user-facing workflows.

UI evidence

N/A; no visible UI changes.

Summary by CodeRabbit

  • Refactor

    • Entity deletion cleanup now uses a contract-driven architecture for consistency
    • Default field creation for collections now uses contracts instead of hardcoded logic
  • Tests

    • Extended test coverage for deletion cleanup behaviors and default field creation across all collection types

🔄 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/2046 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/storage-contract-registry-actions` --- ### 📝 Commits (1) - [`12c5fd1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/12c5fd16281802684681aa4de1eac689d36b3ffd) Move delete cleanup and create defaults to contracts ### 📊 Changes **2 files changed** (+420 additions, -228 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+278 -28) 📝 `src-tauri/src/commands/storage/shared.rs` (+142 -200) </details> ### 📄 Description ## Linked issue Closes #2006 ## Why this change - Storage create defaults and delete cleanup were still executed through inline entity-name branching even though the collection contract registry already describes those behaviors. ## What changed - Added contract-driven delete cleanup dispatch for registered storage cleanup actions. - Applied registered `create_default_fields` through `with_entity_defaults`. - Added Rust coverage for registered create defaults, delete cleanup actions, and hostable storage delete dispatch. ## Refactor impact Primary owner: Rust storage commands. Impact areas reviewed: - Generic storage create/delete commands. - Collection contract registry defaults and cleanup actions. - Message tracker snapshot cleanup through embedded and hostable storage delete paths. - Managed media cleanup for avatars, lorebook images, gallery rows, and character gallery rows. Boundary notes: - Behavior stays inside `src-tauri`; no React, engine, or shared API boundary changes. - Hostable HTTP dispatch continues through the existing storage command path and is covered by focused dispatch tests. Pressure points touched: - None. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `git diff --check origin/refactor...HEAD` - `cargo test --manifest-path src-tauri/Cargo.toml registered_create_defaults_are_executable` - `cargo test --manifest-path src-tauri/Cargo.toml deleting_` - `cargo test --manifest-path src-tauri/Cargo.toml dispatch_storage_delete` - `pnpm check` ## 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. - [x] 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: - Internal Rust storage wiring only; no new user-discoverable feature, workflow, setting, mode, panel, import path, media capability, or advanced tool. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims Reason: - No docs or release-note change needed because this keeps existing storage create/delete behavior contract-driven without changing user-facing workflows. ## UI evidence N/A; no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Entity deletion cleanup now uses a contract-driven architecture for consistency * Default field creation for collections now uses contracts instead of hardcoded logic * **Tests** * Extended test coverage for deletion cleanup behaviors and default field creation across all collection types <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <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:03 +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#5410
No description provided.