[PR #915] [MERGED] Fix storm ambience for non-storm rain #4834

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

📋 Pull Request Information

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

Base: staging ← Head: fix/weather-sfx-story-match


📝 Commits (1)

  • c77bb1c Fix weather ambience storm audio gating

📊 Changes

2 files changed (+59 additions, -4 deletions)

View changed files

➕ packages/server/test/game-audio-score.test.ts (+41 -0)
📝 packages/shared/src/utils/music-score.ts (+18 -4)

📄 Description

Linked issue

No linked issue yet. Bug reported directly in Codex: storm weather SFX/ambience was heard in game mode when the story did not have a storm.

Why this change

  • Game mode could select thunder-bearing ambient weather audio for plain rain or non-storm contexts because the ambient scorer treated rain/rainy as thunder keywords and did not penalize storm-audio assets unless the tracked weather was actually stormy.

What changed

  • Removed thunder from non-storm rain ambient keywords.
  • Added storm-audio scoring so thunder/lightning/storm ambient assets are penalized unless tracked weather is storm/stormy/thunderstorm, and lightly boosted when it is.
  • Added regression coverage for plain rain avoiding thunder ambience and actual storm weather still selecting the thunder loop.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Codex scratch repro before the fix: plain rain outdoors selected ambient:nature:rain-thunder.
  • Codex scratch repro after the fix: plain rain, rainy weather, and unset combat weather avoid thunder ambience; actual storm weather selects ambient:nature:rain-thunder; interior rain selects ambient:interior:rain-on-roof.
  • pnpm --filter @marinara-engine/server test -- test/game-audio-score.test.ts passed. The script currently runs the full server test suite; 358 tests passed.
  • pnpm check passed locally.
  • Bunny review passed before opening the PR.
  • No human-only verification blocker for the core claim; this is deterministic scorer logic, not provider/hardware-dependent behavior.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

No docs or release metadata changes needed for this internal scoring fix.

UI evidence (if applicable)

N/A: no UI surface changed. Proof is the deterministic scorer repro and regression test above.

Summary by CodeRabbit

  • Bug Fixes

    • Improved ambient audio selection to properly differentiate between rain and storm weather conditions, ensuring rain uses appropriate background audio while storms trigger suitable thunder effects.
  • Tests

    • Added test coverage for ambient audio scoring across different weather scenarios.

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/915 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/16/2026 **Status:** ✅ Merged **Merged:** 5/16/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `staging` ← **Head:** `fix/weather-sfx-story-match` --- ### 📝 Commits (1) - [`c77bb1c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c77bb1c1a36333cd8a30ea594e94c885ed9a66c5) Fix weather ambience storm audio gating ### 📊 Changes **2 files changed** (+59 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `packages/server/test/game-audio-score.test.ts` (+41 -0) 📝 `packages/shared/src/utils/music-score.ts` (+18 -4) </details> ### 📄 Description <!-- Target branch: `staging`. The default base in this UI is `main` (release branch). --> <!-- Change the base to `staging` before submitting unless this is a maintainer-approved mainline change. --> <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue <!-- Every PR should reference a feature request or issue report. If there isn't one yet, open one first to gather opinions: --> <!-- https://github.com/Pasta-Devs/Marinara-Engine/issues/new/choose --> No linked issue yet. Bug reported directly in Codex: storm weather SFX/ambience was heard in game mode when the story did not have a storm. ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Game mode could select thunder-bearing ambient weather audio for plain rain or non-storm contexts because the ambient scorer treated `rain`/`rainy` as thunder keywords and did not penalize storm-audio assets unless the tracked weather was actually stormy. ## What changed <!-- List the key changes in this PR --> - Removed thunder from non-storm rain ambient keywords. - Added storm-audio scoring so thunder/lightning/storm ambient assets are penalized unless tracked weather is storm/stormy/thunderstorm, and lightly boosted when it is. - Added regression coverage for plain rain avoiding thunder ambience and actual storm weather still selecting the thunder loop. ## Validation <!-- Required: include commands run and/or manual checks performed --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes <!-- Describe exactly what you tested in a real browser/app, step by step. --> <!-- ⚠️ If an AI agent filled out or ticked these boxes for you, treat them --> <!-- as a TO-DO LIST, not as proof the work is done. Verify each item yourself --> <!-- before submitting. If you haven't verified it, untick the box. --> - Codex scratch repro before the fix: plain rain outdoors selected `ambient:nature:rain-thunder`. - Codex scratch repro after the fix: plain rain, rainy weather, and unset combat weather avoid thunder ambience; actual storm weather selects `ambient:nature:rain-thunder`; interior rain selects `ambient:interior:rain-on-roof`. - `pnpm --filter @marinara-engine/server test -- test/game-audio-score.test.ts` passed. The script currently runs the full server test suite; 358 tests passed. - `pnpm check` passed locally. - Bunny review passed before opening the PR. - No human-only verification blocker for the core claim; this is deterministic scorer logic, not provider/hardware-dependent behavior. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) No docs or release metadata changes needed for this internal scoring fix. ## UI evidence (if applicable) N/A: no UI surface changed. Proof is the deterministic scorer repro and regression test above. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved ambient audio selection to properly differentiate between rain and storm weather conditions, ensuring rain uses appropriate background audio while storms trigger suitable thunder effects. * **Tests** * Added test coverage for ambient audio scoring across different weather scenarios. <!-- 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/915?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:11:02 +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#4834
No description provided.