[PR #5981] [MERGED] fix(lorebooks): keep chat entry toggles scoped to their chat #7012

Closed
opened 2026-10-23 04:15:44 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/5981
Author: @SpicyMarinara
Created: 9/9/2026
Status: ✅ Merged
Merged: 9/9/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/chat-scoped-lore-5954


📝 Commits (4)

  • b0e8fe6 chore: claim chat-scoped lore entry controls
  • 6b16602 fix: scope Chat Settings lore entry toggles to their chat
  • 28560da Merge remote-tracking branch 'origin/staging' into fix/chat-scoped-lore-5954
  • 8161f5c Merge remote-tracking branch 'origin/staging' into fix/chat-scoped-lore-5954

📊 Changes

9 files changed (+297 additions, -9 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
➕ e2e/chat-lorebook-entry-scope.e2e.ts (+124 -0)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+2 -0)
📝 packages/client/src/components/lorebooks/LorebookEntryRow.tsx (+32 -8)
📝 packages/client/src/features/chat-settings/inline-editors/InlineLorebookEntriesEditor.tsx (+10 -0)
📝 packages/client/src/hooks/use-chats.ts (+17 -0)
📝 packages/client/src/localization/locales/en.json (+7 -1)
📝 packages/server/src/routes/chats.routes.ts (+27 -0)
➕ scripts/regressions/chat-lorebook-entry-scope.regression.ts (+77 -0)

📄 Description

Linked issue

Closes #5954.

Why this change

The lorebook entry toggle inside Chat Settings changed the shared entry, disabling it in every chat. Players need this control to affect only the chat they are configuring.

What changed

Use the existing chat entry-state overrides for the inline enable switch. The server merges one flag atomically so ephemeral counters and concurrent changes to other entries survive. An entry disabled in its shared lorebook remains unavailable until enabled there. Text and other entry edits remain shared, with explicit localized scope guidance.

Validation

Automated proof completed:

  • pnpm check (localization, TypeScript, ESLint, build, and browser-test types).

  • pnpm regression:prompt.

  • The real Fastify/file-storage regression chat-lorebook-entry-scope.regression.ts: two chats, global isolation, preserved ephemeral counters, concurrent updates, invalid input, missing resources, and the global disabled floor. Baseline failed with the missing chat-scoped route; the fix passed.

  • Nine browser cases across Game, Roleplay, and Conversation on desktop Chromium, mobile Chromium, and mobile WebKit. Toggling, shared content edits, reload persistence, and globally disabled entries passed. The mobile row screenshot was inspected.

  • 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

Manually verify toggling a shared lore entry in two personal chats and check light-theme readability on a physical mobile device. Automated browser proof used isolated test data, not personal conversations.

Docs and release impact

Added a concise Unreleased fix and canonical English localization keys. No version or documentation-guide change.

UI evidence (if applicable)

The checked browser captures are generated by e2e/chat-lorebook-entry-scope.e2e.ts; the existing shared row and switch styles are reused.

Summary by CodeRabbit

  • Bug Fixes
    • Lorebook entry switches in chat settings now apply only to the active chat.
    • Per-chat enablement changes no longer affect other chats or the global lorebook state.
    • Ephemeral counters remain preserved when changing entry availability.
    • Globally disabled entries cannot be re-enabled for an individual chat.
    • Lorebook content edits no longer inherit or leak per-chat enablement overrides.

🔄 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/5981 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 9/9/2026 **Status:** ✅ Merged **Merged:** 9/9/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/chat-scoped-lore-5954` --- ### 📝 Commits (4) - [`b0e8fe6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b0e8fe6fda83fd9a49da41a7e045781c62ec684c) chore: claim chat-scoped lore entry controls - [`6b16602`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6b1660267abf050da4ab48bb7d8b1636f7826347) fix: scope Chat Settings lore entry toggles to their chat - [`28560da`](https://github.com/Pasta-Devs/Marinara-Engine/commit/28560da13fe4a4e3ee05491bf92c91a562a060e0) Merge remote-tracking branch 'origin/staging' into fix/chat-scoped-lore-5954 - [`8161f5c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/8161f5ce1e93755d0d6763d52152928ded1c5b36) Merge remote-tracking branch 'origin/staging' into fix/chat-scoped-lore-5954 ### 📊 Changes **9 files changed** (+297 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) ➕ `e2e/chat-lorebook-entry-scope.e2e.ts` (+124 -0) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+2 -0) 📝 `packages/client/src/components/lorebooks/LorebookEntryRow.tsx` (+32 -8) 📝 `packages/client/src/features/chat-settings/inline-editors/InlineLorebookEntriesEditor.tsx` (+10 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+17 -0) 📝 `packages/client/src/localization/locales/en.json` (+7 -1) 📝 `packages/server/src/routes/chats.routes.ts` (+27 -0) ➕ `scripts/regressions/chat-lorebook-entry-scope.regression.ts` (+77 -0) </details> ### 📄 Description ## Linked issue Closes #5954. ## Why this change The lorebook entry toggle inside Chat Settings changed the shared entry, disabling it in every chat. Players need this control to affect only the chat they are configuring. ## What changed Use the existing chat entry-state overrides for the inline enable switch. The server merges one flag atomically so ephemeral counters and concurrent changes to other entries survive. An entry disabled in its shared lorebook remains unavailable until enabled there. Text and other entry edits remain shared, with explicit localized scope guidance. ## Validation Automated proof completed: - `pnpm check` (localization, TypeScript, ESLint, build, and browser-test types). - `pnpm regression:prompt`. - The real Fastify/file-storage regression `chat-lorebook-entry-scope.regression.ts`: two chats, global isolation, preserved ephemeral counters, concurrent updates, invalid input, missing resources, and the global disabled floor. Baseline failed with the missing chat-scoped route; the fix passed. - Nine browser cases across Game, Roleplay, and Conversation on desktop Chromium, mobile Chromium, and mobile WebKit. Toggling, shared content edits, reload persistence, and globally disabled entries passed. The mobile row screenshot was inspected. - [ ] `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 Manually verify toggling a shared lore entry in two personal chats and check light-theme readability on a physical mobile device. Automated browser proof used isolated test data, not personal conversations. ## Docs and release impact Added a concise Unreleased fix and canonical English localization keys. No version or documentation-guide change. ## UI evidence (if applicable) The checked browser captures are generated by `e2e/chat-lorebook-entry-scope.e2e.ts`; the existing shared row and switch styles are reused. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Lorebook entry switches in chat settings now apply only to the active chat. - Per-chat enablement changes no longer affect other chats or the global lorebook state. - Ephemeral counters remain preserved when changing entry availability. - Globally disabled entries cannot be re-enabled for an individual chat. - Lorebook content edits no longer inherit or leak per-chat enablement overrides. <!-- 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-23 04:15:44 +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#7012
No description provided.