[PR #656] [MERGED] Fix double-encoded Game Mode setup JSON #4714

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

📋 Pull Request Information

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

Base: main ← Head: fix/issue-655-game-mode-widgets


📝 Commits (1)

  • 1fb5dfc Fix double-encoded game setup JSON

📊 Changes

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

View changed files

📝 packages/server/src/services/game/jsonish.ts (+19 -4)
📝 packages/server/test/game-readable-edits.test.ts (+28 -0)

📄 Description

## Linked issue

Closes #655

Why this change

  • Game Mode setup can receive valid world JSON from a provider as an escaped JSON string. In that shape, Marinara parsed the outer string successfully but never unwrapped the inner setup object, so validation treated the setup as missing required fields and the generated blueprint/widgets were not applied.

What changed

  • Unwrap JSON strings inside the tolerant Game Mode JSON parser before returning parsed setup data.
  • Added a regression test that covers a provider returning a complete Game Mode setup object as an escaped string, including blueprint.hudWidgets.

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 proof: pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/game-readable-edits.test.ts passed.
  • Codex proof: node scratch/issue-655-repro.mjs unwrapped a screenshot-shaped double-encoded Game Mode setup payload and preserved HUD widgets laila_amusement and mansion_gossip.
  • Codex proof: pnpm check passed after fast-forwarding this branch to current upstream/main.
  • Manual browser/provider verification not run: this fix is in provider response parsing, and the core claim is covered by the parser regression plus screenshot-shaped setup payload repro.

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; this is a narrow parser bugfix.

UI evidence (if applicable)

N/A — parser/logic bug; no UI rendering changed.

Summary by CodeRabbit

  • New Features

    • Enhanced JSON parsing to handle double-encoded and nested stringified JSON responses, including code fence-wrapped content. Improves robustness when processing complex or unconventional JSON formats.
  • Tests

    • Added test coverage validating JSON unwrapping functionality across multiple encoding layers.

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/656 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/10/2026 **Status:** ✅ Merged **Merged:** 5/10/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `main` ← **Head:** `fix/issue-655-game-mode-widgets` --- ### 📝 Commits (1) - [`1fb5dfc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1fb5dfccaec2c2c6ddfa88d66fd71e4095c7dc15) Fix double-encoded game setup JSON ### 📊 Changes **2 files changed** (+47 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/server/src/services/game/jsonish.ts` (+19 -4) 📝 `packages/server/test/game-readable-edits.test.ts` (+28 -0) </details> ### 📄 Description ## 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 --> Closes #655 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Game Mode setup can receive valid world JSON from a provider as an escaped JSON string. In that shape, Marinara parsed the outer string successfully but never unwrapped the inner setup object, so validation treated the setup as missing required fields and the generated blueprint/widgets were not applied. ## What changed <!-- List the key changes in this PR --> - Unwrap JSON strings inside the tolerant Game Mode JSON parser before returning parsed setup data. - Added a regression test that covers a provider returning a complete Game Mode setup object as an escaped string, including `blueprint.hudWidgets`. ## 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 proof: `pnpm --filter @marinara-engine/server exec tsx --import ./test/setup-env.ts --test test/game-readable-edits.test.ts` passed. - Codex proof: `node scratch/issue-655-repro.mjs` unwrapped a screenshot-shaped double-encoded Game Mode setup payload and preserved HUD widgets `laila_amusement` and `mansion_gossip`. - Codex proof: `pnpm check` passed after fast-forwarding this branch to current `upstream/main`. - Manual browser/provider verification not run: this fix is in provider response parsing, and the core claim is covered by the parser regression plus screenshot-shaped setup payload repro. ## 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; this is a narrow parser bugfix. ## UI evidence (if applicable) N/A — parser/logic bug; no UI rendering changed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Enhanced JSON parsing to handle double-encoded and nested stringified JSON responses, including code fence-wrapped content. Improves robustness when processing complex or unconventional JSON formats. * **Tests** * Added test coverage validating JSON unwrapping functionality across multiple encoding layers. [![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/656) <!-- 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:10:03 +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#4714
No description provided.