[PR #1440] [CLOSED] Fix message edit persistence #5089

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1440
Author: @cha1latte
Created: 5/27/2026
Status: ❌ Closed

Base: refactor ← Head: fix/refactor-issue-1430-message-edit


📝 Commits (2)

  • ee222b5 Fix message edit persistence
  • 1f1b3dd Make message edit swipe sync atomic

📊 Changes

4 files changed (+157 additions, -5 deletions)

View changed files

📝 src-tauri/crates/storage/src/lib.rs (+16 -2)
📝 src-tauri/src/commands/storage/commands/entities.rs (+4 -3)
📝 src-tauri/src/commands/storage/shared.rs (+134 -0)
📝 src-tauri/src/http_dispatch.rs (+3 -0)

📄 Description

Linked issue

Closes #1430

Why this change

  • Conversation message edits were saved as a messages.content patch, but message readback materializes content from the active swipe. That left the edited top-level content overwritten by stale swipe content on reload/list/read.

What changed

  • Added a storage-layer patch_with hook so message edits can apply the base patch and active-swipe content synchronization under one storage write lock.
  • Route message updates through the same atomic helper in both embedded Tauri storage commands and the remote runtime HTTP dispatch path.
  • Add Rust coverage for active-swipe edit persistence and a legacy no-swipes negative row.

Refactor impact

Primary owner:

Rust storage

Impact areas reviewed:

  • Embedded storage_update
  • Remote runtime /api/invoke storage_update
  • Message materialization from active swipes
  • Legacy message rows without swipes
  • Storage patch locking behavior for the message edit path

Boundary notes:

  • Kept the fix in Rust storage/shared dispatch; no React, engine, or shared API boundary changes.
  • Non-message entity updates still use the existing generic update normalization.

Pressure points touched:

  • Rust storage command update path
  • Remote runtime dispatch update path
  • FileStorage::patch_with shared storage primitive

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Reproduced before fix with node scratch\issue-1430-storage-repro.mjs: after storage_update, both storage_get and storage_list still returned message actions baseline from the stale active swipe.
  • Verified after final CodeRabbit follow-up with node scratch\issue-1430-storage-repro.mjs --expect-fixed against a freshly restarted local remote runtime: storage_get, storage_list, and active swipe content all returned message actions edited.
  • Ran cargo test --manifest-path src-tauri/Cargo.toml message_content_update_patch --lib after the atomic storage follow-up: passed.
  • Ran cargo clippy --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warnings after the atomic storage follow-up: passed.
  • Ran pnpm check after the atomic storage follow-up: passed.
  • Ran graphify update .; the command completed, but the generated graphify-out cache/report diff was reverted from this PR because it rewrote stale generated output unrelated to the narrow storage fix.
  • Ran Bunny/maintainer pass: diff is two commits, four source files, no unrelated working-tree files, no server console.*, git diff --check passed, and scratch/bugfix-verification.json proof gate passed locally.
  • Addressed CodeRabbit's read-then-write concurrency concern by moving active-swipe synchronization into FileStorage::patch_with; the original inline thread is now outdated.

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

  • Not applicable; this is a storage persistence bug with runtime command proof rather than a visible UI rendering change.

🔄 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/1440 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/27/2026 **Status:** ❌ Closed **Base:** `refactor` ← **Head:** `fix/refactor-issue-1430-message-edit` --- ### 📝 Commits (2) - [`ee222b5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/ee222b58bf6df6edec37111af36cb45114cb7756) Fix message edit persistence - [`1f1b3dd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1f1b3ddac9e61e684ceeace515951fe71893f0a7) Make message edit swipe sync atomic ### 📊 Changes **4 files changed** (+157 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/crates/storage/src/lib.rs` (+16 -2) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+4 -3) 📝 `src-tauri/src/commands/storage/shared.rs` (+134 -0) 📝 `src-tauri/src/http_dispatch.rs` (+3 -0) </details> ### 📄 Description ## Linked issue Closes #1430 ## Why this change - Conversation message edits were saved as a `messages.content` patch, but message readback materializes `content` from the active swipe. That left the edited top-level content overwritten by stale swipe content on reload/list/read. ## What changed - Added a storage-layer `patch_with` hook so message edits can apply the base patch and active-swipe content synchronization under one storage write lock. - Route message updates through the same atomic helper in both embedded Tauri storage commands and the remote runtime HTTP dispatch path. - Add Rust coverage for active-swipe edit persistence and a legacy no-swipes negative row. ## Refactor impact Primary owner: Rust storage Impact areas reviewed: - Embedded `storage_update` - Remote runtime `/api/invoke` `storage_update` - Message materialization from active swipes - Legacy message rows without swipes - Storage patch locking behavior for the message edit path Boundary notes: - Kept the fix in Rust storage/shared dispatch; no React, engine, or shared API boundary changes. - Non-message entity updates still use the existing generic update normalization. Pressure points touched: - Rust storage command update path - Remote runtime dispatch update path - `FileStorage::patch_with` shared storage primitive ## Validation - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Reproduced before fix with `node scratch\issue-1430-storage-repro.mjs`: after `storage_update`, both `storage_get` and `storage_list` still returned `message actions baseline` from the stale active swipe. - Verified after final CodeRabbit follow-up with `node scratch\issue-1430-storage-repro.mjs --expect-fixed` against a freshly restarted local remote runtime: `storage_get`, `storage_list`, and active swipe content all returned `message actions edited`. - Ran `cargo test --manifest-path src-tauri/Cargo.toml message_content_update_patch --lib` after the atomic storage follow-up: passed. - Ran `cargo clippy --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warnings` after the atomic storage follow-up: passed. - Ran `pnpm check` after the atomic storage follow-up: passed. - Ran `graphify update .`; the command completed, but the generated `graphify-out` cache/report diff was reverted from this PR because it rewrote stale generated output unrelated to the narrow storage fix. - Ran Bunny/maintainer pass: diff is two commits, four source files, no unrelated working-tree files, no server `console.*`, `git diff --check` passed, and `scratch/bugfix-verification.json` proof gate passed locally. - Addressed CodeRabbit's read-then-write concurrency concern by moving active-swipe synchronization into `FileStorage::patch_with`; the original inline thread is now outdated. ## 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 - Not applicable; this is a storage persistence bug with runtime command proof rather than a visible UI rendering change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:13:09 +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#5089
No description provided.