[PR #2180] [MERGED] Normalize inline images into managed storage #5459

Closed
opened 2026-10-22 04:16:30 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2180
Author: @Xelvanis
Created: 6/4/2026
Status: ✅ Merged
Merged: 6/4/2026
Merged by: @Xelvanis

Base: refactor ← Head: fix/inline-image-storage-migration


📝 Commits (6)

  • cb64250 Normalize inline images into managed storage
  • 9bc8be8 Cover inline image migration gaps
  • cba7962 Address image migration review findings
  • 22d9e79 Handle case-variant inline image data URLs
  • be9e4ff Harden managed gallery row persistence
  • 8f64214 Merge refactor into inline image storage migration

📊 Changes

10 files changed (+1337 additions, -41 deletions)

View changed files

📝 src-tauri/crates/storage/src/lib.rs (+26 -2)
📝 src-tauri/src/commands/storage.rs (+2 -0)
📝 src-tauri/src/commands/storage/avatars.rs (+9 -5)
📝 src-tauri/src/commands/storage/commands/entities.rs (+37 -1)
📝 src-tauri/src/commands/storage/imports/marinara_assets.rs (+3 -2)
📝 src-tauri/src/commands/storage/profile/assets.rs (+31 -3)
📝 src-tauri/src/commands/storage/profile/legacy.rs (+150 -27)
📝 src-tauri/src/commands/storage/shared.rs (+1 -1)
➕ src-tauri/src/commands/storage/startup_migrations.rs (+731 -0)
📝 src-tauri/src/state.rs (+347 -0)

📄 Description

Linked issue

N/A

Why this change

  • Inline image attachments and imported gallery records could keep data:image/... URLs in persisted storage instead of using managed file-backed asset URLs.
  • Startup migration logic had grown too large inside app state startup orchestration.

What changed

  • Added a Rust storage startup migration module for inline image reference normalization.
  • Backfilled inline message and sidecar swipe attachments into managed gallery records.
  • Normalized restorable legacy profile gallery rows to use managed asset URLs and file paths.
  • Kept app startup state focused on orchestration by moving migration implementation into storage-owned code.

Refactor impact

Primary owner:

Rust storage

Impact areas reviewed:

  • App startup storage initialization
  • Message and sidecar swipe attachment persistence
  • Gallery record backfill behavior
  • Legacy profile gallery asset restoration
  • Avatar and gallery managed asset URL handling

Boundary notes:

  • No React, engine, shared API, or remote-runtime changes.
  • Privileged filesystem and persistence behavior stays in src-tauri storage modules.

Pressure points touched:

  • src-tauri/src/state.rs startup orchestration
  • Storage profile import modules
  • No src-tauri/src/lib.rs command registration, ModeSurface, GameSurface, or shared mode UI changes.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • cargo test --manifest-path src-tauri/Cargo.toml app_state_startup_persists_inline_message_attachment_urls
  • cargo test --manifest-path src-tauri/Cargo.toml legacy_gallery_rows_gain_renderable_urls_from_file_paths
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm check

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • N/A: this is an internal Rust storage migration/import compatibility fix and does not add a new discoverable user workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

No docs changes needed: this is an internal storage migration/import bugfix and refactor, with no public command, workflow, or setup documentation change.

UI evidence

N/A: no visible UI changes.

Summary by CodeRabbit

Release Notes

  • New Features

    • Automatic startup migration converts embedded image data to persistent managed file storage, including avatars, galleries, and chat attachments.
  • Improvements

    • Images are now stored individually on disk instead of embedded as data, improving application performance and reducing file sizes.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/2180 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 6/4/2026 **Status:** ✅ Merged **Merged:** 6/4/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `fix/inline-image-storage-migration` --- ### 📝 Commits (6) - [`cb64250`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cb6425035ac95160c4a650ee5face0d541e549c7) Normalize inline images into managed storage - [`9bc8be8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/9bc8be8a60ccea5297487560b214c374761f463f) Cover inline image migration gaps - [`cba7962`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cba7962e25ccf2a96f52f7512e7604809a40646e) Address image migration review findings - [`22d9e79`](https://github.com/Pasta-Devs/Marinara-Engine/commit/22d9e79a67f176d5e67e0099680c95a87deed9ff) Handle case-variant inline image data URLs - [`be9e4ff`](https://github.com/Pasta-Devs/Marinara-Engine/commit/be9e4ffb45963c676b56ac98d6f46c3eebb39451) Harden managed gallery row persistence - [`8f64214`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8f64214f969ab5f2f8536b4ff70112f5125123ba) Merge refactor into inline image storage migration ### 📊 Changes **10 files changed** (+1337 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/crates/storage/src/lib.rs` (+26 -2) 📝 `src-tauri/src/commands/storage.rs` (+2 -0) 📝 `src-tauri/src/commands/storage/avatars.rs` (+9 -5) 📝 `src-tauri/src/commands/storage/commands/entities.rs` (+37 -1) 📝 `src-tauri/src/commands/storage/imports/marinara_assets.rs` (+3 -2) 📝 `src-tauri/src/commands/storage/profile/assets.rs` (+31 -3) 📝 `src-tauri/src/commands/storage/profile/legacy.rs` (+150 -27) 📝 `src-tauri/src/commands/storage/shared.rs` (+1 -1) ➕ `src-tauri/src/commands/storage/startup_migrations.rs` (+731 -0) 📝 `src-tauri/src/state.rs` (+347 -0) </details> ### 📄 Description ## Linked issue N/A ## Why this change - Inline image attachments and imported gallery records could keep `data:image/...` URLs in persisted storage instead of using managed file-backed asset URLs. - Startup migration logic had grown too large inside app state startup orchestration. ## What changed - Added a Rust storage startup migration module for inline image reference normalization. - Backfilled inline message and sidecar swipe attachments into managed gallery records. - Normalized restorable legacy profile gallery rows to use managed asset URLs and file paths. - Kept app startup state focused on orchestration by moving migration implementation into storage-owned code. ## Refactor impact Primary owner: Rust storage Impact areas reviewed: - App startup storage initialization - Message and sidecar swipe attachment persistence - Gallery record backfill behavior - Legacy profile gallery asset restoration - Avatar and gallery managed asset URL handling Boundary notes: - No React, engine, shared API, or remote-runtime changes. - Privileged filesystem and persistence behavior stays in `src-tauri` storage modules. Pressure points touched: - `src-tauri/src/state.rs` startup orchestration - Storage profile import modules - No `src-tauri/src/lib.rs` command registration, ModeSurface, GameSurface, or shared mode UI changes. ## Validation - [x] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [x] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes - `cargo test --manifest-path src-tauri/Cargo.toml app_state_startup_persists_inline_message_attachment_urls` - `cargo test --manifest-path src-tauri/Cargo.toml legacy_gallery_rows_gain_renderable_urls_from_file_paths` - `cargo check --manifest-path src-tauri/Cargo.toml` - `pnpm check` ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - N/A: this is an internal Rust storage migration/import compatibility fix and does not add a new discoverable user workflow. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims No docs changes needed: this is an internal storage migration/import bugfix and refactor, with no public command, workflow, or setup documentation change. ## UI evidence N/A: no visible UI changes. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Automatic startup migration converts embedded image data to persistent managed file storage, including avatars, galleries, and chat attachments. * **Improvements** * Images are now stored individually on disk instead of embedded as data, improving application performance and reducing file sizes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:30 +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#5459
No description provided.