[PR #2292] [MERGED] Batch character summary reads by ID #5528

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/batch-character-summary-by-id-loading


📝 Commits (4)

  • 626f30e storage: batch character summary reads
  • 2dbda0f storage: align list selector contracts
  • cc13db5 llm: simplify custom parameter predicate
  • 59bc3c1 Merge refactor into batch character summary branch

📊 Changes

5 files changed (+417 additions, -41 deletions)

View changed files

📝 src-tauri/crates/llm/src/lib.rs (+4 -4)
📝 src-tauri/src/commands/storage/commands/entities.rs (+391 -7)
📝 src/engine/capabilities/storage.ts (+11 -3)
📝 src/features/catalog/characters/hooks/use-characters.ts (+9 -25)
📝 src/features/catalog/chats/lib/timeline-message.ts (+2 -2)

📄 Description

Linked issue

N/A

Why this change

  • Character summary-by-ID loading made many individual storage get calls. Batched reads reduce command overhead while preserving missing-ID handling and caller order.

What changed

  • Added whereIn support to the public storage_list command, including projected reads and stricter input validation.
  • Updated character summary-by-ID loading to read all requested IDs through one projected storageApi.list call, then restore caller order.
  • Tightened the chat message list option type so callers cannot pass whereIn to a wrapper that always adds a chatId filter.
  • Added Rust coverage for projected character reads, invalid whereIn.values, and projected message swipe materialization through whereIn.

Refactor impact

Primary owner:

Rust storage command, shared storage capability contract, and catalog character hooks.

Impact areas reviewed:

  • Character summary-by-ID consumers in chat/sidebar, lorebook, mode, and setup surfaces.
  • Storage list projection, search, ordering, limit, and missing-record behavior.
  • Message swipe materialization for projected message list reads.
  • Remote runtime dispatch path that reuses storage_list_inner.

Boundary notes:

  • Feature code continues to call the focused storageApi wrapper, not raw Tauri or raw remote-runtime fetch.
  • src/engine/capabilities/storage.ts owns the shared storage option contract.
  • src-tauri owns the privileged storage filtering and projection behavior.
  • Remote-capable behavior remains behind the existing explicit storage_list invoke/dispatch path.

Pressure points touched:

  • None of the listed pressure points were touched.

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

  • cargo test --manifest-path src-tauri/Cargo.toml storage_list_where_in
  • cargo test --manifest-path src-tauri/Cargo.toml storage_list_
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm typecheck
  • pnpm check
  • git diff --check

No manual UI or native Tauri pass was run; this is a storage/API batching fix with focused machine coverage.

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:

  • Internal storage/API batching fix; no new user-discoverable feature or workflow.

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

N/A; no visible UI changes.

Summary by CodeRabbit

  • New Features

    • Added whereIn query parameter to storage list operations, enabling more flexible filtering options based on field values
  • Refactor

    • Improved character summary lookup performance through optimized batch retrieval
  • Tests

    • Added comprehensive test coverage for whereIn functionality, including field projection and message handling scenarios

🔄 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/2292 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/5/2026 **Status:** ✅ Merged **Merged:** 6/5/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/batch-character-summary-by-id-loading` --- ### 📝 Commits (4) - [`626f30e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/626f30e52b3e195f942aaa0552bb32c24d816ab6) storage: batch character summary reads - [`2dbda0f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2dbda0fccddd8f2f8b0a246e3c4e39da5895211a) storage: align list selector contracts - [`cc13db5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cc13db5defa0b1b55edf553481124966e5df9459) llm: simplify custom parameter predicate - [`59bc3c1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/59bc3c1a1e97d24f347584d13d9866096e19cf94) Merge refactor into batch character summary branch ### 📊 Changes **5 files changed** (+417 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/crates/llm/src/lib.rs` (+4 -4) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+391 -7) 📝 `src/engine/capabilities/storage.ts` (+11 -3) 📝 `src/features/catalog/characters/hooks/use-characters.ts` (+9 -25) 📝 `src/features/catalog/chats/lib/timeline-message.ts` (+2 -2) </details> ### 📄 Description ## Linked issue N/A ## Why this change - Character summary-by-ID loading made many individual storage `get` calls. Batched reads reduce command overhead while preserving missing-ID handling and caller order. ## What changed - Added `whereIn` support to the public `storage_list` command, including projected reads and stricter input validation. - Updated character summary-by-ID loading to read all requested IDs through one projected `storageApi.list` call, then restore caller order. - Tightened the chat message list option type so callers cannot pass `whereIn` to a wrapper that always adds a `chatId` filter. - Added Rust coverage for projected character reads, invalid `whereIn.values`, and projected message swipe materialization through `whereIn`. ## Refactor impact Primary owner: Rust storage command, shared storage capability contract, and catalog character hooks. Impact areas reviewed: - Character summary-by-ID consumers in chat/sidebar, lorebook, mode, and setup surfaces. - Storage list projection, search, ordering, limit, and missing-record behavior. - Message swipe materialization for projected message list reads. - Remote runtime dispatch path that reuses `storage_list_inner`. Boundary notes: - Feature code continues to call the focused `storageApi` wrapper, not raw Tauri or raw remote-runtime fetch. - `src/engine/capabilities/storage.ts` owns the shared storage option contract. - `src-tauri` owns the privileged storage filtering and projection behavior. - Remote-capable behavior remains behind the existing explicit `storage_list` invoke/dispatch path. Pressure points touched: - None of the listed pressure points were touched. ## 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 - `cargo test --manifest-path src-tauri/Cargo.toml storage_list_where_in` - `cargo test --manifest-path src-tauri/Cargo.toml storage_list_` - `cargo check --manifest-path src-tauri/Cargo.toml` - `pnpm typecheck` - `pnpm check` - `git diff --check` No manual UI or native Tauri pass was run; this is a storage/API batching fix with focused machine coverage. ## 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: - Internal storage/API batching fix; no new user-discoverable feature or workflow. ## 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 N/A; no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added `whereIn` query parameter to storage list operations, enabling more flexible filtering options based on field values * **Refactor** * Improved character summary lookup performance through optimized batch retrieval * **Tests** * Added comprehensive test coverage for `whereIn` functionality, including field projection and message handling scenarios <!-- 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:17:05 +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#5528
No description provided.