[PR #1682] [MERGED] Fix authenticated game asset playback #5210

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

📋 Pull Request Information

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

Base: refactor ← Head: codex/refactor-game-asset-auth


📝 Commits (2)

  • 99c12e8 Fix authenticated game asset playback
  • d472d88 Guard async SFX mute state

📊 Changes

6 files changed (+461 additions, -141 deletions)

View changed files

➕ src/features/modes/game/lib/game-audio.test.ts (+108 -0)
📝 src/features/modes/game/lib/game-audio.ts (+126 -101)
➕ src/shared/api/assets-api.test.ts (+39 -0)
📝 src/shared/api/assets-api.ts (+36 -18)
📝 src/shared/api/local-file-api.test.ts (+75 -3)
📝 src/shared/api/local-file-api.ts (+77 -19)

📄 Description

Linked issue

No linked issue. This addresses the post-merge refactor validation blocker for authenticated hostable game asset parity.

Why this change

  • Authenticated hostable runtimes could still break game-mode backgrounds/audio because some runtime paths used synchronous game asset URLs that cannot carry Basic Auth headers.
  • The remote managed asset blob cache also needed proof against duplicate fetches, failed fetch poisoning, and stale object URLs after asset mutation.

What changed

  • Route game music, ambient audio, and SFX playback through resolveGameAssetFileUrl before creating/playing audio elements.
  • Prove authenticated marinara-game-asset: background URLs resolve through the async managed asset bridge.
  • Cache authenticated remote asset blob URL promises, clear failed fetches, and expose invalidation/revocation.
  • Invalidate remote game asset blob URLs after game asset upload/delete/move/rename/rescan/write mutations.
  • Add focused tests for authenticated game asset background/audio resolution and cache invalidation behavior.

Refactor impact

Primary owner:

shared API / game mode

Impact areas reviewed:

  • Authenticated hostable remote asset resolution
  • Game-mode background rendering via managed local asset bridge
  • Game-mode music, ambient, and SFX playback
  • Game asset mutation wrappers

Boundary notes:

  • Feature game audio still calls a shared API wrapper; it does not reach into raw remote runtime or Tauri command plumbing.
  • The authenticated fetch remains owned by src/shared/api/local-file-api.ts.
  • Game asset mutation invalidation is centralized in src/shared/api/assets-api.ts.

Pressure points touched:

  • Game audio runtime
  • Managed asset wrappers
  • Remote authenticated asset cache

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 pnpm test src/shared/api/local-file-api.test.ts src/shared/api/assets-api.test.ts src/features/modes/game/lib/game-audio.test.ts; 3 files / 18 tests passed.
  • Codex ran pnpm check; line endings, architecture, TypeScript, Rust cargo check, and docs checks passed.
  • Codex ran git diff --check; no whitespace errors.
  • Bunny pre-PR review pass: pass on the current diff.
  • True manual follow-up still recommended: secured remote runtime with real game background/music/SFX assets.

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 is a focused runtime contract fix.

UI evidence

N/A. This is a runtime asset contract fix covered by focused unit tests and repo checks.

Summary by CodeRabbit

Release Notes

  • Refactor

    • Game audio playback refactored to use asynchronous asset URL resolution.
    • Asset management operations now invalidate remote asset caches after mutations (delete, move, rescan, upload, and bulk operations).
    • Improved concurrent request handling and cache invalidation for remote assets.
  • Tests

    • Added test coverage for audio playback, asset cache invalidation, and managed asset URL resolution.

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/1682 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/30/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `codex/refactor-game-asset-auth` --- ### 📝 Commits (2) - [`99c12e8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/99c12e883a802655e919d35a7625edac62e24a5b) Fix authenticated game asset playback - [`d472d88`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d472d884690fca820fe20188ac2ebcc88e8d9f22) Guard async SFX mute state ### 📊 Changes **6 files changed** (+461 additions, -141 deletions) <details> <summary>View changed files</summary> ➕ `src/features/modes/game/lib/game-audio.test.ts` (+108 -0) 📝 `src/features/modes/game/lib/game-audio.ts` (+126 -101) ➕ `src/shared/api/assets-api.test.ts` (+39 -0) 📝 `src/shared/api/assets-api.ts` (+36 -18) 📝 `src/shared/api/local-file-api.test.ts` (+75 -3) 📝 `src/shared/api/local-file-api.ts` (+77 -19) </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. This addresses the post-merge refactor validation blocker for authenticated hostable game asset parity. ## Why this change - Authenticated hostable runtimes could still break game-mode backgrounds/audio because some runtime paths used synchronous game asset URLs that cannot carry Basic Auth headers. - The remote managed asset blob cache also needed proof against duplicate fetches, failed fetch poisoning, and stale object URLs after asset mutation. ## What changed - Route game music, ambient audio, and SFX playback through `resolveGameAssetFileUrl` before creating/playing audio elements. - Prove authenticated `marinara-game-asset:` background URLs resolve through the async managed asset bridge. - Cache authenticated remote asset blob URL promises, clear failed fetches, and expose invalidation/revocation. - Invalidate remote game asset blob URLs after game asset upload/delete/move/rename/rescan/write mutations. - Add focused tests for authenticated game asset background/audio resolution and cache invalidation behavior. ## Refactor impact Primary owner: shared API / game mode Impact areas reviewed: - Authenticated hostable remote asset resolution - Game-mode background rendering via managed local asset bridge - Game-mode music, ambient, and SFX playback - Game asset mutation wrappers Boundary notes: - Feature game audio still calls a shared API wrapper; it does not reach into raw remote runtime or Tauri command plumbing. - The authenticated fetch remains owned by `src/shared/api/local-file-api.ts`. - Game asset mutation invalidation is centralized in `src/shared/api/assets-api.ts`. Pressure points touched: - Game audio runtime - Managed asset wrappers - Remote authenticated asset cache ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> - [ ] `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 `pnpm test src/shared/api/local-file-api.test.ts src/shared/api/assets-api.test.ts src/features/modes/game/lib/game-audio.test.ts`; 3 files / 18 tests passed. - Codex ran `pnpm check`; line endings, architecture, TypeScript, Rust cargo check, and docs checks passed. - Codex ran `git diff --check`; no whitespace errors. - Bunny pre-PR review pass: pass on the current diff. - True manual follow-up still recommended: secured remote runtime with real game background/music/SFX assets. ## 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 is a focused runtime contract fix. ## UI evidence N/A. This is a runtime asset contract fix covered by focused unit tests and repo checks. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Refactor** * Game audio playback refactored to use asynchronous asset URL resolution. * Asset management operations now invalidate remote asset caches after mutations (delete, move, rescan, upload, and bulk operations). * Improved concurrent request handling and cache invalidation for remote assets. * **Tests** * Added test coverage for audio playback, asset cache invalidation, and managed asset URL resolution. <!-- 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/1682?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:14:15 +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#5210
No description provided.