[PR #1284] [MERGED] fix: expose remote image generation commands #5017

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1284
Author: @cha1latte
Created: 5/26/2026
Status: ✅ Merged
Merged: 5/26/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/refactor-issue-1231-image-runtime


📝 Commits (3)

  • aa849e3 fix: expose remote image generation commands
  • db349e6 Merge remote-tracking branch 'upstream/refactor' into fix/refactor-issue-1231-image-runtime
  • d91414b fix: stream remote managed assets

📊 Changes

5 files changed (+168 additions, -5 deletions)

View changed files

📝 src-tauri/src/commands/storage.rs (+1 -1)
📝 src-tauri/src/http_dispatch.rs (+58 -1)
📝 src-tauri/src/http_server.rs (+82 -3)
📝 src/shared/api/local-file-api.ts (+23 -0)
📝 src/shared/api/remote-runtime.ts (+4 -0)

📄 Description

Linked issue

Closes #1231

Why this change

  • The browser/remote-runtime path could test an image provider successfully, but real image generation commands still returned unsupported_command, so Test Image could be a false positive.
  • Remote-managed asset tags also needed a browser-safe resolution path through marinara-server instead of falling back to embedded Tauri/local filesystem resolution.

What changed

  • Exposes image_generate, avatar_generation_command, sprite_generate_sheet, and sprite_generate_sheet_preview through the remote runtime allowlist and HTTP dispatcher.
  • Adds a remote /api/assets/:kind/*path HTTP asset route for managed background, game, and lorebook assets.
  • Routes browser managed-asset URL resolution to the configured remote runtime when Remote Runtime URL is set.
  • Adds a Rust dispatcher regression test proving the real image/sprite generation commands dispatch into validation instead of remote unsupported handling.

Refactor impact

Primary owner:

  • Remote runtime / shared API / Rust storage

Impact areas reviewed:

  • src/shared/api/remote-runtime.ts
  • src/shared/api/local-file-api.ts
  • src/shared/api/image-generation-api.ts
  • src-tauri/src/http_dispatch.rs
  • src-tauri/src/http_server.rs
  • Managed background asset path guarding through AssetService

Boundary notes:

  • Shared API wrappers still call focused command wrappers instead of feature code reaching into raw remote fetch.
  • HTTP dispatch delegates to existing Rust image/sprite generation functions; it does not duplicate generation behavior.
  • Remote asset serving uses existing managed asset path guards for background/game assets and the lorebook image path helper for lorebook assets.

Pressure points touched:

  • Remote runtime command allowlist
  • marinara-server HTTP dispatch and asset serving

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Remote runtime smoke checked when relevant

Manual verification notes

  • Codex ran powershell -NoProfile -ExecutionPolicy Bypass -File scratch\issue-1231-http-repro.ps1 -Label before -Port 8877.
    • Before the fix, image_generate, avatar_generation_command, sprite_generate_sheet, and sprite_generate_sheet_preview returned HTTP 501 unsupported_command.
    • Before the fix, the managed asset route returned 404 because it did not exist.
  • Codex ran powershell -NoProfile -ExecutionPolicy Bypass -File scratch\issue-1231-http-repro.ps1 -Label after -Port 8878 -ExpectFixed.
    • After the fix, the same image/sprite commands dispatch through marinara-server and return HTTP 400 invalid_input for intentionally empty bodies, proving they no longer hit remote unsupported handling.
    • chat_gallery_upload still succeeds with a PNG payload.
    • background_upload still succeeds, and GET /api/assets/background/remote-background.png returns HTTP 200 image/png with the uploaded bytes.
    • Negative controls: definitely_not_real_remote_command remains HTTP 501 unsupported_command, and GET /api/assets/background/%2e%2e/package.json returns HTTP 400 instead of serving a file.
  • Codex ran cargo test --manifest-path src-tauri/Cargo.toml http_dispatch::tests::dispatch_exposes_real_remote_image_generation_commands.
  • Codex ran pnpm check.
  • Codex ran node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json.
  • Playwright screenshot capture for the generated proof page was blocked by local browser launch sandboxing (spawn EPERM), so proof is command/harness output rather than a UI screenshot. This bug is remote-runtime command/API behavior, not a visible UI layout issue.

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 restores intended remote-runtime parity for existing refactor image workflows.

UI evidence

No UI screenshot is included because the failure is command/API behavior in marinara-server; the before/after HTTP harness output is captured in scratch/issue-1231-before/results.json and scratch/issue-1231-after/results.json.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added remote asset generation for images, avatars, and sprite sheets
    • Introduced asset serving endpoint for centralized asset management
    • Enhanced asset resolution to prioritize server-hosted assets when available

Review Change Stack


🔄 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/1284 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/26/2026 **Status:** ✅ Merged **Merged:** 5/26/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-issue-1231-image-runtime` --- ### 📝 Commits (3) - [`aa849e3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/aa849e31696dbb84a80ac722a74cf2b256e5ede3) fix: expose remote image generation commands - [`db349e6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/db349e6827573721465982af2aacaaf0a225cb35) Merge remote-tracking branch 'upstream/refactor' into fix/refactor-issue-1231-image-runtime - [`d91414b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d91414b692fae6ccd3df1ad78a88df9a147164cb) fix: stream remote managed assets ### 📊 Changes **5 files changed** (+168 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/commands/storage.rs` (+1 -1) 📝 `src-tauri/src/http_dispatch.rs` (+58 -1) 📝 `src-tauri/src/http_server.rs` (+82 -3) 📝 `src/shared/api/local-file-api.ts` (+23 -0) 📝 `src/shared/api/remote-runtime.ts` (+4 -0) </details> ### 📄 Description ## Linked issue Closes #1231 ## Why this change - The browser/remote-runtime path could test an image provider successfully, but real image generation commands still returned `unsupported_command`, so `Test Image` could be a false positive. - Remote-managed asset tags also needed a browser-safe resolution path through `marinara-server` instead of falling back to embedded Tauri/local filesystem resolution. ## What changed - Exposes `image_generate`, `avatar_generation_command`, `sprite_generate_sheet`, and `sprite_generate_sheet_preview` through the remote runtime allowlist and HTTP dispatcher. - Adds a remote `/api/assets/:kind/*path` HTTP asset route for managed background, game, and lorebook assets. - Routes browser managed-asset URL resolution to the configured remote runtime when Remote Runtime URL is set. - Adds a Rust dispatcher regression test proving the real image/sprite generation commands dispatch into validation instead of remote unsupported handling. ## Refactor impact Primary owner: - Remote runtime / shared API / Rust storage Impact areas reviewed: - `src/shared/api/remote-runtime.ts` - `src/shared/api/local-file-api.ts` - `src/shared/api/image-generation-api.ts` - `src-tauri/src/http_dispatch.rs` - `src-tauri/src/http_server.rs` - Managed background asset path guarding through `AssetService` Boundary notes: - Shared API wrappers still call focused command wrappers instead of feature code reaching into raw remote fetch. - HTTP dispatch delegates to existing Rust image/sprite generation functions; it does not duplicate generation behavior. - Remote asset serving uses existing managed asset path guards for background/game assets and the lorebook image path helper for lorebook assets. Pressure points touched: - Remote runtime command allowlist - `marinara-server` HTTP dispatch and asset serving ## Validation - [ ] `pnpm check` passes locally - [ ] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [ ] Remote runtime smoke checked when relevant ### Manual verification notes - Codex ran `powershell -NoProfile -ExecutionPolicy Bypass -File scratch\issue-1231-http-repro.ps1 -Label before -Port 8877`. - Before the fix, `image_generate`, `avatar_generation_command`, `sprite_generate_sheet`, and `sprite_generate_sheet_preview` returned HTTP 501 `unsupported_command`. - Before the fix, the managed asset route returned 404 because it did not exist. - Codex ran `powershell -NoProfile -ExecutionPolicy Bypass -File scratch\issue-1231-http-repro.ps1 -Label after -Port 8878 -ExpectFixed`. - After the fix, the same image/sprite commands dispatch through `marinara-server` and return HTTP 400 `invalid_input` for intentionally empty bodies, proving they no longer hit remote unsupported handling. - `chat_gallery_upload` still succeeds with a PNG payload. - `background_upload` still succeeds, and `GET /api/assets/background/remote-background.png` returns HTTP 200 `image/png` with the uploaded bytes. - Negative controls: `definitely_not_real_remote_command` remains HTTP 501 `unsupported_command`, and `GET /api/assets/background/%2e%2e/package.json` returns HTTP 400 instead of serving a file. - Codex ran `cargo test --manifest-path src-tauri/Cargo.toml http_dispatch::tests::dispatch_exposes_real_remote_image_generation_commands`. - Codex ran `pnpm check`. - Codex ran `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json`. - Playwright screenshot capture for the generated proof page was blocked by local browser launch sandboxing (`spawn EPERM`), so proof is command/harness output rather than a UI screenshot. This bug is remote-runtime command/API behavior, not a visible UI layout issue. ## 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 restores intended remote-runtime parity for existing refactor image workflows. ## UI evidence No UI screenshot is included because the failure is command/API behavior in `marinara-server`; the before/after HTTP harness output is captured in `scratch/issue-1231-before/results.json` and `scratch/issue-1231-after/results.json`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Added remote asset generation for images, avatars, and sprite sheets * Introduced asset serving endpoint for centralized asset management * Enhanced asset resolution to prioritize server-hosted assets when available <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/1284?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- 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:12:31 +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#5017
No description provided.