[PR #2309] [MERGED] Fix chat storage parity gaps #5529

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/message-create-default-extra


📝 Commits (1)

  • eeeaf8c Fix chat folder storage semantics

📊 Changes

3 files changed (+1138 additions, -6 deletions)

View changed files

📝 src-tauri/src/commands/storage/commands/entities.rs (+1126 -3)
📝 src-tauri/src/commands/storage/contracts.rs (+7 -3)
📝 src-tauri/src/commands/storage/shared.rs (+5 -0)

📄 Description

Linked issue

Part of #2268.
Closes #2271.
Closes #2272.

Why this change

  • Target 9 chat/message parity found two storage gaps: chat folders lost legacy defaults/order/delete cleanup/move validation, and created messages could persist empty extra objects instead of legacy default leaves.

What changed

  • Restored chat-folder create defaults, top insertion ordering, delete cleanup that reparents child chats to folderId: null, and missing-folder validation for chat moves.
  • Seeded legacy default message extra leaves on Rust message creation and shared API message create bodies without overwriting caller-provided metadata.
  • Aligned optimistic chat message cache shape with the same isGenerated role rule.
  • Added focused Rust coverage for chat-folder create/delete/move validation and message default extra seeding.

Refactor impact

Primary owner:

Rust storage and shared API.

Impact areas reviewed:

  • Chat folder generic storage create/update/delete paths.
  • Chat message create path through shared API and Rust message sidecar materialization.
  • Embedded Tauri and remote/shared API command parity, since both route through the same generic storage command pipeline.
  • Chat catalog optimistic cache shape for created messages.

Boundary notes:

  • Product behavior remains in storage/shared API owners; React hook change only mirrors returned message shape for optimistic cache.
  • No engine-to-React, feature-to-feature, or raw remote-runtime calls were added.
  • Remote /api/invoke stays aligned because the generic storage command and shared API wrapper own the behavior.

Pressure points touched:

  • Generic Rust storage entity commands.
  • Rust storage collection contracts/defaults.
  • Shared storageApi.createChatMessage.

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

  • pnpm typecheck passed.
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passed.
  • cargo test --manifest-path src-tauri/Cargo.toml create_message_seeds_legacy_default_extra_without_overwriting_caller_extra passed.
  • cargo test --manifest-path src-tauri/Cargo.toml chat_folder passed.
  • cargo test --manifest-path src-tauri/Cargo.toml moving_chat_rejects_missing_folder passed.
  • pnpm check passed.

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 for existing chat storage behavior; no new user-discoverable feature.

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 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/2309 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Promansis](https://github.com/Promansis) **Base:** `refactor` ← **Head:** `fix/message-create-default-extra` --- ### 📝 Commits (1) - [`eeeaf8c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/eeeaf8c06fc5f3c194e4a931c06202a0a4419829) Fix chat folder storage semantics ### 📊 Changes **3 files changed** (+1138 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+1126 -3) 📝 `src-tauri/src/commands/storage/contracts.rs` (+7 -3) 📝 `src-tauri/src/commands/storage/shared.rs` (+5 -0) </details> ### 📄 Description ## Linked issue Part of #2268. Closes #2271. Closes #2272. ## Why this change - Target 9 chat/message parity found two storage gaps: chat folders lost legacy defaults/order/delete cleanup/move validation, and created messages could persist empty `extra` objects instead of legacy default leaves. ## What changed - Restored chat-folder create defaults, top insertion ordering, delete cleanup that reparents child chats to `folderId: null`, and missing-folder validation for chat moves. - Seeded legacy default message `extra` leaves on Rust message creation and shared API message create bodies without overwriting caller-provided metadata. - Aligned optimistic chat message cache shape with the same `isGenerated` role rule. - Added focused Rust coverage for chat-folder create/delete/move validation and message default extra seeding. ## Refactor impact Primary owner: Rust storage and shared API. Impact areas reviewed: - Chat folder generic storage create/update/delete paths. - Chat message create path through shared API and Rust message sidecar materialization. - Embedded Tauri and remote/shared API command parity, since both route through the same generic storage command pipeline. - Chat catalog optimistic cache shape for created messages. Boundary notes: - Product behavior remains in storage/shared API owners; React hook change only mirrors returned message shape for optimistic cache. - No engine-to-React, feature-to-feature, or raw remote-runtime calls were added. - Remote `/api/invoke` stays aligned because the generic storage command and shared API wrapper own the behavior. Pressure points touched: - Generic Rust storage entity commands. - Rust storage collection contracts/defaults. - Shared `storageApi.createChatMessage`. ## 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 - `pnpm typecheck` passed. - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passed. - `cargo test --manifest-path src-tauri/Cargo.toml create_message_seeds_legacy_default_extra_without_overwriting_caller_extra` passed. - `cargo test --manifest-path src-tauri/Cargo.toml chat_folder` passed. - `cargo test --manifest-path src-tauri/Cargo.toml moving_chat_rejects_missing_folder` passed. - `pnpm check` passed. ## 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: - Bugfix for existing chat storage behavior; no new user-discoverable feature. ## Docs and release impact - [x] 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 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:17:06 +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#5529
No description provided.