[PR #1939] [CLOSED] Extract message swipes into sidecar storage #5349

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1939
Author: @Xelvanis
Created: 6/2/2026
Status: ❌ Closed

Base: refactor ← Head: feature/message-swipe-sidecar


📝 Commits (1)

  • 0f29b93 Add message swipe sidecar storage

📊 Changes

16 files changed (+2367 additions, -157 deletions)

View changed files

📝 src-tauri/src/commands/storage.rs (+2 -0)
📝 src-tauri/src/commands/storage/admin.rs (+1 -0)
📝 src-tauri/src/commands/storage/chats.rs (+170 -79)
📝 src-tauri/src/commands/storage/commands/entities.rs (+479 -58)
📝 src-tauri/src/commands/storage/contracts.rs (+9 -0)
📝 src-tauri/src/commands/storage/exports.rs (+8 -2)
📝 src-tauri/src/commands/storage/game_state_snapshots.rs (+3 -4)
📝 src-tauri/src/commands/storage/imports/bulk_imports.rs (+5 -2)
📝 src-tauri/src/commands/storage/imports/marinara_rollback.rs (+7 -0)
📝 src-tauri/src/commands/storage/imports/rollback.rs (+7 -0)
➕ src-tauri/src/commands/storage/message_swipes.rs (+1385 -0)
📝 src-tauri/src/commands/storage/profile.rs (+265 -0)
📝 src-tauri/src/commands/storage/profile/legacy.rs (+6 -1)
📝 src-tauri/src/commands/storage/shared.rs (+1 -0)
📝 src-tauri/src/http_dispatch.rs (+2 -0)
📝 src-tauri/src/state.rs (+17 -11)

📄 Description

Linked issue

Closes #1923

Why this change

  • Message swipe behavior in refactor needed to match legacy storage behavior while keeping message rows lean for the refactor generation/cache flow.
  • Embedded swipes also needed consistent migration, import/export, rollback, delete, branch, search, active-swipe handling, and UI behavior.
  • Follow-up parity review found two remaining swipe UX gaps: switching swipes did not refresh visible tracker/world-state state, and the direct jump-to-swipe control had been reduced to arrows only.

What changed

  • Added native message-swipes sidecar storage and migrates embedded message swipes into sidecar rows.
  • Materializes swipe content, previews, active extra data, and swipe counts at message read boundaries while keeping stored message rows lean.
  • Keeps parent message rows and sidecar swipe rows in sync for create, update, add, set, delete, duplicate, branch, import, export, rollback, and cleanup paths.
  • Preserves legacy edge behavior for invalid active-swipe indexes, missing or last swipe deletes, silent/inactive swipe append, search over swipe content, and old profile imports without sidecar collections.
  • Restores direct numeric jump-to-swipe input in the shared swipe control while keeping next-swipe reroll behavior.
  • Refreshes visible world-state/tracker state after active swipe switches when tracker refresh is enabled, flushing pending tracker edits first.

Refactor impact

Primary owner:

  • Rust storage/imports and shared mode chat UI.

Impact areas reviewed:

  • Chat message CRUD and timeline projection
  • Message search, filtering, and projection
  • Profile import/export and legacy profile migration
  • Import rollback and bulk import cleanup
  • Chat branch, delete, bulk delete, active swipe, and swipe UI flows
  • Game/world-state tracker snapshot swipe cleanup and visible tracker refresh
  • Embedded and remote command dispatch
  • Conversation and Roleplay shared message swipe controls

Boundary notes:

  • Product/UI code continues to use existing chat command wrappers.
  • Storage behavior stays in src-tauri; no engine-to-Tauri or feature-internal imports added.
  • Remote-capable commands remain explicitly routed through src-tauri/src/http_dispatch.rs.
  • The UI follow-up stays in shared mode chat UI and uses existing world-state API/store wrappers; no raw Tauri or remote-runtime calls added.

Pressure points touched:

  • Import modules
  • Profile import/export modules
  • Remote HTTP dispatch routing
  • Shared mode UI
  • src-tauri/src/lib.rs command registration was not changed.

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

Commands run locally:

  • cargo test --manifest-path src-tauri/Cargo.toml swipe (25 passed)
  • cargo test --manifest-path src-tauri/Cargo.toml profile_import (11 passed)
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm typecheck
  • git diff --check origin/refactor..HEAD
  • cargo test --manifest-path src-tauri/Cargo.toml message_swipes (21 passed)
  • cargo test --manifest-path src-tauri/Cargo.toml branch_chat_sets_game_state_to_selected_tracker_snapshot (1 passed)
  • cargo test --manifest-path src-tauri/Cargo.toml storage_list_projected_embedded_swipes_materializes_without_swipes_field -- --nocapture (1 passed)
  • cargo test --manifest-path src-tauri/Cargo.toml message_projection_materialization_includes_internal_sort_fields -- --nocapture (1 passed)
  • cargo test --manifest-path src-tauri/Cargo.toml storage_commands (319 passed)
  • cargo test --manifest-path src-tauri/crates/storage/Cargo.toml (27 passed)
  • git diff --check
  • pnpm check

Additional notes:

  • Conflict resolution on latest origin/refactor through 9d7237ae kept both the base projected-page payload-skip test and the sidecar embedded-swipe materialization test. Targeted Rust tests, message_swipes, git diff --check, and pnpm check passed after the merge.
  • Rust Capability Layer follow-up: CI exposed a merge-base projected paged-message test where internal materialization projection omitted embedded swipes; this branch now includes swipes only for internal materialization and keeps caller projection stripping unrequested swipes.
  • Native Tauri QA run against Marinara Engine QA via WebView2/CDP: restored numeric jump input switched assistant swipes 3 -> 1 -> 2 -> 3 with matching message text changes and no console/page errors.
  • With tracker refresh enabled on the scratch QA chat, switching the latest assistant swipe emitted chat_message_set_active_swipe, storage_get, filtered storage_list, and tracker_snapshot_get for swipe indexes 0 and 1, followed by tracker_snapshot_latest; QA metadata and active swipe were restored afterward.

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:

  • N/A. This changes storage, compatibility, and existing message-swipe UI behavior for an existing feature; it does not add a new 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 screenshots or recordings captured. Native Tauri QA via WebView2/CDP verified the restored jump input and tracker refresh request path after active swipe switching; no console/page errors observed.


🔄 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/1939 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/2/2026 **Status:** ❌ Closed **Base:** `refactor` ← **Head:** `feature/message-swipe-sidecar` --- ### 📝 Commits (1) - [`0f29b93`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0f29b933ad2bdd1fb5ac2734a2488a7bb7fae370) Add message swipe sidecar storage ### 📊 Changes **16 files changed** (+2367 additions, -157 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage.rs` (+2 -0) 📝 `src-tauri/src/commands/storage/admin.rs` (+1 -0) 📝 `src-tauri/src/commands/storage/chats.rs` (+170 -79) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+479 -58) 📝 `src-tauri/src/commands/storage/contracts.rs` (+9 -0) 📝 `src-tauri/src/commands/storage/exports.rs` (+8 -2) 📝 `src-tauri/src/commands/storage/game_state_snapshots.rs` (+3 -4) 📝 `src-tauri/src/commands/storage/imports/bulk_imports.rs` (+5 -2) 📝 `src-tauri/src/commands/storage/imports/marinara_rollback.rs` (+7 -0) 📝 `src-tauri/src/commands/storage/imports/rollback.rs` (+7 -0) ➕ `src-tauri/src/commands/storage/message_swipes.rs` (+1385 -0) 📝 `src-tauri/src/commands/storage/profile.rs` (+265 -0) 📝 `src-tauri/src/commands/storage/profile/legacy.rs` (+6 -1) 📝 `src-tauri/src/commands/storage/shared.rs` (+1 -0) 📝 `src-tauri/src/http_dispatch.rs` (+2 -0) 📝 `src-tauri/src/state.rs` (+17 -11) </details> ### 📄 Description ## Linked issue Closes #1923 ## Why this change - Message swipe behavior in refactor needed to match legacy storage behavior while keeping message rows lean for the refactor generation/cache flow. - Embedded swipes also needed consistent migration, import/export, rollback, delete, branch, search, active-swipe handling, and UI behavior. - Follow-up parity review found two remaining swipe UX gaps: switching swipes did not refresh visible tracker/world-state state, and the direct jump-to-swipe control had been reduced to arrows only. ## What changed - Added native `message-swipes` sidecar storage and migrates embedded message swipes into sidecar rows. - Materializes swipe content, previews, active extra data, and swipe counts at message read boundaries while keeping stored message rows lean. - Keeps parent message rows and sidecar swipe rows in sync for create, update, add, set, delete, duplicate, branch, import, export, rollback, and cleanup paths. - Preserves legacy edge behavior for invalid active-swipe indexes, missing or last swipe deletes, silent/inactive swipe append, search over swipe content, and old profile imports without sidecar collections. - Restores direct numeric jump-to-swipe input in the shared swipe control while keeping next-swipe reroll behavior. - Refreshes visible world-state/tracker state after active swipe switches when tracker refresh is enabled, flushing pending tracker edits first. ## Refactor impact Primary owner: - Rust storage/imports and shared mode chat UI. Impact areas reviewed: - Chat message CRUD and timeline projection - Message search, filtering, and projection - Profile import/export and legacy profile migration - Import rollback and bulk import cleanup - Chat branch, delete, bulk delete, active swipe, and swipe UI flows - Game/world-state tracker snapshot swipe cleanup and visible tracker refresh - Embedded and remote command dispatch - Conversation and Roleplay shared message swipe controls Boundary notes: - Product/UI code continues to use existing chat command wrappers. - Storage behavior stays in `src-tauri`; no engine-to-Tauri or feature-internal imports added. - Remote-capable commands remain explicitly routed through `src-tauri/src/http_dispatch.rs`. - The UI follow-up stays in shared mode chat UI and uses existing world-state API/store wrappers; no raw Tauri or remote-runtime calls added. Pressure points touched: - Import modules - Profile import/export modules - Remote HTTP dispatch routing - Shared mode UI - `src-tauri/src/lib.rs` command registration was not changed. ## 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 Commands run locally: - `cargo test --manifest-path src-tauri/Cargo.toml swipe` (25 passed) - `cargo test --manifest-path src-tauri/Cargo.toml profile_import` (11 passed) - `cargo check --manifest-path src-tauri/Cargo.toml` - `pnpm typecheck` - `git diff --check origin/refactor..HEAD` - `cargo test --manifest-path src-tauri/Cargo.toml message_swipes` (21 passed) - `cargo test --manifest-path src-tauri/Cargo.toml branch_chat_sets_game_state_to_selected_tracker_snapshot` (1 passed) - `cargo test --manifest-path src-tauri/Cargo.toml storage_list_projected_embedded_swipes_materializes_without_swipes_field -- --nocapture` (1 passed) - `cargo test --manifest-path src-tauri/Cargo.toml message_projection_materialization_includes_internal_sort_fields -- --nocapture` (1 passed) - `cargo test --manifest-path src-tauri/Cargo.toml storage_commands` (319 passed) - `cargo test --manifest-path src-tauri/crates/storage/Cargo.toml` (27 passed) - `git diff --check` - `pnpm check` Additional notes: - Conflict resolution on latest `origin/refactor` through `9d7237ae` kept both the base projected-page payload-skip test and the sidecar embedded-swipe materialization test. Targeted Rust tests, `message_swipes`, `git diff --check`, and `pnpm check` passed after the merge. - Rust Capability Layer follow-up: CI exposed a merge-base projected paged-message test where internal materialization projection omitted embedded `swipes`; this branch now includes `swipes` only for internal materialization and keeps caller projection stripping unrequested `swipes`. - Native Tauri QA run against `Marinara Engine QA` via WebView2/CDP: restored numeric jump input switched assistant swipes 3 -> 1 -> 2 -> 3 with matching message text changes and no console/page errors. - With tracker refresh enabled on the scratch QA chat, switching the latest assistant swipe emitted `chat_message_set_active_swipe`, `storage_get`, filtered `storage_list`, and `tracker_snapshot_get` for swipe indexes 0 and 1, followed by `tracker_snapshot_latest`; QA metadata and active swipe were restored afterward. ## 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: - N/A. This changes storage, compatibility, and existing message-swipe UI behavior for an existing feature; it does not add a new 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` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence No screenshots or recordings captured. Native Tauri QA via WebView2/CDP verified the restored jump input and tracker refresh request path after active swipe switching; no console/page errors observed. --- <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:28 +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#5349
No description provided.