[GH-ISSUE #2018] Projected storage reads reuse full-row cache #990

Closed
opened 2026-10-21 05:24:52 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2018

Originally assigned to: @Promansis on GitHub.

Summary

Projected storage_get and storage_list reads can become slow again after a full collection read populates the new full-row storage cache. The projection paths still exist, but they project from cached full rows instead of streaming/skipping unrequested fields from disk.

Expected behavior

Projected storage reads should avoid loading or walking unrequested heavy fields, even when a full collection cache exists from another code path.

Actual behavior

After a non-projected read caches a collection, later projected reads first use the cached full rows and only then apply projection. Large character, chat, or message payloads can therefore re-enter the hot path.

Steps to reproduce

  1. Start from refactor at f94b18ea.
  2. Trigger or inspect an unprojected collection read that calls read_collection / read_collection_no_recovery.
  3. Trigger a projected storage_get or storage_list for the same collection.
  4. Observe that the projected path uses cached full rows instead of the streaming projected reader.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor / f94b18ea
  • Run mode: Tauri desktop / remote runtime likely affected through shared storage capability
  • OS + version: not captured
  • Node + pnpm versions: not captured
  • Rust version, if relevant: not captured
  • Remote Runtime URL configured? not captured
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

Relevant code paths:

  • src-tauri/src/commands/storage/commands/entities.rs: projected storage_list / storage_get dispatch remains present.
  • src-tauri/crates/storage/src/lib.rs: read_collection caches full rows; projected readers check cached_rows before streaming projection.

Focused projection tests still pass, so this is not a total overwrite of the previous projection fix. It is a cache interaction regression.

Regression notes

This started after the projected storage read optimization work. The likely regression interaction is from 7a09bef8 Add storage collection prep helpers (#2008), which added full collection cache reads that projected paths now consult first.

Additional context

The root fix should preserve the full-row cache for paths that need it while keeping projected reads on a projection-first path for heavy collections/requests.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2018 Originally assigned to: @Promansis on GitHub. ## Summary Projected `storage_get` and `storage_list` reads can become slow again after a full collection read populates the new full-row storage cache. The projection paths still exist, but they project from cached full rows instead of streaming/skipping unrequested fields from disk. ## Expected behavior Projected storage reads should avoid loading or walking unrequested heavy fields, even when a full collection cache exists from another code path. ## Actual behavior After a non-projected read caches a collection, later projected reads first use the cached full rows and only then apply projection. Large character, chat, or message payloads can therefore re-enter the hot path. ## Steps to reproduce 1. Start from `refactor` at `f94b18ea`. 2. Trigger or inspect an unprojected collection read that calls `read_collection` / `read_collection_no_recovery`. 3. Trigger a projected `storage_get` or `storage_list` for the same collection. 4. Observe that the projected path uses cached full rows instead of the streaming projected reader. ## Impact area <!-- Check the areas you think are relevant. Leave uncertain items unchecked. --> - [ ] App shell, navigation, startup, or providers - [ ] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` / `f94b18ea` - Run mode: Tauri desktop / remote runtime likely affected through shared storage capability - OS + version: not captured - Node + pnpm versions: not captured - Rust version, if relevant: not captured - Remote Runtime URL configured? not captured - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video Relevant code paths: - `src-tauri/src/commands/storage/commands/entities.rs`: projected `storage_list` / `storage_get` dispatch remains present. - `src-tauri/crates/storage/src/lib.rs`: `read_collection` caches full rows; projected readers check `cached_rows` before streaming projection. Focused projection tests still pass, so this is not a total overwrite of the previous projection fix. It is a cache interaction regression. ## Regression notes This started after the projected storage read optimization work. The likely regression interaction is from `7a09bef8 Add storage collection prep helpers (#2008)`, which added full collection cache reads that projected paths now consult first. ## Additional context The root fix should preserve the full-row cache for paths that need it while keeping projected reads on a projection-first path for heavy collections/requests. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:24:52 +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#990
No description provided.