[GH-ISSUE #2271] [Issue]: 09-CHAT-STORAGE-sidebar-summaries-folders loses folder cleanup/order semantics #1108

Closed
opened 2026-10-21 05:26:49 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2271

Originally assigned to: @Promansis on GitHub.

Summary

09-CHAT-STORAGE-sidebar-summaries-folders parity gap from #2268 Batch 3: refactor chat folders use generic storage CRUD, so legacy folder defaults/order, delete cleanup, and move semantics are not preserved.

Expected behavior

Chat sidebar folders should preserve legacy behavior:

  • Creating a folder validates name/mode, defaults color, sortOrder, and collapsed, inserts the new folder at the top, and shifts existing folder order.
  • Deleting a folder moves chats in that folder back to the top level instead of leaving stale folderId values.
  • Moving a chat to a folder validates the target folder and preserves the legacy folder move contract.

Actual behavior

Refactor folder hooks call generic storage APIs for chat-folders and generic chat patching for moves. The chat-folders storage contract has no create defaults and no delete cleanup, so newly-created folders can miss expected fields/order and deleting a folder can leave chats pointing at a deleted folder. The sidebar groups any chat with a truthy folderId into folderChatsMap, but only renders folders that still exist, so stale folder IDs can hide chats from the rendered unfiled/folder lists.

Steps to reproduce

  1. On the refactor branch, inspect useCreateFolder, useDeleteFolder, and useMoveChat in src/features/catalog/chats/hooks/use-chat-folders.ts.
  2. Inspect the chat-folders collection contract and generic create/delete paths in src-tauri/src/commands/storage/contracts.rs and src-tauri/src/commands/storage/commands/entities.rs.
  3. Compare legacy dedicated chat-folder storage/routes on main.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: refactor@37585ab9 static trace; legacy source main / legacy checkout 7c6190aa
  • Run mode: Tauri desktop / web shell / remote runtime paths use the same shared storage wrapper; runtime not executed
  • OS + version: not runtime-tested
  • Node + pnpm versions: not runtime-tested
  • Rust version, if relevant: not runtime-tested
  • Remote Runtime URL configured? not relevant to static trace
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

Static proof only from the parityscan receipt:

  • Refactor hooks call generic storage: src/features/catalog/chats/hooks/use-chat-folders.ts:22, src/features/catalog/chats/hooks/use-chat-folders.ts:48, src/features/catalog/chats/hooks/use-chat-folders.ts:71.
  • Refactor chat-folders contract has EMPTY_DEFAULTS and EMPTY_CLEANUP: src-tauri/src/commands/storage/contracts.rs:377.
  • Refactor generic create only special-cases messages, connections, lorebook entries, and gallery paths, not chat folders: src-tauri/src/commands/storage/commands/entities.rs:417, src-tauri/src/commands/storage/commands/entities.rs:509.
  • Refactor generic delete applies cleanup only from collection contracts, and chat-folders has none: src-tauri/src/commands/storage/commands/entities.rs:748.
  • Refactor sidebar groups stale folder IDs away from unfiled rows, then renders only existing folder IDs: src/app/shell/ChatSidebar.tsx:389, src/app/shell/ChatSidebar.tsx:1188.
  • Legacy create inserted at top with defaults and shifted existing folder order: packages/server/src/services/storage/chat-folders.storage.ts:20.
  • Legacy delete unfiled chats before deleting the folder: packages/server/src/services/storage/chat-folders.storage.ts:62.
  • Legacy move validated folder existence before applying the move: packages/server/src/routes/chat-folders.routes.ts:70.

Regression notes

Worked in legacy main: dedicated chat-folders routes/storage handled create defaults/order, delete cleanup, and folder move validation. Refactor current implementation appears to route these through generic storage without equivalent chat-folders defaults or cleanup.

Acceptance criteria:

  • Creating a chat folder in refactor yields color, sortOrder, collapsed, createdAt, and updatedAt compatible with legacy expectations.
  • New folder ordering matches intended legacy/top insertion behavior or an intentional divergence is documented in #2268.
  • Deleting a chat folder reparents affected chats to folderId: null; no chat disappears due to a stale folder ID.
  • Moving a chat to a folder rejects missing/nonexistent folder IDs.
  • Embedded and remote/shared API storage entrypoints behave consistently for these folder operations.

Additional context

Source surface: 09-CHAT-STORAGE-sidebar-summaries-folders in #2268.

Batch 3 also scanned 09-CHAT-PERF-message-pagination-count-projection; that surface was no-gap/refactor-better and should not get an issue.

Follow-up not filed here: legacy branch-sibling propagation during folder moves was observed, but branch/chat-file grouping is tracked by a separate #2268 surface, so this issue keeps acceptance criteria to the sidebar folder contract.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 5, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2271 Originally assigned to: @Promansis on GitHub. ## Summary `09-CHAT-STORAGE-sidebar-summaries-folders` parity gap from #2268 Batch 3: refactor chat folders use generic storage CRUD, so legacy folder defaults/order, delete cleanup, and move semantics are not preserved. ## Expected behavior Chat sidebar folders should preserve legacy behavior: - Creating a folder validates name/mode, defaults `color`, `sortOrder`, and `collapsed`, inserts the new folder at the top, and shifts existing folder order. - Deleting a folder moves chats in that folder back to the top level instead of leaving stale `folderId` values. - Moving a chat to a folder validates the target folder and preserves the legacy folder move contract. ## Actual behavior Refactor folder hooks call generic storage APIs for `chat-folders` and generic chat patching for moves. The `chat-folders` storage contract has no create defaults and no delete cleanup, so newly-created folders can miss expected fields/order and deleting a folder can leave chats pointing at a deleted folder. The sidebar groups any chat with a truthy `folderId` into `folderChatsMap`, but only renders folders that still exist, so stale folder IDs can hide chats from the rendered unfiled/folder lists. ## Steps to reproduce 1. On the refactor branch, inspect `useCreateFolder`, `useDeleteFolder`, and `useMoveChat` in `src/features/catalog/chats/hooks/use-chat-folders.ts`. 2. Inspect the `chat-folders` collection contract and generic create/delete paths in `src-tauri/src/commands/storage/contracts.rs` and `src-tauri/src/commands/storage/commands/entities.rs`. 3. Compare legacy dedicated chat-folder storage/routes on `main`. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [x] Shared API wrapper or remote runtime routing - [x] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: `refactor@37585ab9` static trace; legacy source `main` / legacy checkout `7c6190aa` - Run mode: Tauri desktop / web shell / remote runtime paths use the same shared storage wrapper; runtime not executed - OS + version: not runtime-tested - Node + pnpm versions: not runtime-tested - Rust version, if relevant: not runtime-tested - Remote Runtime URL configured? not relevant to static trace - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video Static proof only from the parityscan receipt: - Refactor hooks call generic storage: `src/features/catalog/chats/hooks/use-chat-folders.ts:22`, `src/features/catalog/chats/hooks/use-chat-folders.ts:48`, `src/features/catalog/chats/hooks/use-chat-folders.ts:71`. - Refactor `chat-folders` contract has `EMPTY_DEFAULTS` and `EMPTY_CLEANUP`: `src-tauri/src/commands/storage/contracts.rs:377`. - Refactor generic create only special-cases messages, connections, lorebook entries, and gallery paths, not chat folders: `src-tauri/src/commands/storage/commands/entities.rs:417`, `src-tauri/src/commands/storage/commands/entities.rs:509`. - Refactor generic delete applies cleanup only from collection contracts, and `chat-folders` has none: `src-tauri/src/commands/storage/commands/entities.rs:748`. - Refactor sidebar groups stale folder IDs away from unfiled rows, then renders only existing folder IDs: `src/app/shell/ChatSidebar.tsx:389`, `src/app/shell/ChatSidebar.tsx:1188`. - Legacy create inserted at top with defaults and shifted existing folder order: `packages/server/src/services/storage/chat-folders.storage.ts:20`. - Legacy delete unfiled chats before deleting the folder: `packages/server/src/services/storage/chat-folders.storage.ts:62`. - Legacy move validated folder existence before applying the move: `packages/server/src/routes/chat-folders.routes.ts:70`. ## Regression notes Worked in legacy `main`: dedicated `chat-folders` routes/storage handled create defaults/order, delete cleanup, and folder move validation. Refactor current implementation appears to route these through generic storage without equivalent `chat-folders` defaults or cleanup. Acceptance criteria: - Creating a chat folder in refactor yields `color`, `sortOrder`, `collapsed`, `createdAt`, and `updatedAt` compatible with legacy expectations. - New folder ordering matches intended legacy/top insertion behavior or an intentional divergence is documented in #2268. - Deleting a chat folder reparents affected chats to `folderId: null`; no chat disappears due to a stale folder ID. - Moving a chat to a folder rejects missing/nonexistent folder IDs. - Embedded and remote/shared API storage entrypoints behave consistently for these folder operations. ## Additional context Source surface: `09-CHAT-STORAGE-sidebar-summaries-folders` in #2268. Batch 3 also scanned `09-CHAT-PERF-message-pagination-count-projection`; that surface was no-gap/refactor-better and should not get an issue. Follow-up not filed here: legacy branch-sibling propagation during folder moves was observed, but branch/chat-file grouping is tracked by a separate #2268 surface, so this issue keeps acceptance criteria to the sidebar folder contract. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:26:49 +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#1108
No description provided.