[GH-ISSUE #2497] [Issue]: Projected storage_list cache validation hashes full collection files #1237

Closed
opened 2026-10-21 05:29:34 +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/2497

Originally assigned to: @Promansis on GitHub.

Summary

CrabNebula DevTools reports slow storage_list calls. Investigation on the refactor branch found that projected storage_list cache validation recalculates a collection file stamp by hashing the whole collection file before it can return a cached projected list.

Code pointers from the current checkout:

  • src-tauri/crates/storage/src/lib.rs:1068 calls collection_file_stamp while serving projected lists.
  • src-tauri/crates/storage/src/lib.rs:2323 computes the stamp by reading and hashing the collection file.
  • An existing same-length rewrite test appears to confirm the full-file hash behavior is intentional.

Expected behavior

Repeated projected storage_list calls against an unchanged collection should hit a cache through cheap validation, such as an in-memory collection generation, metadata/mtime plus size where sufficient, or another storage-owned revision marker.

Actual behavior

Projected list cache validation is still proportional to the full JSON collection file size. Large collections can therefore make a cache hit look slow in CrabNebula DevTools because every projected list call streams and hashes the file before returning.

Steps to reproduce

  1. Use the refactor branch with a large stored collection that is queried through projected storage_list.
  2. Open the app under CrabNebula DevTools.
  3. Trigger UI or runtime flows that repeatedly list that collection.
  4. Observe storage_list taking a long time even when the projected result should already be cached.

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_list 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 likely affects hot projected list paths such as character/persona/chat summary lists and other collection-backed UI surfaces. A likely fix target is to avoid per-call full-file hashing for projected cache validation and instead invalidate projected caches through storage-owned revision state when writes/imports mutate the collection.

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/2497 Originally assigned to: @Promansis on GitHub. ## Summary CrabNebula DevTools reports slow `storage_list` calls. Investigation on the refactor branch found that projected `storage_list` cache validation recalculates a collection file stamp by hashing the whole collection file before it can return a cached projected list. Code pointers from the current checkout: - `src-tauri/crates/storage/src/lib.rs:1068` calls `collection_file_stamp` while serving projected lists. - `src-tauri/crates/storage/src/lib.rs:2323` computes the stamp by reading and hashing the collection file. - An existing same-length rewrite test appears to confirm the full-file hash behavior is intentional. ## Expected behavior Repeated projected `storage_list` calls against an unchanged collection should hit a cache through cheap validation, such as an in-memory collection generation, metadata/mtime plus size where sufficient, or another storage-owned revision marker. ## Actual behavior Projected list cache validation is still proportional to the full JSON collection file size. Large collections can therefore make a cache hit look slow in CrabNebula DevTools because every projected list call streams and hashes the file before returning. ## Steps to reproduce 1. Use the refactor branch with a large stored collection that is queried through projected `storage_list`. 2. Open the app under CrabNebula DevTools. 3. Trigger UI or runtime flows that repeatedly list that collection. 4. Observe `storage_list` taking a long time even when the projected result should already be cached. ## 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_list` 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 likely affects hot projected list paths such as character/persona/chat summary lists and other collection-backed UI surfaces. A likely fix target is to avoid per-call full-file hashing for projected cache validation and instead invalidate projected caches through storage-owned revision state when writes/imports mutate the collection. ## 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:34 +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#1237
No description provided.