[GH-ISSUE #1572] [Feature]: Add a profile export/import format that scales beyond monolithic JSON #810

Closed
opened 2026-10-21 05:21:25 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @cha1latte on GitHub (May 29, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1572

Originally assigned to: @SpicyMarinara on GitHub.

What problem does this solve?

Heavy profile import/export still has a scaling and data-contract risk after the immediate #1511 fix. Marinara profiles are still conceptually treated as one monolithic marinara-profile.json envelope, which puts large tables and inline data such as chat memories, notes, messages, gallery metadata, and other future bulky records under one JSON-size/memory assumption.

That makes future heavy-user profiles fragile: a single large table can make the whole profile hard to read, validate, preview, back up, import safely, or partially recover.

Proposed behavior

Add a next-generation profile export/import format that can scale beyond one huge inline JSON document while preserving backward compatibility with current exports.

The format should define a clear manifest and per-table or chunked record contract, for example:

  • A manifest with profile version, app version, exported table list, counts, byte sizes, and compatibility metadata.
  • Separate files or chunks for large record groups such as chats, messages, memories, notes, assets/index data, and settings.
  • Streaming or staged import so Marinara can validate and report planned changes before destructive replacement.
  • Per-table normalization/validation hooks so legacy field-shape fixes do not only live in one import path.
  • A preflight summary that makes destructive import behavior clear before the user commits.
  • Backward-compatible support for current v1 marinara-profile.json exports.

Expected owner or impact area

  • App shell, navigation, startup, or providers
  • Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge
  • 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

Refactor branch considerations

  • Do not solve this only by raising profile JSON size limits.
  • Preserve import compatibility for current exports and any legacy profiles already in the wild.
  • Keep destructive import confirmation explicit and data-specific.
  • Validate current and legacy record shapes at the import/storage boundary, not only in UI.
  • Consider remote-runtime and Tauri desktop paths separately so the format does not assume one host transport.
  • Keep the first implementation slice small enough to review, likely starting with a documented v2 manifest/chunk contract plus read-only preflight.

Alternatives considered

  • Keep increasing the monolithic JSON read cap: rejected because it delays the same failure mode and does not improve validation, preview, or recovery.
  • Keep the current format and rely on manual backups: insufficient because the app owns the destructive import workflow and should make large-profile risks visible.
  • Split only chats.memories: potentially a good first slice, but the format should be designed so other large record groups can use the same contract later.

Additional context

Related issues:

  • #1511 fixed the immediate heavy-profile import cap failure.
  • #1512 covered clearer confirmation for destructive profile import.
  • #1513 covered legacy lorebook-entry field normalization during import.
  • #1518 was the implementation PR that closed the immediate import fixes.

This follow-up comes from the focused system-boundary/data-contract audit and should track the longer-term profile contract rather than reopen the already-fixed emergency import issues.

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 @cha1latte on GitHub (May 29, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1572 Originally assigned to: @SpicyMarinara on GitHub. ## What problem does this solve? Heavy profile import/export still has a scaling and data-contract risk after the immediate #1511 fix. Marinara profiles are still conceptually treated as one monolithic `marinara-profile.json` envelope, which puts large tables and inline data such as chat memories, notes, messages, gallery metadata, and other future bulky records under one JSON-size/memory assumption. That makes future heavy-user profiles fragile: a single large table can make the whole profile hard to read, validate, preview, back up, import safely, or partially recover. ## Proposed behavior Add a next-generation profile export/import format that can scale beyond one huge inline JSON document while preserving backward compatibility with current exports. The format should define a clear manifest and per-table or chunked record contract, for example: - A manifest with profile version, app version, exported table list, counts, byte sizes, and compatibility metadata. - Separate files or chunks for large record groups such as chats, messages, memories, notes, assets/index data, and settings. - Streaming or staged import so Marinara can validate and report planned changes before destructive replacement. - Per-table normalization/validation hooks so legacy field-shape fixes do not only live in one import path. - A preflight summary that makes destructive import behavior clear before the user commits. - Backward-compatible support for current v1 `marinara-profile.json` exports. ## Expected owner or impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources: chats, characters, personas, lorebooks, presets, connections, agents, gallery, or knowledge - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [x] React-free engine behavior, contracts, agents, or capability ports - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [x] Docs, contributor workflow, or templates ## Refactor branch considerations - Do not solve this only by raising profile JSON size limits. - Preserve import compatibility for current exports and any legacy profiles already in the wild. - Keep destructive import confirmation explicit and data-specific. - Validate current and legacy record shapes at the import/storage boundary, not only in UI. - Consider remote-runtime and Tauri desktop paths separately so the format does not assume one host transport. - Keep the first implementation slice small enough to review, likely starting with a documented v2 manifest/chunk contract plus read-only preflight. ## Alternatives considered - Keep increasing the monolithic JSON read cap: rejected because it delays the same failure mode and does not improve validation, preview, or recovery. - Keep the current format and rely on manual backups: insufficient because the app owns the destructive import workflow and should make large-profile risks visible. - Split only `chats.memories`: potentially a good first slice, but the format should be designed so other large record groups can use the same contract later. ## Additional context Related issues: - #1511 fixed the immediate heavy-profile import cap failure. - #1512 covered clearer confirmation for destructive profile import. - #1513 covered legacy lorebook-entry field normalization during import. - #1518 was the implementation PR that closed the immediate import fixes. This follow-up comes from the focused system-boundary/data-contract audit and should track the longer-term profile contract rather than reopen the already-fixed emergency import issues. ## 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.
Author
Owner

@cha1latte commented on GitHub (May 29, 2026):

Triage note: labeling this as scope-risk because it changes the profile import/export storage contract, touches destructive import behavior, and needs a narrowed v2/archive plan before implementation.

A good first slice is to define the manifest/chunk contract and preserve v1 import compatibility before changing the write/import behavior.

<!-- gh-comment-id:4576348611 --> @cha1latte commented on GitHub (May 29, 2026): Triage note: labeling this as `scope-risk` because it changes the profile import/export storage contract, touches destructive import behavior, and needs a narrowed v2/archive plan before implementation. A good first slice is to define the manifest/chunk contract and preserve v1 import compatibility before changing the write/import behavior.
Author
Owner

@SpicyMarinara commented on GitHub (Jun 1, 2026):

Perhaps a folder the user could point to for imports?

<!-- gh-comment-id:4591232175 --> @SpicyMarinara commented on GitHub (Jun 1, 2026): Perhaps a folder the user could point to for imports?
Author
Owner

@SpicyMarinara commented on GitHub (Jun 1, 2026):

Resolved first contract slice on refactor in eaf49303.

What changed:

  • Added docs/profile-export-format-v2.md.
  • Defined a v2 zip/archive shape with manifest.json, table JSONL chunks, and asset index space.
  • Kept v1 marinara-profile.json compatibility as a requirement.
  • Captured folder import as an unpacked v2 archive with the same manifest/preflight rules.
  • Explicitly split future implementation into export, preflight, import commit, and folder-selection follow-ups.

Verification:

  • pnpm check:docs
  • git diff --check
<!-- gh-comment-id:4592049781 --> @SpicyMarinara commented on GitHub (Jun 1, 2026): Resolved first contract slice on refactor in eaf49303. What changed: - Added docs/profile-export-format-v2.md. - Defined a v2 zip/archive shape with manifest.json, table JSONL chunks, and asset index space. - Kept v1 marinara-profile.json compatibility as a requirement. - Captured folder import as an unpacked v2 archive with the same manifest/preflight rules. - Explicitly split future implementation into export, preflight, import commit, and folder-selection follow-ups. Verification: - pnpm check:docs - git diff --check
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#810
No description provided.