[PR #1773] [MERGED] Restore character legacy parity behavior #5275

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1773
Author: @Xelvanis
Created: 6/1/2026
Status: ✅ Merged
Merged: 6/1/2026
Merged by: @Xelvanis

Base: refactor ← Head: character-legacy-parity


📝 Commits (2)

  • 7211b50 Restore character legacy parity behavior
  • 0223cc1 Fix character avatar reviewer findings

📊 Changes

15 files changed (+468 additions, -34 deletions)

View changed files

📝 src-tauri/src/commands/storage/avatars.rs (+80 -12)
📝 src-tauri/src/commands/storage/characters.rs (+147 -0)
📝 src-tauri/src/commands/storage/commands/entities.rs (+8 -1)
📝 src-tauri/src/commands/storage/commands/media.rs (+5 -0)
📝 src-tauri/src/commands/storage/media_uploads.rs (+15 -12)
📝 src-tauri/src/http_dispatch.rs (+3 -0)
📝 src-tauri/src/lib.rs (+1 -0)
📝 src/engine/generation/prompt-assembly.ts (+96 -1)
📝 src/features/catalog/characters/components/CharacterEditor.test.tsx (+1 -0)
📝 src/features/catalog/characters/components/CharacterEditor.tsx (+19 -3)
📝 src/features/catalog/characters/components/CharacterEditorHeader.tsx (+18 -1)
📝 src/features/catalog/characters/hooks/use-character-editor-avatar.ts (+62 -3)
📝 src/features/catalog/characters/hooks/use-characters.ts (+11 -1)
📝 src/shared/api/character-api.ts (+1 -0)
📝 src/shared/api/remote-runtime.ts (+1 -0)

📄 Description

Linked issue

N/A - local legacy parity task.

Why this change

Restore key legacy Character behavior that regressed during the refactor while keeping the current architecture split between Rust storage, shared API wrappers, catalog UI, and React-free generation code.

What changed

  • Restore character version snapshots for normal character updates, avatar upload/removal, and restore operations, including versionSource, versionReason, and skipVersionSnapshot handling.
  • Add avatar removal through the character API, Tauri command registration, remote runtime allowlist, editor hook, and header action.
  • Guard avatar snapshot embedding/deletion so only managed avatar files are read or removed.
  • Duplicate character cards with nested data.name updated to (Copy) while preserving passthrough card data.
  • Reconnect character depth prompts to prompt assembly for conversation/roleplay paths, preserve injected prompt roles under strict role formatting, and suppress character depth prompts in game mode.

Refactor impact

Primary owner:

Rust storage, shared API wrappers, catalog Character UI, and engine generation.

Impact areas reviewed:

  • Character storage update/version/restore paths.
  • Avatar upload/remove lifecycle and managed-file guards.
  • Generic duplicate routing for character vs non-character records.
  • Character editor avatar UI and mutation cache invalidation.
  • Prompt assembly depth injection for conversation, roleplay, and game modes.
  • Tauri command registration, HTTP dispatch, and remote runtime allowlist.

Boundary notes:

  • Product prompt behavior stays in src/engine/generation with no React/shared-api imports.
  • React editor behavior stays in src/features/catalog/characters and calls focused shared API wrappers.
  • Runtime wrappers stay in src/shared/api.
  • Privileged storage and file operations stay in src-tauri.
  • Remote-capable avatar removal is wired through remote-runtime.ts and src-tauri/src/http_dispatch.rs.

Pressure points touched:

  • src-tauri/src/lib.rs command registration.
  • src-tauri/src/http_dispatch.rs remote command dispatch.
  • Character editor header/action surface.
  • Prompt assembly strict-role and depth-injection path.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • pnpm check passes locally before PR push/handoff, including the unused-code check
  • 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
  • Browser screenshot/recording evidence added when UI/browser state is the claim
  • Remote runtime smoke checked when relevant

Manual verification notes

  • pnpm check passed locally after the final code diff, including line endings, architecture, TypeScript, Rust check, docs, discovery metadata, and unused-code scan.
  • pnpm build passed locally after the final code diff.
  • Native Tauri QA ran with pnpm tauri dev --no-watch --config scratch\tauri-qa.config.json.
  • In the native Tauri WebView shell, exercised the real frontend API modules and Tauri command path for avatar upload, avatar removal, managed snapshot embedding, unmanaged avatar guard, duplicate visible-name behavior, roleplay depth prompt injection, and game-mode depth prompt suppression.
  • Native QA artifact saved locally at scratch/tauri-qa-character-parity-current.png.
  • No new test files were added as PR proof. Existing component test mock wiring was updated only so the current mocked character hook surface includes the new remove-avatar mutation.

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:

  • This restores legacy Character behavior and adds the missing avatar removal action inside an existing editor surface; no Discover entry exists for this narrow editor action today.

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

Native QA screenshot exists locally at scratch/tauri-qa-character-parity-current.png; not uploaded here because the verified behavior was command-path/storage/prompt behavior rather than a visual layout change.

Summary by CodeRabbit

  • New Features

    • Avatar removal: Users can now remove character avatars with a confirmation prompt
    • Character duplication: Create copies of existing characters with customizable names
    • Per-character depth prompts: Added support for depth prompts in character generation
  • Improvements

    • Improved messaging for in-flight avatar operations
    • Enhanced prompt assembly to integrate character-specific depth prompts during generation

🔄 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/1773 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/1/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `character-legacy-parity` --- ### 📝 Commits (2) - [`7211b50`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7211b5060e2721e75eeaaa009cedcc14976e8fdf) Restore character legacy parity behavior - [`0223cc1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0223cc1eb7dfc6bea39cfae057a5e22b38dd7486) Fix character avatar reviewer findings ### 📊 Changes **15 files changed** (+468 additions, -34 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/avatars.rs` (+80 -12) 📝 `src-tauri/src/commands/storage/characters.rs` (+147 -0) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+8 -1) 📝 `src-tauri/src/commands/storage/commands/media.rs` (+5 -0) 📝 `src-tauri/src/commands/storage/media_uploads.rs` (+15 -12) 📝 `src-tauri/src/http_dispatch.rs` (+3 -0) 📝 `src-tauri/src/lib.rs` (+1 -0) 📝 `src/engine/generation/prompt-assembly.ts` (+96 -1) 📝 `src/features/catalog/characters/components/CharacterEditor.test.tsx` (+1 -0) 📝 `src/features/catalog/characters/components/CharacterEditor.tsx` (+19 -3) 📝 `src/features/catalog/characters/components/CharacterEditorHeader.tsx` (+18 -1) 📝 `src/features/catalog/characters/hooks/use-character-editor-avatar.ts` (+62 -3) 📝 `src/features/catalog/characters/hooks/use-characters.ts` (+11 -1) 📝 `src/shared/api/character-api.ts` (+1 -0) 📝 `src/shared/api/remote-runtime.ts` (+1 -0) </details> ### 📄 Description ## Linked issue N/A - local legacy parity task. ## Why this change Restore key legacy Character behavior that regressed during the refactor while keeping the current architecture split between Rust storage, shared API wrappers, catalog UI, and React-free generation code. ## What changed - Restore character version snapshots for normal character updates, avatar upload/removal, and restore operations, including `versionSource`, `versionReason`, and `skipVersionSnapshot` handling. - Add avatar removal through the character API, Tauri command registration, remote runtime allowlist, editor hook, and header action. - Guard avatar snapshot embedding/deletion so only managed avatar files are read or removed. - Duplicate character cards with nested `data.name` updated to `(Copy)` while preserving passthrough card data. - Reconnect character depth prompts to prompt assembly for conversation/roleplay paths, preserve injected prompt roles under strict role formatting, and suppress character depth prompts in game mode. ## Refactor impact Primary owner: Rust storage, shared API wrappers, catalog Character UI, and engine generation. Impact areas reviewed: - Character storage update/version/restore paths. - Avatar upload/remove lifecycle and managed-file guards. - Generic duplicate routing for character vs non-character records. - Character editor avatar UI and mutation cache invalidation. - Prompt assembly depth injection for conversation, roleplay, and game modes. - Tauri command registration, HTTP dispatch, and remote runtime allowlist. Boundary notes: - Product prompt behavior stays in `src/engine/generation` with no React/shared-api imports. - React editor behavior stays in `src/features/catalog/characters` and calls focused shared API wrappers. - Runtime wrappers stay in `src/shared/api`. - Privileged storage and file operations stay in `src-tauri`. - Remote-capable avatar removal is wired through `remote-runtime.ts` and `src-tauri/src/http_dispatch.rs`. Pressure points touched: - `src-tauri/src/lib.rs` command registration. - `src-tauri/src/http_dispatch.rs` remote command dispatch. - Character editor header/action surface. - Prompt assembly strict-role and depth-injection path. ## 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] `pnpm check` passes locally before PR push/handoff, including the unused-code check - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `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 - [x] Browser or Tauri app manual verification completed - [ ] Browser screenshot/recording evidence added when UI/browser state is the claim - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - `pnpm check` passed locally after the final code diff, including line endings, architecture, TypeScript, Rust check, docs, discovery metadata, and unused-code scan. - `pnpm build` passed locally after the final code diff. - Native Tauri QA ran with `pnpm tauri dev --no-watch --config scratch\tauri-qa.config.json`. - In the native Tauri WebView shell, exercised the real frontend API modules and Tauri command path for avatar upload, avatar removal, managed snapshot embedding, unmanaged avatar guard, duplicate visible-name behavior, roleplay depth prompt injection, and game-mode depth prompt suppression. - Native QA artifact saved locally at `scratch/tauri-qa-character-parity-current.png`. - No new test files were added as PR proof. Existing component test mock wiring was updated only so the current mocked character hook surface includes the new remove-avatar mutation. ## 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: - This restores legacy Character behavior and adds the missing avatar removal action inside an existing editor surface; no Discover entry exists for this narrow editor action today. ## 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 Native QA screenshot exists locally at `scratch/tauri-qa-character-parity-current.png`; not uploaded here because the verified behavior was command-path/storage/prompt behavior rather than a visual layout change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Avatar removal: Users can now remove character avatars with a confirmation prompt * Character duplication: Create copies of existing characters with customizable names * Per-character depth prompts: Added support for depth prompts in character generation * **Improvements** * Improved messaging for in-flight avatar operations * Enhanced prompt assembly to integrate character-specific depth prompts during generation <!-- 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:14:49 +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#5275
No description provided.