[GH-ISSUE #1930] Avoid eager base64 payloads when listing sprite libraries #945

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

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

Originally assigned to: @cha1latte on GitHub.

Summary

Refactor sprite listing reads every sprite file and returns each image as a base64 data URL. Legacy sprite listing returned file-backed URLs with cache-busting metadata, which avoids sending every image byte through the list command.

Expected behavior

Sprite list APIs should return metadata and resolvable managed URLs, so large sprite libraries do not require every image to be base64-encoded into the command response before the UI can render.

Actual behavior

list_sprites_for_dir builds each sprite item through sprite_info_from_path, which returns url: data:<mime>;base64,.... UI-side lazy image loading cannot reduce the command payload because all bytes are already in the list response.

Evidence:

  • Refactor encodes sprite data URLs at src-tauri/src/commands/storage/sprites.rs:1624.
  • Refactor list loop starts at src-tauri/src/commands/storage/sprites.rs:1632.
  • Legacy sprite routes returned file URLs with ?v=<mtime> cache busting from the data/sprites/<id> file store.

Steps to reproduce

  1. Create or import a character/persona with many sprite images.
  2. Open the sprite grid/list view.
  3. Observe that the list command must load and return every sprite image as base64 data before rendering.

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 audit at 8c36be60
  • Run mode: Static code audit; expected to affect Tauri desktop and remote runtime payload size
  • OS + version: Not relevant
  • Node + pnpm versions: Not relevant
  • Rust version, if relevant: Not relevant
  • Remote Runtime URL configured? Relevant for payload size over HTTP runtime
  • Provider, model, or integration, if relevant: Sprite library/media assets

Logs, screenshots, or video

No runtime logs or screenshots. Static parity evidence only.

Regression notes

Legacy sprite listing used file-backed URLs. Refactor appears to send sprite image bytes inline for every listed sprite.

Additional context

This came from parity target 4, media and assets, under #1904. Suggested fix path: return sprite metadata plus managed sprite URLs, and resolve images through the asset URL layer instead of embedding every sprite in the list response.

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 2, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1930 Originally assigned to: @cha1latte on GitHub. ## Summary Refactor sprite listing reads every sprite file and returns each image as a base64 data URL. Legacy sprite listing returned file-backed URLs with cache-busting metadata, which avoids sending every image byte through the list command. ## Expected behavior Sprite list APIs should return metadata and resolvable managed URLs, so large sprite libraries do not require every image to be base64-encoded into the command response before the UI can render. ## Actual behavior `list_sprites_for_dir` builds each sprite item through `sprite_info_from_path`, which returns `url: data:<mime>;base64,...`. UI-side lazy image loading cannot reduce the command payload because all bytes are already in the list response. Evidence: - Refactor encodes sprite data URLs at `src-tauri/src/commands/storage/sprites.rs:1624`. - Refactor list loop starts at `src-tauri/src/commands/storage/sprites.rs:1632`. - Legacy sprite routes returned file URLs with `?v=<mtime>` cache busting from the `data/sprites/<id>` file store. ## Steps to reproduce 1. Create or import a character/persona with many sprite images. 2. Open the sprite grid/list view. 3. Observe that the list command must load and return every sprite image as base64 data before rendering. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [ ] Chat mode - [x] Roleplay mode - [ ] 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 audit at `8c36be60` - Run mode: Static code audit; expected to affect Tauri desktop and remote runtime payload size - OS + version: Not relevant - Node + pnpm versions: Not relevant - Rust version, if relevant: Not relevant - Remote Runtime URL configured? Relevant for payload size over HTTP runtime - Provider, model, or integration, if relevant: Sprite library/media assets ## Logs, screenshots, or video No runtime logs or screenshots. Static parity evidence only. ## Regression notes Legacy sprite listing used file-backed URLs. Refactor appears to send sprite image bytes inline for every listed sprite. ## Additional context This came from parity target 4, media and assets, under #1904. Suggested fix path: return sprite metadata plus managed sprite URLs, and resolve images through the asset URL layer instead of embedding every sprite in the list response. ## 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:23:56 +07:00
Author
Owner

@cha1latte commented on GitHub (Jun 2, 2026):

fixed in #1954

<!-- gh-comment-id:4604378464 --> @cha1latte commented on GitHub (Jun 2, 2026): fixed in #1954
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#945
No description provided.