mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #231] [MERGED] fix(game): strip JSON-content tags fully in GM narration parser #4519
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4519
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/231
Author: @Romuromylus
Created: 4/25/2026
Status: ✅ Merged
Merged: 4/26/2026
Merged by: @LukaTheHero
Base:
main← Head:fix/gm-tag-parser-json-content📝 Commits (3)
62b6fd0fix(game): strip JSON-content tags fully in GM narration parser26832b7fix(game): make Note/Book preservation case-insensitive8a33968Merge branch 'main' into fix/gm-tag-parser-json-content📊 Changes
1 file changed (+65 additions, -8 deletions)
View changed files
📝
packages/client/src/lib/game-tag-parser.ts(+65 -8)📄 Description
Why this change
In Game Mode, GM dialogue sometimes ends in a trailing
}]for users on models that invent their own structured tags. The catch-all stripper inparseGmTags,stripGmTags, andstripGmTagsKeepReadablesuses/\[\w+:[^\]]*\]/g, which matches up to the first]. When the GM emits an unrecognized tag whose body contains a JSON array (e.g.[some_tag: {"x":[1,2]}]), the regex matches[some_tag: {"x":[1,2](stopping at the inner]) and leaves}]trailing in user-visible content.What changed
stripUnknownBracketTagsinpackages/client/src/lib/game-tag-parser.ts: a quote-aware walker that tracks"/'strings (with\escapes) and[/]depth, so JSON content inside a model-invented tag is removed along with its outer brackets./\[\w+:[^\]]*\]/gcallsites — inparseGmTags,stripGmTags, andstripGmTagsKeepReadables— withstripUnknownBracketTags.keeppredicate sostripGmTagsKeepReadablescan skip[Note:]and[Book:](preserving previous inline-readables behavior).Validation
pnpm check(TypeScript + ESLint clean; client build succeeds)Manual verification notes
}]no longer appears.[music:],[choices:],[combat:],[direction:],[widget:],[Note:],[Book:]) — all still parsed and stripped as before.[Note:]/[Book:]content still rendered inline viastripGmTagsKeepReadables.Docs and release impact
UI evidence (if applicable)
N/A — backend tag-parser fix, output is plain text rendered in the existing GM dialogue surface. The user-visible difference is the absence of trailing
}]in narration.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.