[PR #1905] [MERGED] Centralize refactor storage contracts #5342

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

📋 Pull Request Information

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

Base: refactor ← Head: storage-contract-registry-1893


📝 Commits (2)

  • d88a189 storage: centralize refactor collection contracts
  • 447914c Merge upstream refactor into storage contracts

📊 Changes

7 files changed (+705 additions, -239 deletions)

View changed files

📝 src-tauri/src/commands/storage.rs (+2 -0)
📝 src-tauri/src/commands/storage/commands/entities.rs (+3 -39)
➕ src-tauri/src/commands/storage/contracts.rs (+580 -0)
📝 src-tauri/src/commands/storage/profile.rs (+14 -51)
📝 src-tauri/src/commands/storage/shared.rs (+23 -129)
📝 src-tauri/src/http_dispatch.rs (+81 -0)
📝 src-tauri/src/state.rs (+2 -20)

📄 Description

Linked issue

Closes #1893

Why this change

  • Refactor storage contracts were split across startup repair, shared storage normalization, profile export/import coverage, entity command create/update behavior, and remote /api/invoke write handling.
  • Remote storage create/update duplicated embedded command logic, so connection defaultForAgents exclusivity and default chat preset mutation guards could diverge between embedded and hostable runtime writes.

What changed

  • Added a Rust storage contract registry for supported collections, profile inclusion, startup JSON repair, typed JSON fields, create-default fields, and delete cleanup metadata.
  • Moved profile export/import coverage and startup JSON repair collection coverage onto the registry.
  • Replaced the typed JSON normalization collection switch with registry-backed field metadata.
  • Routed remote storage_create and storage_update through the same entity command helpers used by embedded Tauri commands.
  • Added remote dispatch coverage for connection agent-default exclusivity and default chat preset mutation rejection.

Refactor impact

Primary owner:

Rust storage and remote runtime dispatch.

Impact areas reviewed:

  • Tauri storage entity commands
  • Hostable /api/invoke storage write dispatch
  • Profile export/import collection coverage
  • Startup storage JSON repair
  • Typed JSON normalization

Boundary notes:

  • Product-specific entity write behavior remains in storage entity command helpers.
  • The HTTP dispatch path now delegates to those helpers instead of duplicating command behavior.
  • No React, engine, or shared API imports were added.

Pressure points touched:

  • Remote runtime /api/invoke dispatch for storage_create and storage_update.

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 check --manifest-path src-tauri/Cargo.toml
  • cargo test --manifest-path src-tauri/Cargo.toml dispatch_storage_
  • cargo test --manifest-path src-tauri/Cargo.toml registry_
  • pnpm check:architecture
  • 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 contract and remote write parity refactor; no new user-discoverable surface.

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 changes.


🔄 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/1905 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `storage-contract-registry-1893` --- ### 📝 Commits (2) - [`d88a189`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d88a18900a043c50ba615b9149f7506c6ea4123e) storage: centralize refactor collection contracts - [`447914c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/447914cba6b910b3d08fd2cad2286ffaa2af5939) Merge upstream refactor into storage contracts ### 📊 Changes **7 files changed** (+705 additions, -239 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage.rs` (+2 -0) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+3 -39) ➕ `src-tauri/src/commands/storage/contracts.rs` (+580 -0) 📝 `src-tauri/src/commands/storage/profile.rs` (+14 -51) 📝 `src-tauri/src/commands/storage/shared.rs` (+23 -129) 📝 `src-tauri/src/http_dispatch.rs` (+81 -0) 📝 `src-tauri/src/state.rs` (+2 -20) </details> ### 📄 Description ## Linked issue Closes #1893 ## Why this change - Refactor storage contracts were split across startup repair, shared storage normalization, profile export/import coverage, entity command create/update behavior, and remote `/api/invoke` write handling. - Remote storage create/update duplicated embedded command logic, so connection `defaultForAgents` exclusivity and default chat preset mutation guards could diverge between embedded and hostable runtime writes. ## What changed - Added a Rust storage contract registry for supported collections, profile inclusion, startup JSON repair, typed JSON fields, create-default fields, and delete cleanup metadata. - Moved profile export/import coverage and startup JSON repair collection coverage onto the registry. - Replaced the typed JSON normalization collection switch with registry-backed field metadata. - Routed remote `storage_create` and `storage_update` through the same entity command helpers used by embedded Tauri commands. - Added remote dispatch coverage for connection agent-default exclusivity and default chat preset mutation rejection. ## Refactor impact Primary owner: Rust storage and remote runtime dispatch. Impact areas reviewed: - Tauri storage entity commands - Hostable `/api/invoke` storage write dispatch - Profile export/import collection coverage - Startup storage JSON repair - Typed JSON normalization Boundary notes: - Product-specific entity write behavior remains in storage entity command helpers. - The HTTP dispatch path now delegates to those helpers instead of duplicating command behavior. - No React, engine, or shared API imports were added. Pressure points touched: - Remote runtime `/api/invoke` dispatch for `storage_create` and `storage_update`. ## 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 check --manifest-path src-tauri/Cargo.toml` - `cargo test --manifest-path src-tauri/Cargo.toml dispatch_storage_` - `cargo test --manifest-path src-tauri/Cargo.toml registry_` - `pnpm check:architecture` - `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 contract and remote write parity refactor; no new user-discoverable surface. ## 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 changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:15:24 +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#5342
No description provided.