mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2959] [Issue]: A no-op edit-save can rewrite the whole message (curly quotes, trimmed whitespace); empty edit saves a blank message #1534
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#1534
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?
Originally created by @kolacheee on GitHub (Jun 28, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2959
Originally assigned to: @SpicyMarinara on GitHub.
What's wrong
The "did the user actually change anything?" check on an edit save compares the transformed edit value against the untransformed stored content. Because those two baselines differ, a save that the user intended as a no-op can still fire and rewrite the message:
How to reproduce (try it yourself)
Typographic quotes:
"hello"(typical AI output).You'll see: stored content becomes
“hello”(curly). A regex/macro matching"no longer matches.Expected: a no-op save changes nothing.
Whitespace / empty:
Expected: no-op preserves content; empty save is rejected (or confirmed).
Where it is
packages/client/src/components/chat/ChatMessage.tsx— the textarea is seeded withformatTextQuotes(initialContent, quoteFormat)(307) andhandleSavere-runsformatTextQuotes(300), but the change guard compares against raw content:if (content.trim() !== message.content)(1345). Same shape inpackages/client/src/components/chat/ConversationMessage.tsx:val = formatTextQuotes(editValueRef.current.trim(), quoteFormat)thenif (val !== editSourceContent)(454-455), whereeditSourceContentis the raw, untrimmed source (426). The server (chats.routes.ts:1651→updateMessageContent) stores whatever it's given, with no empty/length check.formatTextQuotesis inpackages/shared/src/utils/quote-format.ts.What's happening
The textarea value is normalized (curly quotes, trimmed) while the no-op baseline is the raw stored content, so any quote-style or trailing-whitespace difference makes a no-op look like a change and persists the wholesale transform. There's also no guard against saving empty content.
Suggested fix
Compare like-for-like: gate the save on
formatTextQuotes(rawSource, quoteFormat).trim() !== savedValue.trim()in bothChatMessage.tsx:1345andConversationMessage.tsx:455(compare formatted-source to formatted-result, trimmed on both sides). Add an empty-content guard (reject, or confirm before persisting""). Alternatively, seed the textarea with raw content and only format the user's actual keystrokes.AI-investigated against v2.0.6; both guards read and confirmed. Please verify before fixing.
@SpicyMarinara commented on GitHub (Jun 29, 2026):
Fixed in staging: edit saves ignore empty content and compare against the formatted edit source so no-op saves no longer rewrite punctuation/whitespace. Validated with pnpm check and pnpm regression:prompt.