[GH-ISSUE #2498] [Issue]: storage_get scans collection files instead of using id lookups #1239

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

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

Originally assigned to: @Promansis on GitHub.

Summary

CrabNebula DevTools reports slow storage_get calls. Investigation on the refactor branch found that storage_get has no id index for clean projected reads, so it can scan JSON collection rows until it finds the requested id. Plain gets can also scan when the full-row cache is cold.

Code pointers from the current checkout:

  • src-tauri/crates/storage/src/lib.rs:1274 clean projected get scans the JSON file until the id matches.
  • src-tauri/crates/storage/src/lib.rs:1236 plain get also scans if the full-row cache is cold.
  • Many UI and engine paths can issue repeated gets during panel opening, prompt assembly, or runtime flows, so one missing index can appear as many slow storage_get calls.

Expected behavior

Repeated storage_get calls by id should be close to constant time after storage is initialized, including projected gets. Hot collections should have an id lookup path or equivalent index/cache strategy that avoids repeatedly scanning collection JSON.

Actual behavior

Projected clean gets bypass the clean full-row cache and scan the collection file for the requested id. Large collections or repeated get-heavy flows can therefore show slow storage_get calls in CrabNebula DevTools.

Steps to reproduce

  1. Use the refactor branch with a large collection that is queried repeatedly by id.
  2. Open the app under CrabNebula DevTools.
  3. Trigger a get-heavy flow, such as opening catalog-backed panels or generation/prompt flows that resolve related records.
  4. Observe repeated storage_get calls taking a long time.

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 at f9fc46b9
  • Run mode: Tauri desktop with CrabNebula DevTools
  • OS + version: Windows 11 Pro 10.0.26200
  • Node + pnpm versions: Node v24.12.0, pnpm 10.33.2
  • Rust version, if relevant: rustc 1.95.0 (59807616e 2026-04-14)
  • Remote Runtime URL configured? not relevant / unknown
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No screenshot attached. Local observation was CrabNebula DevTools showing slow storage_get calls.

Focused storage tests were run during investigation and passed. The code path above is the suspected root cause.

Regression notes

Unknown whether this regressed from a previous storage implementation or became visible as collection sizes grew.

Additional context

This issue is separate from projected storage_list cache validation hashing the full collection file. Both can contribute to slow storage timings, but storage_get needs an id-oriented lookup/index/cache path while storage_list needs cheaper projected-cache validation.

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 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2498 Originally assigned to: @Promansis on GitHub. ## Summary CrabNebula DevTools reports slow `storage_get` calls. Investigation on the refactor branch found that `storage_get` has no id index for clean projected reads, so it can scan JSON collection rows until it finds the requested id. Plain gets can also scan when the full-row cache is cold. Code pointers from the current checkout: - `src-tauri/crates/storage/src/lib.rs:1274` clean projected `get` scans the JSON file until the id matches. - `src-tauri/crates/storage/src/lib.rs:1236` plain `get` also scans if the full-row cache is cold. - Many UI and engine paths can issue repeated gets during panel opening, prompt assembly, or runtime flows, so one missing index can appear as many slow `storage_get` calls. ## Expected behavior Repeated `storage_get` calls by id should be close to constant time after storage is initialized, including projected gets. Hot collections should have an id lookup path or equivalent index/cache strategy that avoids repeatedly scanning collection JSON. ## Actual behavior Projected clean gets bypass the clean full-row cache and scan the collection file for the requested id. Large collections or repeated get-heavy flows can therefore show slow `storage_get` calls in CrabNebula DevTools. ## Steps to reproduce 1. Use the refactor branch with a large collection that is queried repeatedly by id. 2. Open the app under CrabNebula DevTools. 3. Trigger a get-heavy flow, such as opening catalog-backed panels or generation/prompt flows that resolve related records. 4. Observe repeated `storage_get` calls taking a long time. ## 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 - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor` at `f9fc46b9` - Run mode: Tauri desktop with CrabNebula DevTools - OS + version: Windows 11 Pro 10.0.26200 - Node + pnpm versions: Node `v24.12.0`, pnpm `10.33.2` - Rust version, if relevant: `rustc 1.95.0 (59807616e 2026-04-14)` - Remote Runtime URL configured? not relevant / unknown - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No screenshot attached. Local observation was CrabNebula DevTools showing slow `storage_get` calls. Focused storage tests were run during investigation and passed. The code path above is the suspected root cause. ## Regression notes Unknown whether this regressed from a previous storage implementation or became visible as collection sizes grew. ## Additional context This issue is separate from projected `storage_list` cache validation hashing the full collection file. Both can contribute to slow storage timings, but `storage_get` needs an id-oriented lookup/index/cache path while `storage_list` needs cheaper projected-cache validation. ## 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:29:44 +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#1239
No description provided.