[GH-ISSUE #2276] 09-CHAT-STORAGE-branch-group-lifecycle / 09-CHAT-UI-branch-management: branch labels drift from legacy branchName #1114

Closed
opened 2026-10-21 05:26:58 +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/2276

Originally assigned to: @Promansis on GitHub.

Summary

09-CHAT-STORAGE-branch-group-lifecycle / 09-CHAT-UI-branch-management parity gap from #2268 Batch 9: refactor branch creation stores the new branch display label in chat.name ({base_name} Branch) instead of preserving the stable chat name and setting metadata.branchName. The branch selector also renders raw branch.name, so newly created and renamed branches can display the wrong label compared with legacy Manage Chat Files behavior.

Expected behavior

Legacy behavior on main:

  • Creating a chat branch keeps the stable chat/thread name unchanged.
  • The new branch display label is stored as metadata.branchName: "New Branch".
  • Manage Chat Files uses getChatDisplayName, so branch rename updates metadata.branchName and the UI shows the per-branch label.
  • Branch creation still copies messages up to the anchor, uses active swipe content, carries folder assignment, and copies tracker snapshots.

Acceptance criteria:

  • 09-CHAT-STORAGE-branch-group-lifecycle: branch creation preserves the source chat name and initializes the new branch label through metadata.branchName rather than mutating name.
  • 09-CHAT-UI-branch-management: in-chat branch selector and Manage Chat Files show the same branch display label, including freshly created branches and renamed branches.
  • Existing branch lifecycle behavior remains intact: group enrollment, active-swipe message copy, summary metadata pruning, folder carry-over, branch delete, and group delete.
  • Add focused proof that a newly branched chat has stable name, expected metadata.branchName, and branch selector-compatible display data.

Actual behavior

Refactor behavior:

  • branch_chat reads the source name and writes the new chat name as format!("{base_name} Branch").
  • The refactor branch creation path prunes summary metadata but does not initialize metadata.branchName for a normal branch.
  • getChatDisplayName still prefers metadata.branchName when present, and Manage Chat Files rename writes branchName, but ChatBranchSelector displays branch.name directly. That means branch labels can drift between the selector and Manage Chat Files, and new branches do not match legacy label semantics.

Steps to reproduce

  1. On the refactor branch, create a chat with a stable name and branch it from a message action.
  2. Open Manage Chat Files and the in-chat branch selector for that branch group.
  3. Rename a non-active branch in Manage Chat Files.
  4. Compare the branch label shown in Manage Chat Files with the label shown in the branch selector and inspect the stored chat name / metadata.branchName fields.

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 current implementation; #2268 tracker snapshot lists refactor@37585ab9
  • Run mode: static trace only
  • OS + version: not run
  • Node + pnpm versions: not run
  • Rust version, if relevant: not run
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

Proof from Batch 9 static trace:

Legacy files inspected:

  • packages/server/src/routes/chats.routes.ts:2235 keeps branch chat name stable.
  • packages/server/src/routes/chats.routes.ts:2257 copies metadata minus summaries and sets branchName: "New Branch".
  • packages/server/src/routes/chats.routes.ts:2263 copies messages from the source chat.
  • packages/server/src/routes/chats.routes.ts:2273 uses the active swipe content while copying.
  • packages/server/src/routes/chats.routes.ts:2314 carries the folder assignment.
  • packages/server/src/routes/chats.routes.ts:2316 copies tracker snapshots.
  • packages/client/src/components/chat/ChatFilesDrawer.tsx:84 renames via branch display name / metadata.
  • packages/client/src/components/chat/ChatFilesDrawer.tsx:99 preserves active chat behavior when deleting a branch.
  • packages/client/src/components/chat/ChatBranchSelector.tsx:91 renders only grouped chats and supports switching.

Refactor files inspected:

  • src-tauri/src/commands/storage/chats.rs:990 begins branch_chat.
  • src-tauri/src/commands/storage/chats.rs:996 reads the source base name.
  • src-tauri/src/commands/storage/chats.rs:1010 assigns the new chat id and writes name to {base_name} Branch.
  • src-tauri/src/commands/storage/chats.rs:1016 prunes summary metadata, but this path does not initialize metadata.branchName.
  • src/shared/lib/chat-display.ts:25 displays metadata.branchName when present.
  • src/features/modes/shared/chat-ui/components/ChatFilesDrawer.tsx:95 renames by patching branchName.
  • src/features/modes/shared/chat-ui/components/ChatBranchSelector.tsx:94 uses currentBranch?.name for the selector button label.
  • src/features/modes/shared/chat-ui/components/ChatBranchSelector.tsx:193 renders branch.name for menu rows.

Regression notes

This is a parity gap against legacy main for #2268 Target 9, Batch 9. The legacy route explicitly documents that branch labels should live in metadata while the stable thread/chat name remains unchanged.

Additional context

Source tracker: #2268.

Follow-ups not included in this issue:

  • Legacy rejects scene chats before branching; that was not chased because it crosses the scene/game owner boundary for this batch.
  • Tracker snapshot internals were not expanded because Batch 9 explicitly kept tracker snapshot behavior out of the central proof.

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/2276 Originally assigned to: @Promansis on GitHub. ## Summary `09-CHAT-STORAGE-branch-group-lifecycle` / `09-CHAT-UI-branch-management` parity gap from #2268 Batch 9: refactor branch creation stores the new branch display label in `chat.name` (`{base_name} Branch`) instead of preserving the stable chat name and setting `metadata.branchName`. The branch selector also renders raw `branch.name`, so newly created and renamed branches can display the wrong label compared with legacy Manage Chat Files behavior. ## Expected behavior Legacy behavior on `main`: - Creating a chat branch keeps the stable chat/thread `name` unchanged. - The new branch display label is stored as `metadata.branchName: "New Branch"`. - Manage Chat Files uses `getChatDisplayName`, so branch rename updates `metadata.branchName` and the UI shows the per-branch label. - Branch creation still copies messages up to the anchor, uses active swipe content, carries folder assignment, and copies tracker snapshots. Acceptance criteria: - `09-CHAT-STORAGE-branch-group-lifecycle`: branch creation preserves the source chat `name` and initializes the new branch label through `metadata.branchName` rather than mutating `name`. - `09-CHAT-UI-branch-management`: in-chat branch selector and Manage Chat Files show the same branch display label, including freshly created branches and renamed branches. - Existing branch lifecycle behavior remains intact: group enrollment, active-swipe message copy, summary metadata pruning, folder carry-over, branch delete, and group delete. - Add focused proof that a newly branched chat has stable `name`, expected `metadata.branchName`, and branch selector-compatible display data. ## Actual behavior Refactor behavior: - `branch_chat` reads the source `name` and writes the new chat `name` as `format!("{base_name} Branch")`. - The refactor branch creation path prunes summary metadata but does not initialize `metadata.branchName` for a normal branch. - `getChatDisplayName` still prefers `metadata.branchName` when present, and Manage Chat Files rename writes `branchName`, but `ChatBranchSelector` displays `branch.name` directly. That means branch labels can drift between the selector and Manage Chat Files, and new branches do not match legacy label semantics. ## Steps to reproduce 1. On the refactor branch, create a chat with a stable name and branch it from a message action. 2. Open Manage Chat Files and the in-chat branch selector for that branch group. 3. Rename a non-active branch in Manage Chat Files. 4. Compare the branch label shown in Manage Chat Files with the label shown in the branch selector and inspect the stored chat `name` / `metadata.branchName` fields. ## Impact area <!-- Check the areas you think are relevant. Leave uncertain items unchecked. --> - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [x] 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 current implementation; #2268 tracker snapshot lists `refactor@37585ab9` - Run mode: static trace only - OS + version: not run - Node + pnpm versions: not run - Rust version, if relevant: not run - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video Proof from Batch 9 static trace: Legacy files inspected: - `packages/server/src/routes/chats.routes.ts:2235` keeps branch chat `name` stable. - `packages/server/src/routes/chats.routes.ts:2257` copies metadata minus summaries and sets `branchName: "New Branch"`. - `packages/server/src/routes/chats.routes.ts:2263` copies messages from the source chat. - `packages/server/src/routes/chats.routes.ts:2273` uses the active swipe content while copying. - `packages/server/src/routes/chats.routes.ts:2314` carries the folder assignment. - `packages/server/src/routes/chats.routes.ts:2316` copies tracker snapshots. - `packages/client/src/components/chat/ChatFilesDrawer.tsx:84` renames via branch display name / metadata. - `packages/client/src/components/chat/ChatFilesDrawer.tsx:99` preserves active chat behavior when deleting a branch. - `packages/client/src/components/chat/ChatBranchSelector.tsx:91` renders only grouped chats and supports switching. Refactor files inspected: - `src-tauri/src/commands/storage/chats.rs:990` begins `branch_chat`. - `src-tauri/src/commands/storage/chats.rs:996` reads the source base name. - `src-tauri/src/commands/storage/chats.rs:1010` assigns the new chat id and writes `name` to `{base_name} Branch`. - `src-tauri/src/commands/storage/chats.rs:1016` prunes summary metadata, but this path does not initialize `metadata.branchName`. - `src/shared/lib/chat-display.ts:25` displays `metadata.branchName` when present. - `src/features/modes/shared/chat-ui/components/ChatFilesDrawer.tsx:95` renames by patching `branchName`. - `src/features/modes/shared/chat-ui/components/ChatBranchSelector.tsx:94` uses `currentBranch?.name` for the selector button label. - `src/features/modes/shared/chat-ui/components/ChatBranchSelector.tsx:193` renders `branch.name` for menu rows. ## Regression notes This is a parity gap against legacy `main` for #2268 Target 9, Batch 9. The legacy route explicitly documents that branch labels should live in metadata while the stable thread/chat name remains unchanged. ## Additional context Source tracker: #2268. Follow-ups not included in this issue: - Legacy rejects scene chats before branching; that was not chased because it crosses the scene/game owner boundary for this batch. - Tracker snapshot internals were not expanded because Batch 9 explicitly kept tracker snapshot behavior out of the central proof. ## 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:58 +07:00
  • closed this issue
  • added the
    bug
    label
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#1114
No description provided.