[PR #1954] [MERGED] Fix sprite list managed URLs #5357

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1954
Author: @cha1latte
Created: 6/2/2026
Status: ✅ Merged
Merged: 6/2/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-1930-sprite-list-urls


📝 Commits (1)

  • 11350b6 Fix sprite list managed URLs

📊 Changes

4 files changed (+323 additions, -44 deletions)

View changed files

📝 src-tauri/src/commands/storage/sprites.rs (+55 -22)
📝 src-tauri/src/http_server.rs (+90 -0)
📝 src/shared/api/image-generation-api.ts (+108 -10)
📝 src/shared/api/local-file-api.ts (+70 -12)

📄 Description

Linked issue

Closes #1930

Why this change

  • Sprite library listing on refactor returned every sprite image as a base64 data: URL, so opening a large sprite grid forced the list command to read and serialize every image byte before the UI could render.

What changed

  • Changed sprite list/upload/cleanup result entries to return metadata, cache keys, absolute paths, and managed asset URLs instead of eager base64 payloads.
  • Added a hostable /api/assets/sprite/<ownerType>/<ownerId>/<filename> asset route with path-token negative controls for remote runtime rendering.
  • Updated the shared sprite API wrapper to resolve listed sprite metadata into renderable desktop or remote runtime URLs for existing catalog, roleplay, game, and tracker consumers.

Refactor impact

Primary owner:

  • Rust storage and remote runtime, with a shared API wrapper adjustment.

Impact areas reviewed:

  • Catalog sprite grids, roleplay/game sprite consumers, shared sprite API calls, Tauri storage command responses, and hostable managed asset routing.

Boundary notes:

  • Engine code was not touched. Feature consumers continue to receive SpriteInfo.url; the shared API wrapper owns desktop/remote URL resolution.

Pressure points touched:

  • src-tauri/src/commands/storage/sprites.rs
  • src-tauri/src/http_server.rs
  • src/shared/api/image-generation-api.ts
  • src/shared/api/local-file-api.ts

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

  • Codex reproduced the bug before the fix with cargo test --manifest-path src-tauri\Cargo.toml sprite_upload_tests::bulk_upload_reports_partial_failures_and_returns_refreshed_list; the new assertion failed because the sprite list item URL was a data:image/... payload.
  • After the fix, cargo test --manifest-path src-tauri\Cargo.toml sprite_upload_tests::bulk_upload_reports_partial_failures_and_returns_refreshed_list passed.
  • cargo test --manifest-path src-tauri\Cargo.toml sprite_asset_path passed, covering character/persona sprite asset routing and path-token negative controls.
  • pnpm typecheck passed.
  • cargo check --manifest-path src-tauri\Cargo.toml passed.
  • pnpm check passed.
  • Marinara proof gate passed for scratch/bugfix-verification.json.
  • Bunny review passed before PR creation. Non-blocking limitation: authorized remote runtimes still require blob URLs when images are actually rendered, but the sprite list command payload no longer embeds image bytes.

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:

  • Bugfix for an existing sprite listing/media loading path; no new user-discoverable feature or setting.

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

UI evidence

N/A. This is a non-visual storage/API payload fix; proof is command-based.

Summary by CodeRabbit

Release Notes

  • New Features

    • Sprite assets now load via external URLs with automatic cache-busting to ensure users receive fresh content when sprite files are updated.
    • Improved sprite organization and tracking with explicit character and persona ownership designation.
  • Bug Fixes

    • Enhanced asset path validation and security hardening to prevent invalid or malicious asset paths.

🔄 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/1954 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/2/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1930-sprite-list-urls` --- ### 📝 Commits (1) - [`11350b6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/11350b6d119dbe686d15f2c91c7b7a5b49c07260) Fix sprite list managed URLs ### 📊 Changes **4 files changed** (+323 additions, -44 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage/sprites.rs` (+55 -22) 📝 `src-tauri/src/http_server.rs` (+90 -0) 📝 `src/shared/api/image-generation-api.ts` (+108 -10) 📝 `src/shared/api/local-file-api.ts` (+70 -12) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue Closes #1930 ## Why this change - Sprite library listing on `refactor` returned every sprite image as a base64 `data:` URL, so opening a large sprite grid forced the list command to read and serialize every image byte before the UI could render. ## What changed - Changed sprite list/upload/cleanup result entries to return metadata, cache keys, absolute paths, and managed asset URLs instead of eager base64 payloads. - Added a hostable `/api/assets/sprite/<ownerType>/<ownerId>/<filename>` asset route with path-token negative controls for remote runtime rendering. - Updated the shared sprite API wrapper to resolve listed sprite metadata into renderable desktop or remote runtime URLs for existing catalog, roleplay, game, and tracker consumers. ## Refactor impact Primary owner: - Rust storage and remote runtime, with a shared API wrapper adjustment. Impact areas reviewed: - Catalog sprite grids, roleplay/game sprite consumers, shared sprite API calls, Tauri storage command responses, and hostable managed asset routing. Boundary notes: - Engine code was not touched. Feature consumers continue to receive `SpriteInfo.url`; the shared API wrapper owns desktop/remote URL resolution. Pressure points touched: - `src-tauri/src/commands/storage/sprites.rs` - `src-tauri/src/http_server.rs` - `src/shared/api/image-generation-api.ts` - `src/shared/api/local-file-api.ts` ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] 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 - Codex reproduced the bug before the fix with `cargo test --manifest-path src-tauri\Cargo.toml sprite_upload_tests::bulk_upload_reports_partial_failures_and_returns_refreshed_list`; the new assertion failed because the sprite list item URL was a `data:image/...` payload. - After the fix, `cargo test --manifest-path src-tauri\Cargo.toml sprite_upload_tests::bulk_upload_reports_partial_failures_and_returns_refreshed_list` passed. - `cargo test --manifest-path src-tauri\Cargo.toml sprite_asset_path` passed, covering character/persona sprite asset routing and path-token negative controls. - `pnpm typecheck` passed. - `cargo check --manifest-path src-tauri\Cargo.toml` passed. - `pnpm check` passed. - Marinara proof gate passed for `scratch/bugfix-verification.json`. - Bunny review passed before PR creation. Non-blocking limitation: authorized remote runtimes still require blob URLs when images are actually rendered, but the sprite list command payload no longer embeds image bytes. ## 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: - Bugfix for an existing sprite listing/media loading path; no new user-discoverable feature or setting. ## 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 ## UI evidence N/A. This is a non-visual storage/API payload fix; proof is command-based. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Sprite assets now load via external URLs with automatic cache-busting to ensure users receive fresh content when sprite files are updated. * Improved sprite organization and tracking with explicit character and persona ownership designation. * **Bug Fixes** * Enhanced asset path validation and security hardening to prevent invalid or malicious asset paths. <!-- 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:15:33 +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#5357
No description provided.