返回 DeepSeek-Reasonix
remote_tab_restore_title_test.go
根目录 / desktop / remote_tab_restore_title_test.go
1 package main
2
3 import (
4 "testing"
5 )
6
7 // The opaque-ID title cleanup exists because older builds persisted a
8 // canonical session ID as the tab title. A legacy row has no canonical
9 // identity and its name is the transcript basename, which the sidebar also
10 // shows as the label — discarding it there makes the tab read "app" while the
11 // sidebar reads "chat-2026-09" after every restart.
12 func TestRestoreKeepsLegacyBasenameTitleAndDropsOpaqueIdentity(t *testing.T) {
13 seedBridgeTestHost(t, "box")
14 a := &App{}
15 a.restoreRemoteTabShells(desktopTabsFile{
16 RemoteTabs: []desktopRemoteTabEntry{
17 {ID: "legacy", HostID: "box", Workspace: "~/app", TopicTitle: "chat-2026-09", SessionName: "chat-2026-09", SessionPath: "/sessions/chat-2026-09.jsonl"},
18 {ID: "canonical", HostID: "box", Workspace: "~/app2", TopicTitle: "abc123", SessionName: "abc123", SessionID: "abc123"},
19 },
20 RemoteTabOrder: []string{"legacy", "canonical"},
21 })
22
23 a.remoteTabMu.Lock()
24 defer a.remoteTabMu.Unlock()
25 if got := a.remoteTabs["legacy"].topicTitle; got != "chat-2026-09" {
26 t.Fatalf("legacy restored title = %q, want the persisted basename", got)
27 }
28 if got := a.remoteTabs["canonical"].topicTitle; got != remoteWorkspaceName("~/app2") {
29 t.Fatalf("canonical restored title = %q, want the workspace fallback", got)
30 }
31 }
32
32 lines GO