[PR #2806] [MERGED] Fix game setup cancel delete guard #5740

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

📋 Pull Request Information

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

Base: staging ← Head: codex/fix-2804-game-setup-cancel


📝 Commits (2)

  • 2fb3cfc fix game setup cancel delete guard
  • c123e62 address game group delete guard review

📊 Changes

8 files changed (+95 additions, -21 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 packages/client/src/components/chat/ChatBranchSelector.tsx (+2 -2)
📝 packages/client/src/components/chat/ChatFilesDrawer.tsx (+2 -2)
📝 packages/client/src/components/game/GameSurface.tsx (+16 -5)
📝 packages/client/src/components/layout/ChatSidebar.tsx (+4 -4)
📝 packages/client/src/hooks/use-chats.ts (+18 -6)
📝 packages/server/src/routes/chats.routes.ts (+22 -2)
📝 packages/server/src/services/storage/chats.storage.ts (+27 -0)

📄 Description

Why this change

Fixes #2804.

Canceling the Game Setup Wizard could hard-delete an existing game campaign when stale metadata or setup session status made the wizard appear for a real game. That is a data-loss path, so the cancel behavior needs a stronger distinction between a newborn empty setup chat and an existing campaign.

What changed

  • Only auto-delete from the setup wizard when the game chat is still uncreated and has no loaded messages.
  • Dismiss the setup wizard for existing or setup-status games instead of deleting the chat.
  • Add a server guard that refuses unforced hard-deletes of game chats with a game id or saved game payload.
  • Mark confirmed chat delete actions as explicit forced deletes so normal user-confirmed deletion still works.
  • Added the fix to CHANGELOG.md under Unreleased.

Validation

  • pnpm check (completed locally; passed on this branch)
  • Manually verify canceling Game Setup Wizard on an existing campaign keeps the chat.
  • Manually verify canceling a freshly created empty game setup chat still cleans up the empty chat.
  • Manually verify confirmed chat/branch deletes still work from the UI.

🔄 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/2806 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 6/22/2026 **Status:** ✅ Merged **Merged:** 6/22/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `codex/fix-2804-game-setup-cancel` --- ### 📝 Commits (2) - [`2fb3cfc`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2fb3cfc1bf25b9ccc8478411bcd2a4c27db9b195) fix game setup cancel delete guard - [`c123e62`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c123e6282dcdc7c8dcba79d069e8e07c7058573d) address game group delete guard review ### 📊 Changes **8 files changed** (+95 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `packages/client/src/components/chat/ChatBranchSelector.tsx` (+2 -2) 📝 `packages/client/src/components/chat/ChatFilesDrawer.tsx` (+2 -2) 📝 `packages/client/src/components/game/GameSurface.tsx` (+16 -5) 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+4 -4) 📝 `packages/client/src/hooks/use-chats.ts` (+18 -6) 📝 `packages/server/src/routes/chats.routes.ts` (+22 -2) 📝 `packages/server/src/services/storage/chats.storage.ts` (+27 -0) </details> ### 📄 Description ## Why this change Fixes #2804. Canceling the Game Setup Wizard could hard-delete an existing game campaign when stale metadata or `setup` session status made the wizard appear for a real game. That is a data-loss path, so the cancel behavior needs a stronger distinction between a newborn empty setup chat and an existing campaign. ## What changed - Only auto-delete from the setup wizard when the game chat is still uncreated and has no loaded messages. - Dismiss the setup wizard for existing or setup-status games instead of deleting the chat. - Add a server guard that refuses unforced hard-deletes of game chats with a game id or saved game payload. - Mark confirmed chat delete actions as explicit forced deletes so normal user-confirmed deletion still works. - Added the fix to `CHANGELOG.md` under Unreleased. ## Validation - [ ] `pnpm check` (completed locally; passed on this branch) - [ ] Manually verify canceling Game Setup Wizard on an existing campaign keeps the chat. - [ ] Manually verify canceling a freshly created empty game setup chat still cleans up the empty chat. - [ ] Manually verify confirmed chat/branch deletes still work from the UI. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:19:01 +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#5740
No description provided.