[PR #8151] [MERGED] fix(ui): cancel untouched Home chats and align loading surfaces #8126

Closed
opened 2026-10-24 04:10:36 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: staging ← Head: fix/home-wizard-and-loading


📝 Commits (9)

  • c22e5b4 chore: begin home wizard and loading fixes
  • 3f94909 fix(ui): discard untouched setup drafts and theme editor loaders
  • 4640538 fix: preserve cleanup through setup shortcuts
  • bcdae56 fix: release stalled new-chat cancellation
  • c25f675 fix: show chat setup cancellation progress
  • 472d2c4 Merge branch 'staging' into fix/home-wizard-and-loading
  • 0b33cf7 fix(chat): protect completed setup and normalize profile defaults
  • 48e1ba9 Merge branch 'staging' into fix/home-wizard-and-loading
  • fc4ca9e fix: finish setup provenance and normalize profile translators

📊 Changes

21 files changed (+1659 additions, -55 deletions)

View changed files

➕ e2e/home-setup-cancel-loading.e2e.ts (+983 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+21 -9)
📝 packages/client/src/components/chat/ChatCommonOverlays.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatConversationSurface.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatRoleplaySurface.tsx (+1 -1)
📝 packages/client/src/components/chat/ChatSetupWizard.tsx (+103 -25)
📝 packages/client/src/components/chat/NewChatConnectionGate.tsx (+5 -3)
📝 packages/client/src/components/game/GameSurface.tsx (+7 -8)
📝 packages/client/src/components/layout/AppShell.tsx (+13 -1)
📝 packages/client/src/components/layout/ChatSidebar.tsx (+5 -3)
📝 packages/client/src/hooks/use-chat-presets.ts (+11 -0)
📝 packages/client/src/hooks/use-chats.ts (+3 -0)
➕ packages/client/src/hooks/use-discard-new-chat-setup.ts (+73 -0)
📝 packages/client/src/hooks/use-start-new-chat-mode.ts (+5 -3)
➕ packages/client/src/lib/chat-setup-draft.ts (+86 -0)
📝 packages/client/src/localization/locales/en.json (+2 -0)
📝 packages/client/src/stores/chat.store.ts (+14 -0)
📝 packages/client/src/styles/globals.css (+5 -0)
📝 packages/server/src/routes/chats.routes.ts (+18 -0)
📝 packages/server/src/services/storage/chats.storage.ts (+54 -0)

...and 1 more files

📄 Description

Linked issue

Closes #8144
Closes #8147

Why this change

Tapping a Home mode could leave an unwanted empty chat after setup was closed or skipped. Editor loading placeholders also used an old background rather than the configured editor surface.

Accepted cleanup boundary: remove only a newly created, untouched, same-tab empty draft without a character or persona. Existing, populated, configured or content-bearing chats remain protected. A confirmed retained result retires the draft into a normal existing chat; request/save uncertainty preserves its baseline for retry. Reloads without creation provenance keep the chat. This PR does not add persistent deletion provenance or a retention-reason API.

Latest repair proof, fc4ca9edd9bf92802636c09cad192c45a0e0e2b8: Conversation Start, both immediate and buffered schedule, and Roleplay Apply & Start previously sent one unwanted discard POST after completion (rows stayed200). They now retire completed setup before navigation: zero discard POSTs and GET200 in all three browser projects. A rejected profile application still leaves its untouched draft eligible for cleanup: one POST and GET404. Four malformed translator-profile variants previously retained untouched chats; actual create/apply/discard routes now delete all four, with valid legacy-language back-fill preserved. Exact before/after scripts, logs, source and SHA256 manifest, all 19 raw files byte-verified.

What changed

  • Track the original setup baseline for newly created chats; use a guarded server transaction when closing, skipping or navigating away from untouched setup. Preserve real edits, participants, associated data and saved content.
  • Advance only fields owned by known automatic defaults and starred profiles. Match the profile writer's translator normalization, including malformed values and legacy defaults.
  • Retire setup after successful normal/shortcut completion; preserve failed-application cleanup. Bound waiting for in-flight saves and the owned discard request so an unanswered request cannot hold the wizard indefinitely.
  • Use the editor background token while loading on desktop and mobile.

Validation

Final local source is committed at fc4ca9edd9bf92802636c09cad192c45a0e0e2b8, directly after the maintainer's 48e1 staging merge. Full pnpm check passed after the last repair, with one inherited HomeProfessorMariChat hook warning. Canonical empty-setup storage/race regression 1/1, actual profile HTTP 5/5, focused browser 21/21, source shell smoke 7/7 and compiled-startup 3/3 passed. Local CodeRabbit first reported one valid failed-application case; it was reproduced and repaired. Final four-file review completed with zero findings. Hosted final-head checks and an actual viable Dottore verdict remain required before merge.

  • 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 Home mode setup Close/Skip, a completed Conversation/Roleplay, saved defaults and a failed profile application on a physical phone. Automated browser evidence uses desktop Chromium, mobile Chromium and mobile WebKit emulation. The buffered completion test stubs only schedule generation; no external scheduling model is claimed. No local Docker daemon was available; hosted container validation is a separate gate.

The earlier protected retained-chat/reopen proof and actual initial metadata-shape proof cover unchanged boundaries on their recorded revisions. They are not presented as new final-head runs.

Docs and release impact

No new user-facing setting or documentation path; no version/release metadata or changelog changes.

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

UI evidence (if applicable)

The loading surface remains covered by the earlier desktop/mobile dark/light gallery on its recorded revision. The latest repair changes setup lifecycle and profile-baseline filtering, with no layout or color changes.


🔄 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/8151 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/23/2026 **Status:** ✅ Merged **Merged:** 10/23/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/home-wizard-and-loading` --- ### 📝 Commits (9) - [`c22e5b4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c22e5b49303acfc4018e1b6f6bb4c6a5f14b0075) chore: begin home wizard and loading fixes - [`3f94909`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3f9490992cd212bc78aff8da96e24032040993cb) fix(ui): discard untouched setup drafts and theme editor loaders - [`4640538`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4640538eaa9485ad6447e3140b3080abbca2b80e) fix: preserve cleanup through setup shortcuts - [`bcdae56`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bcdae56edb2f9f64132a85091a95771db476f706) fix: release stalled new-chat cancellation - [`c25f675`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c25f6758caca903d070a7272718f579ba8ec1a01) fix: show chat setup cancellation progress - [`472d2c4`](https://github.com/Pasta-Devs/Marinara-Engine/commit/472d2c451df95ddf4b79b71eb53c4e373b007015) Merge branch 'staging' into fix/home-wizard-and-loading - [`0b33cf7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0b33cf7e42d50a83626a3094ae37e8197671f9c3) fix(chat): protect completed setup and normalize profile defaults - [`48e1ba9`](https://github.com/Pasta-Devs/Marinara-Engine/commit/48e1ba91c3bc2d25d074b7c1b2f3e73bf0ca0026) Merge branch 'staging' into fix/home-wizard-and-loading - [`fc4ca9e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc4ca9edd9bf92802636c09cad192c45a0e0e2b8) fix: finish setup provenance and normalize profile translators ### 📊 Changes **21 files changed** (+1659 additions, -55 deletions) <details> <summary>View changed files</summary> ➕ `e2e/home-setup-cancel-loading.e2e.ts` (+983 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+21 -9) 📝 `packages/client/src/components/chat/ChatCommonOverlays.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatConversationSurface.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatRoleplaySurface.tsx` (+1 -1) 📝 `packages/client/src/components/chat/ChatSetupWizard.tsx` (+103 -25) 📝 `packages/client/src/components/chat/NewChatConnectionGate.tsx` (+5 -3) 📝 `packages/client/src/components/game/GameSurface.tsx` (+7 -8) 📝 `packages/client/src/components/layout/AppShell.tsx` (+13 -1) 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+5 -3) 📝 `packages/client/src/hooks/use-chat-presets.ts` (+11 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+3 -0) ➕ `packages/client/src/hooks/use-discard-new-chat-setup.ts` (+73 -0) 📝 `packages/client/src/hooks/use-start-new-chat-mode.ts` (+5 -3) ➕ `packages/client/src/lib/chat-setup-draft.ts` (+86 -0) 📝 `packages/client/src/localization/locales/en.json` (+2 -0) 📝 `packages/client/src/stores/chat.store.ts` (+14 -0) 📝 `packages/client/src/styles/globals.css` (+5 -0) 📝 `packages/server/src/routes/chats.routes.ts` (+18 -0) 📝 `packages/server/src/services/storage/chats.storage.ts` (+54 -0) _...and 1 more files_ </details> ### 📄 Description ## Linked issue Closes #8144 Closes #8147 ## Why this change Tapping a Home mode could leave an unwanted empty chat after setup was closed or skipped. Editor loading placeholders also used an old background rather than the configured editor surface. **Accepted cleanup boundary:** remove only a newly created, untouched, same-tab empty draft without a character or persona. Existing, populated, configured or content-bearing chats remain protected. A confirmed retained result retires the draft into a normal existing chat; request/save uncertainty preserves its baseline for retry. Reloads without creation provenance keep the chat. This PR does not add persistent deletion provenance or a retention-reason API. **Latest repair proof, `fc4ca9edd9bf92802636c09cad192c45a0e0e2b8`:** Conversation Start, both immediate and buffered schedule, and Roleplay Apply & Start previously sent one unwanted discard POST after completion (rows stayed200). They now retire completed setup before navigation: zero discard POSTs and GET200 in all three browser projects. A rejected profile application still leaves its untouched draft eligible for cleanup: one POST and GET404. Four malformed translator-profile variants previously retained untouched chats; actual create/apply/discard routes now delete all four, with valid legacy-language back-fill preserved. [Exact before/after scripts, logs, source and SHA256 manifest](https://gist.github.com/SpicyMarinara/9fb0bd9b732ad7d6e695975c55f423e0), all 19 raw files byte-verified. ## What changed - Track the original setup baseline for newly created chats; use a guarded server transaction when closing, skipping or navigating away from untouched setup. Preserve real edits, participants, associated data and saved content. - Advance only fields owned by known automatic defaults and starred profiles. Match the profile writer's translator normalization, including malformed values and legacy defaults. - Retire setup after successful normal/shortcut completion; preserve failed-application cleanup. Bound waiting for in-flight saves and the owned discard request so an unanswered request cannot hold the wizard indefinitely. - Use the editor background token while loading on desktop and mobile. ## Validation Final local source is committed at `fc4ca9edd9bf92802636c09cad192c45a0e0e2b8`, directly after the maintainer's 48e1 staging merge. Full `pnpm check` passed after the last repair, with one inherited HomeProfessorMariChat hook warning. Canonical empty-setup storage/race regression 1/1, actual profile HTTP 5/5, focused browser 21/21, source shell smoke 7/7 and compiled-startup 3/3 passed. Local CodeRabbit first reported one valid failed-application case; it was reproduced and repaired. Final four-file review completed with zero findings. Hosted final-head checks and an actual viable Dottore verdict remain required before merge. - [ ] `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 Home mode setup Close/Skip, a completed Conversation/Roleplay, saved defaults and a failed profile application on a physical phone. Automated browser evidence uses desktop Chromium, mobile Chromium and mobile WebKit emulation. The buffered completion test stubs only schedule generation; no external scheduling model is claimed. No local Docker daemon was available; hosted container validation is a separate gate. The earlier [protected retained-chat/reopen proof](https://gist.github.com/SpicyMarinara/6ad8f08ab9940a8f424c454219d69009) and [actual initial metadata-shape proof](https://gist.github.com/SpicyMarinara/9c6defe2e25bf0e088f2a7a2b63a0cb8) cover unchanged boundaries on their recorded revisions. They are not presented as new final-head runs. ## Docs and release impact No new user-facing setting or documentation path; no version/release metadata or changelog changes. - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a follow-up issue opened - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) The loading surface remains covered by the earlier [desktop/mobile dark/light gallery](https://gist.github.com/SpicyMarinara/08acd4357aa25db38b0cd6a2e551858a) on its recorded revision. The latest repair changes setup lifecycle and profile-baseline filtering, with no layout or color changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi changed title from [PR #8151] fix(ui): cancel untouched Home chats and align loading surfaces to [PR #8151] [MERGED] fix(ui): cancel untouched Home chats and align loading surfaces 2026-10-25 04:04:15 +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#8126
No description provided.