[GH-ISSUE #1790] [Issue]: Gallery parity regressions: cleanup, import rendering, and Illustrate guard #871

Closed
opened 2026-10-21 05:22:40 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @Xelvanis on GitHub (Jun 1, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1790

Originally assigned to: @SpicyMarinara on GitHub.

Summary

Gallery has several parity regressions compared with the legacy implementation:

  • deleting chats or characters no longer appears to remove associated gallery records;
  • legacy profile imports can map gallery tables into refactor collections without a usable image URL;
  • the manual gallery Illustrate in-flight guard is now component-local, so closing and reopening the drawer can allow duplicate retries.

Expected behavior

  • Deleting a chat removes its chat gallery records and associated managed image data when applicable.
  • Deleting a character removes its character gallery records and associated managed image data when applicable.
  • Legacy chat_images and character_images rows imported into refactor storage render in the gallery UI.
  • Manual gallery Illustrate keeps a per-chat pending guard across drawer close/reopen while the retry is running.

Actual behavior

Static code audit found these gaps:

  • src-tauri/src/commands/storage/chats.rs: delete_chat_with_messages removes tracker snapshots, messages, and chat rows, but does not delete matching gallery records.
  • src-tauri/src/commands/storage/commands/entities.rs: generic delete only removes owned media for characters/personas/lorebooks and tracker snapshots for messages. It does not delete character-gallery records when a character is deleted.
  • src-tauri/src/commands/storage/profile/legacy.rs: legacy chat_images and character_images tables are mapped into gallery and character-gallery.
  • src-tauri/src/commands/storage/profile/assets.rs: legacy asset normalization rewrites avatar/image/background/sprite fields, but not gallery filePath values.
  • src/features/catalog/gallery/hooks/use-gallery.ts and src/features/catalog/characters/hooks/use-characters.ts: gallery UI lists storage rows and renders image.url, so imported rows with only legacy filePath can show broken images.
  • src/shared/stores/gallery.store.ts: refactor gallery store only tracks pinned images. The legacy store had per-chat illustratingChatIds, so the pending guard survived drawer close/reopen.

Legacy comparison from the previous package layout:

  • packages/server/src/db/file-backed-store.ts cascaded chats -> chat_images and characters -> character_images.
  • packages/server/src/services/storage/chats.storage.ts removed chat gallery files on chat delete.
  • packages/server/src/routes/characters.routes.ts removed character gallery files on character delete.
  • packages/server/src/services/storage/gallery-recovery.ts recovered orphaned chat gallery files at startup.

Steps to reproduce

  1. Create or generate a gallery image for a chat.
  2. Delete that chat.
  3. Inspect the gallery collection for rows whose chatId matches the deleted chat.
  4. Upload a character gallery image.
  5. Delete that character.
  6. Inspect the character-gallery collection for rows whose characterId matches the deleted character.
  7. Import a legacy profile containing chat_images or character_images rows with filePath data and no refactor url, then open the gallery UI.
  8. Open chat gallery, click Illustrate, close/reopen the drawer while it is pending, and check whether a second retry can be started.

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-line checkout at 6cc9d086
  • Run mode: not app-run verified; static code audit only
  • OS + version: not relevant
  • Node + pnpm versions: not relevant
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not tested
  • Provider, model, or integration, if relevant: image generation only for the Illustrate retry guard

Logs, screenshots, or video

No screenshots or runtime logs. Evidence above is from static comparison of refactor gallery/storage paths against the legacy implementation.

Regression notes

The cleanup behavior existed in the legacy implementation through table cascades and explicit gallery folder removal. Exact last-good refactor commit was not identified.

Additional context

Refactor has gallery improvements such as regenerate-from-prompt and stronger character gallery lightbox focus handling. This issue only tracks the remaining parity breaks around cleanup, legacy import rendering, and duplicate manual Illustrate retries.

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 @Xelvanis on GitHub (Jun 1, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1790 Originally assigned to: @SpicyMarinara on GitHub. ## Summary Gallery has several parity regressions compared with the legacy implementation: - deleting chats or characters no longer appears to remove associated gallery records; - legacy profile imports can map gallery tables into refactor collections without a usable image URL; - the manual gallery Illustrate in-flight guard is now component-local, so closing and reopening the drawer can allow duplicate retries. ## Expected behavior - Deleting a chat removes its chat gallery records and associated managed image data when applicable. - Deleting a character removes its character gallery records and associated managed image data when applicable. - Legacy `chat_images` and `character_images` rows imported into refactor storage render in the gallery UI. - Manual gallery Illustrate keeps a per-chat pending guard across drawer close/reopen while the retry is running. ## Actual behavior Static code audit found these gaps: - `src-tauri/src/commands/storage/chats.rs`: `delete_chat_with_messages` removes tracker snapshots, messages, and chat rows, but does not delete matching `gallery` records. - `src-tauri/src/commands/storage/commands/entities.rs`: generic delete only removes owned media for characters/personas/lorebooks and tracker snapshots for messages. It does not delete `character-gallery` records when a character is deleted. - `src-tauri/src/commands/storage/profile/legacy.rs`: legacy `chat_images` and `character_images` tables are mapped into `gallery` and `character-gallery`. - `src-tauri/src/commands/storage/profile/assets.rs`: legacy asset normalization rewrites avatar/image/background/sprite fields, but not gallery `filePath` values. - `src/features/catalog/gallery/hooks/use-gallery.ts` and `src/features/catalog/characters/hooks/use-characters.ts`: gallery UI lists storage rows and renders `image.url`, so imported rows with only legacy `filePath` can show broken images. - `src/shared/stores/gallery.store.ts`: refactor gallery store only tracks pinned images. The legacy store had per-chat `illustratingChatIds`, so the pending guard survived drawer close/reopen. Legacy comparison from the previous package layout: - `packages/server/src/db/file-backed-store.ts` cascaded `chats -> chat_images` and `characters -> character_images`. - `packages/server/src/services/storage/chats.storage.ts` removed chat gallery files on chat delete. - `packages/server/src/routes/characters.routes.ts` removed character gallery files on character delete. - `packages/server/src/services/storage/gallery-recovery.ts` recovered orphaned chat gallery files at startup. ## Steps to reproduce 1. Create or generate a gallery image for a chat. 2. Delete that chat. 3. Inspect the `gallery` collection for rows whose `chatId` matches the deleted chat. 4. Upload a character gallery image. 5. Delete that character. 6. Inspect the `character-gallery` collection for rows whose `characterId` matches the deleted character. 7. Import a legacy profile containing `chat_images` or `character_images` rows with `filePath` data and no refactor `url`, then open the gallery UI. 8. Open chat gallery, click Illustrate, close/reopen the drawer while it is pending, and check whether a second retry can be started. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [x] Chat mode - [x] Roleplay mode - [x] Game mode - [x] Shared mode UI - [x] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] 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 - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: refactor-line checkout at `6cc9d086` - Run mode: not app-run verified; static code audit only - OS + version: not relevant - Node + pnpm versions: not relevant - Rust version, if relevant: not relevant - Remote Runtime URL configured? not tested - Provider, model, or integration, if relevant: image generation only for the Illustrate retry guard ## Logs, screenshots, or video No screenshots or runtime logs. Evidence above is from static comparison of refactor gallery/storage paths against the legacy implementation. ## Regression notes The cleanup behavior existed in the legacy implementation through table cascades and explicit gallery folder removal. Exact last-good refactor commit was not identified. ## Additional context Refactor has gallery improvements such as regenerate-from-prompt and stronger character gallery lightbox focus handling. This issue only tracks the remaining parity breaks around cleanup, legacy import rendering, and duplicate manual Illustrate retries. ## 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:22:40 +07:00
Author
Owner

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

Fixed on refactor in 02ccbcf9.\n\nWhat changed:\n- Chat deletion now removes matching chat gallery rows and managed gallery files.\n- Character deletion now removes matching character-gallery rows and managed gallery files.\n- Direct gallery row deletion also removes managed gallery files when present.\n- Legacy profile import now resolves chat_images/character_images filePath values into renderable data URLs and backfills filenames.\n- Gallery query hooks normalize imported rows that have filePath but no url.\n- Manual Illustrate now uses a per-chat pending guard in the gallery store, so closing/reopening the drawer cannot start a duplicate retry while one is running.\n\nVerification:\n- pnpm typecheck\n- pnpm check:architecture\n- cargo check --manifest-path src-tauri/Cargo.toml\n- cargo test --manifest-path src-tauri/Cargo.toml gallery\n- git diff --check

<!-- gh-comment-id:4591508624 --> @SpicyMarinara commented on GitHub (Jun 1, 2026): Fixed on refactor in 02ccbcf9.\n\nWhat changed:\n- Chat deletion now removes matching chat gallery rows and managed gallery files.\n- Character deletion now removes matching character-gallery rows and managed gallery files.\n- Direct gallery row deletion also removes managed gallery files when present.\n- Legacy profile import now resolves chat_images/character_images filePath values into renderable data URLs and backfills filenames.\n- Gallery query hooks normalize imported rows that have filePath but no url.\n- Manual Illustrate now uses a per-chat pending guard in the gallery store, so closing/reopening the drawer cannot start a duplicate retry while one is running.\n\nVerification:\n- pnpm typecheck\n- pnpm check:architecture\n- cargo check --manifest-path src-tauri/Cargo.toml\n- cargo test --manifest-path src-tauri/Cargo.toml gallery\n- 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#871
No description provided.