mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #1893] Restore centralized storage schema/default and relation repair contracts #919
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#919
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/1893
Originally assigned to: @Promansis on GitHub.
What problem does this solve?
Refactor storage is intentionally lightweight, but several storage contracts that legacy kept centralized are now scattered across command modules and startup repair code:
Legacy file-native storage kept a table registry, schema metadata, default row normalization, and a cascade map. Refactor compensates in several targeted places, but there is no single storage contract surface that proves all supported collections have defaults, cleanup behavior, and profile coverage.
Proposed behavior
Add a centralized storage contract registry for refactor collections that can answer:
This does not need to make storage heavy. It can be a focused Rust-side registry plus command-layer helpers where product behavior still belongs outside the low-level file store.
Expected owner or impact area
Refactor branch considerations
Keep product behavior in the owning feature/engine modules and keep privileged persistence in Rust. Avoid moving React/UI concepts into the storage crate. Preserve the refactor storage improvements that are better than legacy, especially streaming/projected message reads and append-oriented chat/message writes.
Alternatives considered
Leaving the current scattered repair paths avoids a new registry, but it makes future collection additions easy to miss in profile export, startup repair, delete cleanup, and remote-runtime validation.
Additional context
Static comparison points:
FileStoragehandles generic JSON collections insrc-tauri/crates/storage/src/lib.rs.src-tauri/src/state.rs.src-tauri/src/commands/storage/shared.rs.src-tauri/src/commands/storage/profile.rs.FILE_BACKED_TABLES, schema metadata/default normalization, andCASCADESinpackages/server/src/db/file-backed-store.ts.Recommended first slice: create a registry for supported collections, then migrate duplicate-ID handling, profile coverage checks, and relation cleanup tests onto that registry.
Template check
@Xelvanis commented on GitHub (Jun 2, 2026):
Additional concrete acceptance case for this storage-contract registry: #1895 tracks remote storage write behavior that still depends on duplicated command logic rather than one shared storage command surface.
Current code has embedded-only guards/side effects for
connectionsandchat-presets:defaultForAgentsclears other defaults in the same scope on the embedded pathThe remote
/api/invokestorage write path duplicatesstorage_create/storage_updateand can bypass those behaviors. A future registry/shared-command cleanup should prove both embedded and remote writes use the same entity contract.