[PR #1741] [MERGED] Fix remote avatar asset routing #5251

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

📋 Pull Request Information

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

Base: refactor ← Head: fix/issue-1713-remote-avatar-assets


📝 Commits (1)

  • 7d8f2b4 Fix remote avatar asset routing

📊 Changes

3 files changed (+178 additions, -8 deletions)

View changed files

📝 src-tauri/src/http_server.rs (+93 -6)
➕ src/shared/api/local-file-api.test.tsx (+48 -0)
📝 src/shared/api/local-file-api.ts (+37 -2)

📄 Description

Linked issue

Closes #1713

Why this change

  • The remote HTTP avatar asset endpoint only resolved bare filenames under avatars/characters, while managed persona and NPC avatar uploads are stored under avatars/personas and avatars/npc.
  • In remote runtime mode, the frontend also collapsed managed avatar file paths to filename-only URLs, so persona and NPC avatar requests could not include the collection that owns the file.

What changed

  • Preserve known managed avatar collection prefixes when building remote avatar asset URLs from avatarFilePath.
  • Route /api/assets/avatar/<collection>/... to allowlisted avatar collections while keeping legacy /api/assets/avatar/<filename> mapped to character avatars.
  • Add regression coverage for character, persona, NPC, legacy filename-only, and suspicious managed-path cases.

Refactor impact

Primary owner:

Remote runtime / Rust HTTP assets, with shared API URL construction.

Impact areas reviewed:

  • src/shared/api/local-file-api.ts
  • src-tauri/src/http_server.rs
  • Existing avatar upload storage paths in src-tauri/src/commands/storage/avatars.rs

Boundary notes:

  • The shared API wrapper still builds remote asset URLs; feature code does not call raw remote-runtime fetch.
  • The Rust HTTP server owns filesystem resolution and keeps path traversal checks server-side.
  • No schema, dependency, auth, prompt, import/export, or release metadata changes.

Pressure points touched:

  • Remote runtime managed asset URL construction.
  • /api/assets/avatar/*path HTTP asset routing.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • pnpm check passes locally before PR push/handoff, including the unused-code check
  • 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
  • Browser screenshot/recording evidence added when UI/browser state is the claim
  • Remote runtime smoke checked when relevant

Manual verification notes

Codex machine verification:

  • Before fix, cargo test --manifest-path src-tauri/Cargo.toml http_server::tests::avatar_asset_path_routes_known_avatar_collections failed because collection-prefixed avatar paths were rejected.
  • Before fix, pnpm exec vitest run src/shared/api/local-file-api.test.ts failed because a managed persona avatar path produced /api/assets/avatar/Current.png instead of /api/assets/avatar/personas/Current.png.
  • After fix, cargo test --manifest-path src-tauri/Cargo.toml http_server::tests::avatar_asset_path_routes_known_avatar_collections passed.
  • After fix, pnpm exec vitest run src/shared/api/local-file-api.test.tsx passed.
  • pnpm check passed after the final diff and rebase.
  • node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json passed.

Manual verification not performed:

  • No Docker remote-runtime smoke was run in a live desktop-to-server setup from this machine. The endpoint/path contract is covered by focused Rust and TypeScript regression tests.

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 backend/shared API asset-routing fix with no visible UI state as the claim.


🔄 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/1741 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/31/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-1713-remote-avatar-assets` --- ### 📝 Commits (1) - [`7d8f2b4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7d8f2b4d42229085cfb3d070d81bb7262fe99a96) Fix remote avatar asset routing ### 📊 Changes **3 files changed** (+178 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/http_server.rs` (+93 -6) ➕ `src/shared/api/local-file-api.test.tsx` (+48 -0) 📝 `src/shared/api/local-file-api.ts` (+37 -2) </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 #1713 ## Why this change - The remote HTTP avatar asset endpoint only resolved bare filenames under `avatars/characters`, while managed persona and NPC avatar uploads are stored under `avatars/personas` and `avatars/npc`. - In remote runtime mode, the frontend also collapsed managed avatar file paths to filename-only URLs, so persona and NPC avatar requests could not include the collection that owns the file. ## What changed - Preserve known managed avatar collection prefixes when building remote avatar asset URLs from `avatarFilePath`. - Route `/api/assets/avatar/<collection>/...` to allowlisted avatar collections while keeping legacy `/api/assets/avatar/<filename>` mapped to character avatars. - Add regression coverage for character, persona, NPC, legacy filename-only, and suspicious managed-path cases. ## Refactor impact Primary owner: Remote runtime / Rust HTTP assets, with shared API URL construction. Impact areas reviewed: - `src/shared/api/local-file-api.ts` - `src-tauri/src/http_server.rs` - Existing avatar upload storage paths in `src-tauri/src/commands/storage/avatars.rs` Boundary notes: - The shared API wrapper still builds remote asset URLs; feature code does not call raw remote-runtime fetch. - The Rust HTTP server owns filesystem resolution and keeps path traversal checks server-side. - No schema, dependency, auth, prompt, import/export, or release metadata changes. Pressure points touched: - Remote runtime managed asset URL construction. - `/api/assets/avatar/*path` HTTP asset routing. ## Validation - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] `pnpm check` passes locally before PR push/handoff, including the unused-code check - [ ] `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 - [ ] Browser screenshot/recording evidence added when UI/browser state is the claim - [ ] Remote runtime smoke checked when relevant ### Manual verification notes Codex machine verification: - Before fix, `cargo test --manifest-path src-tauri/Cargo.toml http_server::tests::avatar_asset_path_routes_known_avatar_collections` failed because collection-prefixed avatar paths were rejected. - Before fix, `pnpm exec vitest run src/shared/api/local-file-api.test.ts` failed because a managed persona avatar path produced `/api/assets/avatar/Current.png` instead of `/api/assets/avatar/personas/Current.png`. - After fix, `cargo test --manifest-path src-tauri/Cargo.toml http_server::tests::avatar_asset_path_routes_known_avatar_collections` passed. - After fix, `pnpm exec vitest run src/shared/api/local-file-api.test.tsx` passed. - `pnpm check` passed after the final diff and rebase. - `node C:\Users\celia\.codex\tools\marinara-proof-gate.mjs scratch\bugfix-verification.json` passed. Manual verification not performed: - No Docker remote-runtime smoke was run in a live desktop-to-server setup from this machine. The endpoint/path contract is covered by focused Rust and TypeScript regression tests. ## 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 backend/shared API asset-routing fix with no visible UI state as the claim. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:14:37 +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#5251
No description provided.