[PR #1598] [MERGED] [codex] Optimize character library performance #5133

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

📋 Pull Request Information

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

Base: refactor ← Head: codex/character-library-search-virtualization


📝 Commits (6)

  • a36acfe Optimize character summary avatar loading
  • 135ddaf Fix summary fanout and lorebook filters
  • e5875ea Optimize character summary search
  • abc87f3 Fix Bunny review findings
  • 3afc25f Merge origin/refactor into character library search
  • a8d6406 Fix Bunny review findings

📊 Changes

15 files changed (+1517 additions, -640 deletions)

View changed files

📝 package.json (+1 -0)
📝 pnpm-lock.yaml (+20 -0)
📝 src-tauri/src/commands/storage/commands/entities.rs (+15 -39)
📝 src-tauri/src/commands/storage/shared.rs (+279 -9)
📝 src-tauri/src/http_dispatch.rs (+25 -4)
📝 src-tauri/src/http_server.rs (+15 -5)
📝 src/engine/capabilities/storage.ts (+1 -0)
📝 src/features/catalog/characters/components/CharacterLibraryView.tsx (+263 -118)
📝 src/features/catalog/characters/components/CharactersPanel.tsx (+378 -261)
📝 src/features/catalog/characters/hooks/use-characters.ts (+57 -12)
📝 src/features/catalog/characters/query-keys.ts (+2 -0)
📝 src/features/catalog/lorebooks/components/LorebookEditor.tsx (+59 -7)
📝 src/features/modes/game/components/GameSetupWizard.tsx (+107 -42)
📝 src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx (+175 -95)
📝 src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx (+120 -48)

📄 Description

Linked issue

Closes #1582
Closes #1583
Closes #1584
Closes #1585

Why this change

Large character collections were expensive across several user paths: list fetches could include embedded avatar payloads, library and panel surfaces rendered every character row at once, sidebars and lorebook panels fetched the full character collection for a small set of ids, and character search had to download the collection before filtering.

What changed

  • Added summary-oriented character queries with lightweight avatar resolution and bounded by-id loading.
  • Virtualized the character library grid and character side-panel list.
  • Added server-side storage search support for character summaries, picker flows, and message content/swipes.
  • Routed summary search through both embedded Tauri storage and hostable HTTP dispatch.
  • Updated chat setup, chat settings, game setup, lorebook linking, recent chats, and sidebar surfaces to use summary/by-id character reads where appropriate.
  • Hardened failure paths found in review: stale first-message prompts, duplicate quick-starts during full-record fetch, legacy avatar-only records, string-encoded legacy character data projection, and hostable avatar filenames with spaces.

Refactor impact

Primary owner:

Catalog characters, shared mode UI pickers, Rust storage, and hostable runtime asset routing.

Impact areas reviewed:

  • Character library and side panel list rendering
  • Character picker flows in chat setup/settings, game setup, and lorebook linking
  • Sidebar/recent chat/lorebook character lookups
  • Embedded and HTTP storage list/search behavior
  • Remote runtime avatar asset URL path

Boundary notes:

  • Feature code continues to use catalog hooks and shared API wrappers; no raw Tauri or remote-runtime fetches were added in feature code.
  • Rust storage owns search/projection behavior for embedded and HTTP paths.
  • Hostable avatar asset serving stays behind the existing /api/assets/:kind/*path route.

Pressure points touched:

  • Shared mode UI setup/settings components were touched for picker behavior.
  • Rust storage shared projection/search helpers and HTTP dispatch were touched.
  • No ModeSurface orchestration or command registration changes.

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

Automated/local validation run by Codex; template boxes are left unchecked for human verification.

  • pnpm typecheck passed.
  • pnpm build passed with the existing large chunk warning.
  • pnpm check:architecture passed.
  • cargo check --manifest-path src-tauri\Cargo.toml passed.
  • cargo test --manifest-path src-tauri\Cargo.toml apply_storage_search passed.
  • cargo test --manifest-path src-tauri\Cargo.toml project_list_rows passed.
  • cargo test --manifest-path src-tauri\Cargo.toml avatar_asset_filename passed.
  • pnpm vitest run src/features/catalog/characters/hooks/use-characters.test.ts src/shared/api/local-file-api.test.ts passed.
  • git diff --check passed with only checkout LF/CRLF warnings.

Manual Tauri QA for very large real character libraries was not run.

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 or release files were changed; this implements existing tracked performance issues.

UI evidence

Not added. The main remaining human check is a native Tauri pass over a large character library for scroll/search behavior.

Summary by CodeRabbit

  • New Features
    • Added character search functionality across character library, chat setup, and character selection panels
    • Search now filters by creator information, notes, and tags
    • Implemented virtual scrolling for improved performance with large character lists
    • Added retry functionality and loading indicators for character operations

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/1598 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/30/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `codex/character-library-search-virtualization` --- ### 📝 Commits (6) - [`a36acfe`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a36acfe48f17621b3e7ca5d43c075bbf0ea7b172) Optimize character summary avatar loading - [`135ddaf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/135ddafa4a2ad3a157eb0bc7cae9d6123d1029b8) Fix summary fanout and lorebook filters - [`e5875ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e5875ea51390983d7595e5edd5ee88349e427485) Optimize character summary search - [`abc87f3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/abc87f34cc40e40fd907974b5a3d7d630fa321dc) Fix Bunny review findings - [`3afc25f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3afc25f7c11856b954ff63569da47c18c82a5c49) Merge origin/refactor into character library search - [`a8d6406`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a8d6406b4a73eb4375b134e4b0472e0f719c74f9) Fix Bunny review findings ### 📊 Changes **15 files changed** (+1517 additions, -640 deletions) <details> <summary>View changed files</summary> 📝 `package.json` (+1 -0) 📝 `pnpm-lock.yaml` (+20 -0) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+15 -39) 📝 `src-tauri/src/commands/storage/shared.rs` (+279 -9) 📝 `src-tauri/src/http_dispatch.rs` (+25 -4) 📝 `src-tauri/src/http_server.rs` (+15 -5) 📝 `src/engine/capabilities/storage.ts` (+1 -0) 📝 `src/features/catalog/characters/components/CharacterLibraryView.tsx` (+263 -118) 📝 `src/features/catalog/characters/components/CharactersPanel.tsx` (+378 -261) 📝 `src/features/catalog/characters/hooks/use-characters.ts` (+57 -12) 📝 `src/features/catalog/characters/query-keys.ts` (+2 -0) 📝 `src/features/catalog/lorebooks/components/LorebookEditor.tsx` (+59 -7) 📝 `src/features/modes/game/components/GameSetupWizard.tsx` (+107 -42) 📝 `src/features/modes/shared/chat-ui/components/ChatSettingsDrawer.tsx` (+175 -95) 📝 `src/features/modes/shared/chat-ui/components/ChatSetupWizard.tsx` (+120 -48) </details> ### 📄 Description ## Linked issue Closes #1582 Closes #1583 Closes #1584 Closes #1585 ## Why this change Large character collections were expensive across several user paths: list fetches could include embedded avatar payloads, library and panel surfaces rendered every character row at once, sidebars and lorebook panels fetched the full character collection for a small set of ids, and character search had to download the collection before filtering. ## What changed - Added summary-oriented character queries with lightweight avatar resolution and bounded by-id loading. - Virtualized the character library grid and character side-panel list. - Added server-side storage search support for character summaries, picker flows, and message content/swipes. - Routed summary search through both embedded Tauri storage and hostable HTTP dispatch. - Updated chat setup, chat settings, game setup, lorebook linking, recent chats, and sidebar surfaces to use summary/by-id character reads where appropriate. - Hardened failure paths found in review: stale first-message prompts, duplicate quick-starts during full-record fetch, legacy avatar-only records, string-encoded legacy character data projection, and hostable avatar filenames with spaces. ## Refactor impact Primary owner: Catalog characters, shared mode UI pickers, Rust storage, and hostable runtime asset routing. Impact areas reviewed: - Character library and side panel list rendering - Character picker flows in chat setup/settings, game setup, and lorebook linking - Sidebar/recent chat/lorebook character lookups - Embedded and HTTP storage list/search behavior - Remote runtime avatar asset URL path Boundary notes: - Feature code continues to use catalog hooks and shared API wrappers; no raw Tauri or remote-runtime fetches were added in feature code. - Rust storage owns search/projection behavior for embedded and HTTP paths. - Hostable avatar asset serving stays behind the existing `/api/assets/:kind/*path` route. Pressure points touched: - Shared mode UI setup/settings components were touched for picker behavior. - Rust storage shared projection/search helpers and HTTP dispatch were touched. - No ModeSurface orchestration or command registration changes. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `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 Automated/local validation run by Codex; template boxes are left unchecked for human verification. - `pnpm typecheck` passed. - `pnpm build` passed with the existing large chunk warning. - `pnpm check:architecture` passed. - `cargo check --manifest-path src-tauri\Cargo.toml` passed. - `cargo test --manifest-path src-tauri\Cargo.toml apply_storage_search` passed. - `cargo test --manifest-path src-tauri\Cargo.toml project_list_rows` passed. - `cargo test --manifest-path src-tauri\Cargo.toml avatar_asset_filename` passed. - `pnpm vitest run src/features/catalog/characters/hooks/use-characters.test.ts src/shared/api/local-file-api.test.ts` passed. - `git diff --check` passed with only checkout LF/CRLF warnings. Manual Tauri QA for very large real character libraries was not run. ## 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 or release files were changed; this implements existing tracked performance issues. ## UI evidence Not added. The main remaining human check is a native Tauri pass over a large character library for scroll/search behavior. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added character search functionality across character library, chat setup, and character selection panels * Search now filters by creator information, notes, and tags * Implemented virtual scrolling for improved performance with large character lists * Added retry functionality and loading indicators for character operations <!-- 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/1598?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:35 +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#5133
No description provided.