[PR #1591] [MERGED] Align game asset MIME contracts #5131

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1591
Author: @Xelvanis
Created: 5/29/2026
Status: ✅ Merged
Merged: 5/29/2026
Merged by: @Xelvanis

Base: refactor ← Head: restore/knip-game-asset-mime-maps


📝 Commits (3)

  • a734866 Restore game asset MIME map wiring
  • f09d424 Align game asset MIME contracts
  • 68fb845 Harden game asset MIME contract tests

📊 Changes

6 files changed (+123 additions, -35 deletions)

View changed files

📝 src-tauri/crates/assets/src/lib.rs (+39 -5)
➕ src/engine/contracts/constants/game-assets.test.ts (+32 -0)
📝 src/engine/contracts/constants/game-assets.ts (+11 -1)
📝 src/features/modes/game-assets/components/AudioPlayerModal.tsx (+4 -17)
📝 src/features/shell/settings/components/SettingsPanel.tsx (+22 -7)
📝 src/shared/components/ui/ImageUploadDropzone.tsx (+15 -5)

📄 Description

Linked issue

No linked issue.

Why this change

  • Game asset MIME and extension support drifted between the TypeScript constants, Settings file pickers, browser audio hints, shared image upload filtering, and the Rust managed-asset upload gate.
  • The drift could make the UI advertise files that native upload rejected, or let drag/drop accept image MIME types that were not part of the intended raster upload contract.

What changed

  • Added Opus to the TypeScript game asset audio extension and MIME maps.
  • Derived Settings game-asset file picker accept strings from the shared MIME maps.
  • Updated managed game asset upload validation in Rust to accept WebM audio, Opus audio, AVIF backgrounds, and SVG sprites while keeping SVG rejected for backgrounds.
  • Tightened the shared image upload dropzone to accept only known raster image MIME types or extensions by default.
  • Switched the audio preview modal to use the combined game asset MIME map.
  • Added focused TypeScript and Rust tests for the advertised file-type contracts and SVG-background negative path.

Refactor impact

Primary owner:

Engine contracts, shared UI, shell settings, game asset UI, and Rust assets capability.

Impact areas reviewed:

  • Managed game asset upload categories.
  • Settings game-asset upload file picker copy and accept values.
  • Generic image dropzone callers for backgrounds, chat gallery, and character gallery.
  • Audio preview MIME hinting.
  • Rust asset upload extension validation.

Boundary notes:

  • React-free constants remain in src/engine/contracts.
  • Shared and feature UI consume constants only; no raw Tauri or remote-runtime calls were added.
  • Privileged upload enforcement remains in src-tauri/crates/assets.
  • No shared API command shape or remote runtime allowlist changed.

Pressure points touched:

  • SettingsPanel was touched only in its existing game-asset upload constants/copy.
  • Did not touch ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs, or import modules.

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

  • pnpm test -- src/engine/contracts/constants/game-assets.test.ts passed.
  • cargo test --manifest-path src-tauri/Cargo.toml -p marinara-assets passed.
  • pnpm build passed; Vite reported the existing large-chunk warning.
  • pnpm check:architecture passed.
  • pnpm check:unused passed.
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passed.
  • Bunny pass found no confirmed findings.
  • Native Tauri upload and audio playback were not manually exercised.

Docs and release impact

  • No CHANGELOG.md exists in the repo.

  • Settings copy was updated to mention Opus support.

  • No developer docs, repo skills, or agent workflow changes were needed.

  • 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

No screenshots or recordings added; this is a file-type contract and upload validation fix.

Summary by CodeRabbit

  • New Features

    • Added Opus audio format support for game assets
  • Improvements

    • Enhanced file upload validation with category-specific format rules
    • Upload dialogs now dynamically display supported formats based on asset type
    • Improved file type detection accuracy for audio and image uploads

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/1591 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/29/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `restore/knip-game-asset-mime-maps` --- ### 📝 Commits (3) - [`a734866`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a73486648ae2ef56c11e4d51af085ffc7f7599d7) Restore game asset MIME map wiring - [`f09d424`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f09d424d8811caa234b38e99e61dbd4b52f7138a) Align game asset MIME contracts - [`68fb845`](https://github.com/Pasta-Devs/Marinara-Engine/commit/68fb845f6d57926a85857230ba232a5a77c0259a) Harden game asset MIME contract tests ### 📊 Changes **6 files changed** (+123 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/crates/assets/src/lib.rs` (+39 -5) ➕ `src/engine/contracts/constants/game-assets.test.ts` (+32 -0) 📝 `src/engine/contracts/constants/game-assets.ts` (+11 -1) 📝 `src/features/modes/game-assets/components/AudioPlayerModal.tsx` (+4 -17) 📝 `src/features/shell/settings/components/SettingsPanel.tsx` (+22 -7) 📝 `src/shared/components/ui/ImageUploadDropzone.tsx` (+15 -5) </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 No linked issue. ## Why this change - Game asset MIME and extension support drifted between the TypeScript constants, Settings file pickers, browser audio hints, shared image upload filtering, and the Rust managed-asset upload gate. - The drift could make the UI advertise files that native upload rejected, or let drag/drop accept image MIME types that were not part of the intended raster upload contract. ## What changed - Added Opus to the TypeScript game asset audio extension and MIME maps. - Derived Settings game-asset file picker accept strings from the shared MIME maps. - Updated managed game asset upload validation in Rust to accept WebM audio, Opus audio, AVIF backgrounds, and SVG sprites while keeping SVG rejected for backgrounds. - Tightened the shared image upload dropzone to accept only known raster image MIME types or extensions by default. - Switched the audio preview modal to use the combined game asset MIME map. - Added focused TypeScript and Rust tests for the advertised file-type contracts and SVG-background negative path. ## Refactor impact Primary owner: Engine contracts, shared UI, shell settings, game asset UI, and Rust assets capability. Impact areas reviewed: - Managed game asset upload categories. - Settings game-asset upload file picker copy and accept values. - Generic image dropzone callers for backgrounds, chat gallery, and character gallery. - Audio preview MIME hinting. - Rust asset upload extension validation. Boundary notes: - React-free constants remain in `src/engine/contracts`. - Shared and feature UI consume constants only; no raw Tauri or remote-runtime calls were added. - Privileged upload enforcement remains in `src-tauri/crates/assets`. - No shared API command shape or remote runtime allowlist changed. Pressure points touched: - `SettingsPanel` was touched only in its existing game-asset upload constants/copy. - Did not touch `ModeSurface`, `GameSurface`, shared mode UI, `src-tauri/src/lib.rs`, or import modules. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [x] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [x] `pnpm build` passes locally - [x] `pnpm check:architecture` passes locally - [x] `pnpm check:docs` passes locally - [x] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [x] 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 - `pnpm test -- src/engine/contracts/constants/game-assets.test.ts` passed. - `cargo test --manifest-path src-tauri/Cargo.toml -p marinara-assets` passed. - `pnpm build` passed; Vite reported the existing large-chunk warning. - `pnpm check:architecture` passed. - `pnpm check:unused` passed. - `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passed. - Bunny pass found no confirmed findings. - Native Tauri upload and audio playback were not manually exercised. ## Docs and release impact - No `CHANGELOG.md` exists in the repo. - Settings copy was updated to mention Opus support. - No developer docs, repo skills, or agent workflow changes were needed. - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence No screenshots or recordings added; this is a file-type contract and upload validation fix. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Opus audio format support for game assets * **Improvements** * Enhanced file upload validation with category-specific format rules * Upload dialogs now dynamically display supported formats based on asset type * Improved file type detection accuracy for audio and image uploads <!-- 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/1591?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:13:35 +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#5131
No description provided.