[PR #1151] [MERGED] Fix refactor game segment unknown tag stripping #4948

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

📋 Pull Request Information

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

Base: refactor ← Head: codex/refactor-game-hunt


📝 Commits (2)

  • 5b1c700 Fix game segment unknown tag stripping
  • 1dd4bfa Handle readable nested tags in segment stripping

📊 Changes

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

View changed files

➕ src/engine/modes/game/state/segment-edits.test.ts (+34 -0)
📝 src/engine/modes/game/state/segment-edits.ts (+55 -4)

📄 Description

Linked issue

Closes #1149

Why this change

  • Game segment edits on the refactor branch could leave dangling JSON fragments from unknown GM tags, polluting edited game history used by later turns.

What changed

  • Replaced the engine segment-edit unknown-tag regex with balanced, quote-aware bracket stripping.
  • Added focused tests for nested JSON tags, Note preservation, quoted bracket handling, readable nested payload preservation, and the persisted segment-edit path.

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 reproduced the issue before the fix with pnpm exec vitest run src/engine/modes/game/state/segment-edits.test.ts; the new tests failed because }] leaked from an unknown nested tag.
  • Codex verified the original repro after the fix with pnpm exec vitest run src/engine/modes/game/state/segment-edits.test.ts; result: 1 test file passed, 4 tests passed.
  • Codex addressed CodeRabbit's readable-payload follow-up by preserving kept [Note: ...] tags atomically, then reran the same targeted command; result: 1 test file passed, 4 tests passed.
  • Codex ran pnpm check; result: passed, including architecture, frontend typecheck, Rust check, and docs.
  • Codex ran the local proof gate against scratch/bugfix-verification.json; result: passed.
  • Manual app click-through was not performed because this is engine-only segment edit string handling with direct unit coverage.

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 are needed for this engine-only bugfix.

UI evidence (if applicable)

N/A - engine-only string handling; no visible UI state changed.


🔄 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/1151 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 5/24/2026 **Status:** ✅ Merged **Merged:** 5/24/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `codex/refactor-game-hunt` --- ### 📝 Commits (2) - [`5b1c700`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5b1c7003d38846d382fb6de8e43ac2048eb51dd2) Fix game segment unknown tag stripping - [`1dd4bfa`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1dd4bfa9b5bc00292395612305bc38603dfea1c4) Handle readable nested tags in segment stripping ### 📊 Changes **2 files changed** (+89 additions, -4 deletions) <details> <summary>View changed files</summary> ➕ `src/engine/modes/game/state/segment-edits.test.ts` (+34 -0) 📝 `src/engine/modes/game/state/segment-edits.ts` (+55 -4) </details> ### 📄 Description <!-- Target branch: `refactor` for this refactor-branch bugfix. --> <!-- The default base in this UI may be `main`; this PR intentionally targets `refactor`. --> <!-- 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 --> Closes #1149 ## Why this change <!-- What user problem, bug, or goal does this solve? --> - Game segment edits on the refactor branch could leave dangling JSON fragments from unknown GM tags, polluting edited game history used by later turns. ## What changed <!-- List the key changes in this PR --> - Replaced the engine segment-edit unknown-tag regex with balanced, quote-aware bracket stripping. - Added focused tests for nested JSON tags, Note preservation, quoted bracket handling, readable nested payload preservation, and the persisted segment-edit path. ## 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 reproduced the issue before the fix with `pnpm exec vitest run src/engine/modes/game/state/segment-edits.test.ts`; the new tests failed because `}]` leaked from an unknown nested tag. - Codex verified the original repro after the fix with `pnpm exec vitest run src/engine/modes/game/state/segment-edits.test.ts`; result: 1 test file passed, 4 tests passed. - Codex addressed CodeRabbit's readable-payload follow-up by preserving kept `[Note: ...]` tags atomically, then reran the same targeted command; result: 1 test file passed, 4 tests passed. - Codex ran `pnpm check`; result: passed, including architecture, frontend typecheck, Rust check, and docs. - Codex ran the local proof gate against `scratch/bugfix-verification.json`; result: passed. - Manual app click-through was not performed because this is engine-only segment edit string handling with direct unit coverage. ## 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 are needed for this engine-only bugfix. ## UI evidence (if applicable) N/A - engine-only string handling; no visible UI state changed. --- <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:56 +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#4948
No description provided.