[PR #1924] [MERGED] Fix projected storage_get row reads #5345

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

📋 Pull Request Information

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

Base: refactor ← Head: bugfix/projected-storage-get-1919


📝 Commits (2)

  • c0d80d8 Fix projected storage get reads
  • e2a4c04 Fix projected array field selection

📊 Changes

2 files changed (+752 additions, -12 deletions)

View changed files

📝 src-tauri/crates/storage/src/lib.rs (+623 -9)
📝 src-tauri/src/commands/storage/commands/entities.rs (+129 -3)

📄 Description

Linked issue

Closes #1919

Why this change

  • Projected storage_get calls accepted fields and fieldSelections, but the Rust command path still read the full matched row before trimming the returned payload. Large character/resource rows still paid full row read cost even for narrow projected gets.

What changed

  • Added storage-level projected get support for matching rows.
  • Routed projected storage_get through the projected storage path for embedded Tauri and remote /api/invoke dispatch.
  • Preserved message swipe materialization by adding internal read fields only when projected message fields depend on swipes.
  • Preserved connection secret masking for projected apiKey/hasApiKey reads.
  • Added a projected pretty-file id fast path so projected gets keep the existing cold id lookup optimization and return before trailing rows.

Refactor impact

Primary owner:

Rust storage and Tauri storage command path.

Impact areas reviewed:

  • Catalog resource projected gets, especially character summaries.
  • Runtime projected character/message callers.
  • Message swipe materialization compatibility.
  • Connection read masking compatibility.
  • Embedded Tauri and remote /api/invoke shared storage_get_inner path.

Boundary notes:

  • No React, engine, or shared API imports changed.
  • Feature callers continue using existing storage API wrappers.
  • Remote runtime behavior stays aligned because HTTP dispatch already routes through storage_get_inner.

Pressure points touched:

  • Tauri/Rust storage command implementation and storage crate internals only.
  • Did not touch ModeSurface, GameSurface, shared mode UI, command registration, or import modules.

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 --workspace projected
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace
  • pnpm check
  • Native Tauri app manual pass not run; this is storage-command behavior covered by focused Rust tests and full repository check.

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; internal storage bugfix with no new user-facing feature or discovery entry.

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-note changes made; this is an internal storage performance/contract fix.

UI evidence

N/A; no visible UI change.

Summary by CodeRabbit

  • New Features

    • Added selective field loading capability for message and connection records, enabling more efficient data retrieval.
    • Implemented optimized single-record read paths that avoid deserializing unrequested fields.
  • Performance

    • Storage queries now intelligently load only the fields you specify, reducing memory overhead and improving overall response times when working with large records.

🔄 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/1924 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `bugfix/projected-storage-get-1919` --- ### 📝 Commits (2) - [`c0d80d8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c0d80d8f3c23bc6278c1f4d73b75cdd83861357c) Fix projected storage get reads - [`e2a4c04`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e2a4c04e5e92b37aa77bba10891a73bd2396cd49) Fix projected array field selection ### 📊 Changes **2 files changed** (+752 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/crates/storage/src/lib.rs` (+623 -9) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+129 -3) </details> ### 📄 Description ## Linked issue Closes #1919 ## Why this change - Projected `storage_get` calls accepted `fields` and `fieldSelections`, but the Rust command path still read the full matched row before trimming the returned payload. Large character/resource rows still paid full row read cost even for narrow projected gets. ## What changed - Added storage-level projected get support for matching rows. - Routed projected `storage_get` through the projected storage path for embedded Tauri and remote `/api/invoke` dispatch. - Preserved message swipe materialization by adding internal read fields only when projected message fields depend on swipes. - Preserved connection secret masking for projected `apiKey`/`hasApiKey` reads. - Added a projected pretty-file id fast path so projected gets keep the existing cold id lookup optimization and return before trailing rows. ## Refactor impact Primary owner: Rust storage and Tauri storage command path. Impact areas reviewed: - Catalog resource projected gets, especially character summaries. - Runtime projected character/message callers. - Message swipe materialization compatibility. - Connection read masking compatibility. - Embedded Tauri and remote `/api/invoke` shared `storage_get_inner` path. Boundary notes: - No React, engine, or shared API imports changed. - Feature callers continue using existing storage API wrappers. - Remote runtime behavior stays aligned because HTTP dispatch already routes through `storage_get_inner`. Pressure points touched: - Tauri/Rust storage command implementation and storage crate internals only. - Did not touch `ModeSurface`, `GameSurface`, shared mode UI, command registration, or import modules. ## 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 --workspace projected` - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` - `pnpm check` - Native Tauri app manual pass not run; this is storage-command behavior covered by focused Rust tests and full repository check. ## 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; internal storage bugfix with no new user-facing feature or discovery entry. ## 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-note changes made; this is an internal storage performance/contract fix. ## UI evidence N/A; no visible UI change. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added selective field loading capability for message and connection records, enabling more efficient data retrieval. * Implemented optimized single-record read paths that avoid deserializing unrequested fields. * **Performance** * Storage queries now intelligently load only the fields you specify, reducing memory overhead and improving overall response times when working with large records. <!-- 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:15:25 +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#5345
No description provided.