[PR #8632] [MERGED] fix(chat): prevent narration bleed between speaker-tagged swipes #8715

Closed
opened 2026-11-07 17:39:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8632
Author: @DSBwizzard
Created: 10/31/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @SpicyMarinara

Base: staging ← Head: codex/swipe-dialogue-repro


📝 Commits (3)

  • 2b1c09e fix(chat): prevent narration bleed between speaker-tagged swipes
  • cb2b686 test(e2e): guard optional Web Audio in Windows WebKit
  • 195ca35 Merge branch 'staging' into codex/swipe-dialogue-repro

📊 Changes

2 files changed (+65 additions, -3 deletions)

View changed files

📝 e2e/chat-widget-dialogue-colors.e2e.ts (+59 -0)
📝 packages/client/src/components/chat/ChatMessage.tsx (+6 -3)

📄 Description

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #8626

Why this change

  • Switching from a speaker-tagged Roleplay swipe to another response can leave old narration attached to the selected text until the page is refreshed. Each swipe should display only its own content.

What changed

  • Keep each narration chunk's Markdown keys inside a keyed React fragment, so switching swipes removes the old text while preserving dialogue colours and formatting without adding DOM wrappers.
  • Add a light/dark browser regression covering repeated swipe switches, both speakers' colours, narration formatting, stored swipe contents, and reload recovery. Guard the test fixture's optional Web Audio API so Windows WebKit can finish chat setup when AudioNode is unavailable.

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

Agent-run evidence for cb2b686e99a628332234224394b57e2a38a72732; the checkboxes above remain human verification tasks:

  • pnpm check passed. Existing hook warnings in unchanged files remain.
  • The new regression failed against the original production image on its first return to the plain swipe: Opening narration.Middle narration.Only the plain alternate swipe belongs here.
  • Focused pnpm regression:ui e2e/chat-widget-dialogue-colors.e2e.ts --grep 'speaker-tagged swipes replace narration|Roleplay dialogue keeps each character' --workers=1: eight desktop/mobile Chromium cases passed. Windows WebKit initially stopped in the shared audio fixture before opening a chat; after the one-line guard, rerunning with --project=mobile-webkit passed all four WebKit cases. Both themes and the existing dialogue-colour behavior are covered.
  • pnpm smoke:ui passed all seven required Chromium smoke cases.
  • The guarded Docker preview was built from the final commit, with its synthetic chats checkpointed and restore-verified before replacement.
  • The original tagged-group reproduction and the tag-free/single-character controls passed three round trips each in the final packaged app in Chromium 153.0.8010.12 and WebKit 27.2: all six cases rendered exactly the selected swipe, retained both stored swipe bodies, and passed reload recovery. The helper honours production rate limits and waits for reload completion; no runtime guard was disabled.
  • CodeRabbit CLI reviewed the complete three-file diff: zero findings, free OSS lane.

Manually verify the affected chat in Safari on macOS. These checks used synthetic chats, not the reporter's private JSONL; the full nightly browser matrix was not run locally.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No documentation, localization, release metadata, or storage-format changes are needed for this rendering correction.

UI evidence (if applicable)

Both screenshots use the same synthetic fixture and are captured before refreshing. The renderer code shown in the after screenshot is identical to the final head; the subsequent commit only guards the test fixture's optional audio API.

Before and after switching back to the plain swipe

Before (04e328e06): old ALPHA narration remains before the selected BETA swipe.

Before: stale narration remains

After (2b1c09ea2 renderer, also in final head): only BETA remains after three round trips.

After: only the selected swipe remains

Implementation owned by @DSBwizzard with Codex. @SpicyMarinara: upstream assignment is restricted for this account, so ownership is recorded here.


🔄 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/8632 **Author:** [@DSBwizzard](https://github.com/DSBwizzard) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/swipe-dialogue-repro` --- ### 📝 Commits (3) - [`2b1c09e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2b1c09ea2aa9d09e4ba237c36e0cc0be270dbae7) fix(chat): prevent narration bleed between speaker-tagged swipes - [`cb2b686`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cb2b686e99a628332234224394b57e2a38a72732) test(e2e): guard optional Web Audio in Windows WebKit - [`195ca35`](https://github.com/Pasta-Devs/Marinara-Engine/commit/195ca357b6aef7dc74e0bdc352f8a2bf792cf332) Merge branch 'staging' into codex/swipe-dialogue-repro ### 📊 Changes **2 files changed** (+65 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `e2e/chat-widget-dialogue-colors.e2e.ts` (+59 -0) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+6 -3) </details> ### 📄 Description > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #8626 ## Why this change - Switching from a speaker-tagged Roleplay swipe to another response can leave old narration attached to the selected text until the page is refreshed. Each swipe should display only its own content. ## What changed - Keep each narration chunk's Markdown keys inside a keyed React fragment, so switching swipes removes the old text while preserving dialogue colours and formatting without adding DOM wrappers. - Add a light/dark browser regression covering repeated swipe switches, both speakers' colours, narration formatting, stored swipe contents, and reload recovery. Guard the test fixture's optional Web Audio API so Windows WebKit can finish chat setup when `AudioNode` is unavailable. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes Agent-run evidence for `cb2b686e99a628332234224394b57e2a38a72732`; the checkboxes above remain human verification tasks: - `pnpm check` passed. Existing hook warnings in unchanged files remain. - The new regression failed against the original production image on its first return to the plain swipe: `Opening narration.Middle narration.Only the plain alternate swipe belongs here.` - Focused `pnpm regression:ui e2e/chat-widget-dialogue-colors.e2e.ts --grep 'speaker-tagged swipes replace narration|Roleplay dialogue keeps each character' --workers=1`: eight desktop/mobile Chromium cases passed. Windows WebKit initially stopped in the shared audio fixture before opening a chat; after the one-line guard, rerunning with `--project=mobile-webkit` passed all four WebKit cases. Both themes and the existing dialogue-colour behavior are covered. - `pnpm smoke:ui` passed all seven required Chromium smoke cases. - The guarded Docker preview was built from the final commit, with its synthetic chats checkpointed and restore-verified before replacement. - The original tagged-group reproduction and the tag-free/single-character controls passed three round trips each in the final packaged app in Chromium 153.0.8010.12 and WebKit 27.2: all six cases rendered exactly the selected swipe, retained both stored swipe bodies, and passed reload recovery. The helper honours production rate limits and waits for reload completion; no runtime guard was disabled. - CodeRabbit CLI reviewed the complete three-file diff: zero findings, free OSS lane. Manually verify the affected chat in Safari on macOS. These checks used synthetic chats, not the reporter's private JSONL; the full nightly browser matrix was not run locally. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No documentation, localization, release metadata, or storage-format changes are needed for this rendering correction. ## UI evidence (if applicable) Both screenshots use the same synthetic fixture and are captured before refreshing. The renderer code shown in the after screenshot is identical to the final head; the subsequent commit only guards the test fixture's optional audio API. <details> <summary>Before and after switching back to the plain swipe</summary> Before (`04e328e06`): old ALPHA narration remains before the selected BETA swipe. ![Before: stale narration remains](https://github.com/user-attachments/assets/e9b5e70a-27a1-4b56-ae36-92a8448483f8) After (`2b1c09ea2` renderer, also in final head): only BETA remains after three round trips. ![After: only the selected swipe remains](https://github.com/user-attachments/assets/ba9344a8-6408-4411-847f-a1248b2593b4) </details> Implementation owned by @DSBwizzard with Codex. @SpicyMarinara: upstream assignment is restricted for this account, so ownership is recorded here. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:39:10 +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#8715
No description provided.