mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1933] [Feature]: add warm storage cache and debounced flush parity for Tauri storage #948
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#948
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Xelvanis on GitHub (Jun 2, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1933
Originally assigned to: @SpicyMarinara on GitHub.
What problem does this solve?
The refactor storage path still differs from legacy in a way that can explain broad lag or slow responsiveness even after narrow projection fixes.
Legacy 1.6.1 file-native storage keeps table snapshots warm in memory and persists dirty tables on a debounce. Refactor
FileStoragemostly reads/parses collection files per operation and writes pretty JSON immediately for patch/update/delete. That leaves repeated UI reads, metadata patches, tracker updates, imports, deletes, and post-generation writes exposed to disk and JSON parse/write cost.Proposed behavior
Add a storage-level performance path that restores the important legacy behavior without breaking the Tauri/refactor storage contract:
list,get, filtered list, projected get/list, message page/count/id reads from the cache or an equivalent index when safe;/api/invokebehavior identical;This can start as a timing harness and design issue before changing persistence semantics.
Evidence
Legacy static evidence:
packages/server/src/db/file-backed-store.ts:148-:150definesSAVE_DEBOUNCE_MS = 750andSAFETY_SAVE_MS = 10_000.packages/server/src/db/file-backed-store.ts:783keeps tables inMap<string, Row[]>.packages/server/src/db/file-backed-store.ts:980-:988marks dirty tables and schedules debounced flush.packages/server/src/db/file-backed-store.ts:1217-:1226writes only dirty table snapshots during save.packages/server/src/db/file-backed-store.ts:1243-:1251installs safety/before-exit flushes.Refactor static evidence:
src-tauri/crates/storage/src/lib.rs:16-:29stores only root path plus lock; no warm table cache or durable id index is visible.src-tauri/crates/storage/src/lib.rs:469-:516reads collection files from disk for full/filtered reads.src-tauri/crates/storage/src/lib.rs:923-:930writes full pretty JSON collections atomically.src-tauri/crates/storage/src/lib.rs:205-:245patch/update paths read the collection, mutate, then write the collection immediately.src-tauri/crates/storage/src/lib.rs:933-:1000has an append optimization for new chats/messages, but patch/update/delete still rewrite collections.Refactor has important targeted optimizations already, including projected gets, projected lists, message id/count/page readers, and remote/embedded storage helper parity. This issue is about the remaining broad storage backend shape.
Expected owner or impact area
Refactor branch considerations
This is user-data and persistence-sensitive work. Required proof should include:
storage_list, projectedstorage_get, paged message reads, writes, deletes, and metadata patches;/api/invokeparity;Alternatives considered
Continue adding narrow streaming/projection fast paths. Those help specific commands and should continue where they are small, but they do not restore legacy warm-read/debounced-write behavior across the whole storage surface.
Move directly to a physical schema split for messages/swipes. That may still be valuable for large swipe histories, but it is a larger storage migration and does not address repeated full-file reads/writes for other collections.
Additional context
Related but not duplicate:
Template check
Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:
@SpicyMarinara commented on GitHub (Jun 2, 2026):
Implemented the first storage-shape fix on
refactorin commit0a6fc394(Add warm storage cache and debounced flush).What changed:
FileStorage.get, message counts, message IDs, and paged message reads can serve from cached rows once warm.Verification run locally:
git diff --checkcargo check --manifest-path src-tauri/Cargo.tomlpnpm typecheckpnpm check:architecturepnpm check:unusedpnpm buildLeaving this open for now because the issue also asks for timing proof and broader cold/warm native measurements.