[PR #1493] [MERGED] Route add-swipe calls through storage API #5110

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1493
Author: @Xelvanis
Created: 5/29/2026
Status: ✅ Merged
Merged: 5/29/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/add-swipe-storage-wrapper


📝 Commits (4)

  • 2f083d0 Route add-swipe calls through storage API
  • 004bad7 Fix inactive swipe legacy records
  • e29102d Merge remote-tracking branch 'origin/refactor' into fix/add-swipe-storage-wrapper
  • 670d1a0 Handle first message swipe write failures

📊 Changes

14 files changed (+746 additions, -206 deletions)

View changed files

📝 graphify-out/GRAPH_REPORT.md (+10 -10)
📝 graphify-out/cache/stat-index.json (+1 -1)
📝 graphify-out/graph.json (+392 -116)
📝 graphify-out/manifest.json (+20 -20)
📝 src-tauri/src/commands/storage/chats.rs (+227 -3)
📝 src/engine/capabilities/storage.ts (+6 -1)
📝 src/engine/generation/start-generation.test.ts (+33 -19)
📝 src/engine/generation/start-generation.ts (+1 -1)
📝 src/features/catalog/characters/components/CharactersPanel.tsx (+20 -17)
📝 src/features/catalog/characters/hooks/use-start-chat-from-character.ts (+1 -1)
📝 src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx (+1 -5)
📝 src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx (+1 -9)
📝 src/shared/api/storage-api.test.ts (+19 -0)
📝 src/shared/api/storage-api.ts (+14 -3)

📄 Description

Linked issue

N/A - no linked issue supplied.

Why this change

  • Add-swipe flows still had feature-level raw chat_message_add_swipe calls, so alternate greetings bypassed the shared storage wrapper and could not explicitly append inactive swipes.
  • Regeneration swipe appends also needed to keep swipe-scoped extra metadata intact for prompt/generation replay.
  • The Rust storage command needed legacy compatibility for inactive appends against old message records with missing or empty swipes.

What changed

  • Added an options object for storageApi.addChatMessageSwipe with extra and activate support.
  • Routed alternate-greeting add-swipe callers through the shared storage API with activate: false.
  • Preserved regeneration swipe metadata by passing extra through the wrapper.
  • Updated Rust swipe storage to preserve active swipe metadata, respect activate: false and legacy silent: true, clamp stale active indexes, and seed missing legacy swipes before inactive append.
  • Added TypeScript and Rust regression coverage for wrapper payloads, generation replay metadata, inactive swipe appends, and legacy message shapes.
  • Refreshed graphify-out for the combined branch.

Refactor impact

Primary owner:

Shared API adapter and Rust storage, with feature caller cleanup in catalog/shared chat UI and generation replay coverage in engine generation.

Impact areas reviewed:

  • Feature add-swipe entrypoints for alternate greetings.
  • Engine generation regeneration swipe append path.
  • Shared storage API wrapper payload shape.
  • Rust chat_message_add_swipe behavior for active/inactive append, legacy silent, stale active indexes, and old persisted message records.
  • Remote/runtime command path shape at the wrapper boundary; no remote runtime smoke was run.

Boundary notes:

  • Feature code now calls the focused shared API wrapper instead of raw invokeTauri.
  • Engine generation still depends on the storage capability port, not concrete shared API or Tauri adapters.
  • Rust storage remains the persistence owner for swipe activation and legacy message compatibility.

Pressure points touched:

  • Shared chat UI callers: ChatSetupWizard, ChatSettingsDrawer.
  • Catalog character chat start callers.
  • Rust storage command implementation.
  • Generated graphify-out files.

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

Ran before the final merge from origin/refactor:

  • pnpm build passed with the existing large chunk warning.

Ran after merging current origin/refactor:

  • cargo test --manifest-path src-tauri/Cargo.toml professor_mari_prompt
  • cargo test --manifest-path src-tauri/Cargo.toml assets
  • cargo test --manifest-path src-tauri/Cargo.toml message_swipes_
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace
  • pnpm test -- src/shared/api/storage-api.test.ts src/engine/generation/start-generation.test.ts
  • pnpm typecheck
  • pnpm check:architecture
  • graphify update .

Not run:

  • Native Tauri app manual verification.
  • Remote runtime smoke.
  • Full pnpm check.
  • pnpm build after the final merge commit.

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

No docs changes were made; this is a storage/API wrapper behavior fix and caller cleanup rather than contributor or user-facing documentation work.

UI evidence

N/A - no visible UI surface changed directly.

Summary by CodeRabbit

  • New Features

    • Message swipe API now supports an activate option to explicitly control whether newly added swipes become active.
  • Improvements

    • Enhanced swipe behavior during message regeneration and alternate greeting workflows in chat creation and modification.

Review Change Stack


🔄 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/1493 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/add-swipe-storage-wrapper` --- ### 📝 Commits (4) - [`2f083d0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2f083d052a5d4809124861422f939b5d2f53e84c) Route add-swipe calls through storage API - [`004bad7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/004bad7db29d8ffe7fea1dbc4be21cb7e6bd0c87) Fix inactive swipe legacy records - [`e29102d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e29102d2af6d3fb6aeb4fc51c3e66e1572a0287b) Merge remote-tracking branch 'origin/refactor' into fix/add-swipe-storage-wrapper - [`670d1a0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/670d1a025923a8e76b7af2a8c6ab9e6334b3506b) Handle first message swipe write failures ### 📊 Changes **14 files changed** (+746 additions, -206 deletions) <details> <summary>View changed files</summary> 📝 `graphify-out/GRAPH_REPORT.md` (+10 -10) 📝 `graphify-out/cache/stat-index.json` (+1 -1) 📝 `graphify-out/graph.json` (+392 -116) 📝 `graphify-out/manifest.json` (+20 -20) 📝 `src-tauri/src/commands/storage/chats.rs` (+227 -3) 📝 `src/engine/capabilities/storage.ts` (+6 -1) 📝 `src/engine/generation/start-generation.test.ts` (+33 -19) 📝 `src/engine/generation/start-generation.ts` (+1 -1) 📝 `src/features/catalog/characters/components/CharactersPanel.tsx` (+20 -17) 📝 `src/features/catalog/characters/hooks/use-start-chat-from-character.ts` (+1 -1) 📝 `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` (+1 -5) 📝 `src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx` (+1 -9) 📝 `src/shared/api/storage-api.test.ts` (+19 -0) 📝 `src/shared/api/storage-api.ts` (+14 -3) </details> ### 📄 Description ## Linked issue N/A - no linked issue supplied. ## Why this change - Add-swipe flows still had feature-level raw `chat_message_add_swipe` calls, so alternate greetings bypassed the shared storage wrapper and could not explicitly append inactive swipes. - Regeneration swipe appends also needed to keep swipe-scoped `extra` metadata intact for prompt/generation replay. - The Rust storage command needed legacy compatibility for inactive appends against old message records with missing or empty `swipes`. ## What changed - Added an options object for `storageApi.addChatMessageSwipe` with `extra` and `activate` support. - Routed alternate-greeting add-swipe callers through the shared storage API with `activate: false`. - Preserved regeneration swipe metadata by passing `extra` through the wrapper. - Updated Rust swipe storage to preserve active swipe metadata, respect `activate: false` and legacy `silent: true`, clamp stale active indexes, and seed missing legacy swipes before inactive append. - Added TypeScript and Rust regression coverage for wrapper payloads, generation replay metadata, inactive swipe appends, and legacy message shapes. - Refreshed `graphify-out` for the combined branch. ## Refactor impact Primary owner: Shared API adapter and Rust storage, with feature caller cleanup in catalog/shared chat UI and generation replay coverage in engine generation. Impact areas reviewed: - Feature add-swipe entrypoints for alternate greetings. - Engine generation regeneration swipe append path. - Shared storage API wrapper payload shape. - Rust `chat_message_add_swipe` behavior for active/inactive append, legacy `silent`, stale active indexes, and old persisted message records. - Remote/runtime command path shape at the wrapper boundary; no remote runtime smoke was run. Boundary notes: - Feature code now calls the focused shared API wrapper instead of raw `invokeTauri`. - Engine generation still depends on the storage capability port, not concrete shared API or Tauri adapters. - Rust storage remains the persistence owner for swipe activation and legacy message compatibility. Pressure points touched: - Shared chat UI callers: `ChatSetupWizard`, `ChatSettingsDrawer`. - Catalog character chat start callers. - Rust storage command implementation. - Generated `graphify-out` files. ## Validation - [ ] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `pnpm check:docs` passes locally - [x] `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 Ran before the final merge from `origin/refactor`: - `pnpm build` passed with the existing large chunk warning. Ran after merging current `origin/refactor`: - `cargo test --manifest-path src-tauri/Cargo.toml professor_mari_prompt` - `cargo test --manifest-path src-tauri/Cargo.toml assets` - `cargo test --manifest-path src-tauri/Cargo.toml message_swipes_` - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` - `pnpm test -- src/shared/api/storage-api.test.ts src/engine/generation/start-generation.test.ts` - `pnpm typecheck` - `pnpm check:architecture` - `graphify update .` Not run: - Native Tauri app manual verification. - Remote runtime smoke. - Full `pnpm check`. - `pnpm build` after the final merge commit. ## 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 No docs changes were made; this is a storage/API wrapper behavior fix and caller cleanup rather than contributor or user-facing documentation work. ## UI evidence N/A - no visible UI surface changed directly. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Message swipe API now supports an `activate` option to explicitly control whether newly added swipes become active. * **Improvements** * Enhanced swipe behavior during message regeneration and alternate greeting workflows in chat creation and modification. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1493?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:13:22 +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#5110
No description provided.