The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Revert "fix(desktop): keep minted Browser tab ids across restore; complete test mocks for session-focus"
teknium1b2aeb0009eef
diff --git a/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsxindex e18f8d4177c..d9fafca0bb9 100644--- a/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx+++ b/apps/desktop/src/app/shell/hooks/use-statusbar-items.test.tsx@@ -27,25 +27,9 @@ const $focusedTreePaneId = $focusedTreePaneIdMock as unknown as WritableAtom<nul// The focused pane is derived from the layout tree; a settable atom stands in// so a test can focus a tile without building a pane tree.vi.mock('@/store/session-focus', async () => {- const { atom, computed } = await import('nanostores')- const { $selectedStoredSessionId } = await import('@/store/session')-- // The focused pane is derived from the layout tree; a settable atom stands- // in so a test can focus a tile without building a pane tree.- const $focusedTreePaneId = atom<null | string>(null)-- // The preview store (reached via session-states) derives $visiblePreviewTabs- // from $focusedStoredSessionId at import time, and the timer tests depend on- // the REAL derivation (tile focus overrides the primary selection), so the- // mock mirrors session-focus's shape instead of stubbing a static atom.- const TILE_PANE_PREFIX = 'session-tile:'-- return {- $focusedTreePaneId,- $focusedStoredSessionId: computed([$focusedTreePaneId, $selectedStoredSessionId], (active, selected) =>- active?.startsWith(TILE_PANE_PREFIX) ? active.slice(TILE_PANE_PREFIX.length) : selected- )- }+ const { atom } = await import('nanostores')++ return { $focusedTreePaneId: atom<null | string>(null) }})// $focusedStoredSessionId derives from the LAYOUT TREE ($activeTreeGroup +diff --git a/apps/desktop/src/sdk/open-session-refresh-in-place.test.ts b/apps/desktop/src/sdk/open-session-refresh-in-place.test.tsindex f0a442da50e..5d643c556f6 100644--- a/apps/desktop/src/sdk/open-session-refresh-in-place.test.ts+++ b/apps/desktop/src/sdk/open-session-refresh-in-place.test.ts@@ -29,10 +29,7 @@ vi.mock('@/app/open-session', () => ({ openSession: vi.fn() }))vi.mock('@/components/pane-shell/tree/store', async () => {const { atom } = await import('nanostores')- // session-focus.ts (reached via the preview store) and the layout store- // read these at import time; a mock without them crashes before any test.return {- $activeTreeGroup: atom(null),$collapsedTreeSides: atom(new Set()),$hiddenTreePanes: atom(new Set()),$layoutTree: atom(null),diff --git a/apps/desktop/src/sdk/profile-routing.test.ts b/apps/desktop/src/sdk/profile-routing.test.tsindex c7b6e1c0d42..42ee2c7cc45 100644--- a/apps/desktop/src/sdk/profile-routing.test.ts+++ b/apps/desktop/src/sdk/profile-routing.test.ts@@ -11,10 +11,7 @@ vi.mock('@/app/open-session', () => ({ openSession: vi.fn() }))vi.mock('@/components/pane-shell/tree/store', async () => {const { atom } = await import('nanostores')- // session-focus.ts (reached via the preview store) and the layout store- // read these at import time; a mock without them crashes before any test.return {- $activeTreeGroup: atom(null),$collapsedTreeSides: atom(new Set()),$hiddenTreePanes: atom(new Set()),$layoutTree: atom(null),diff --git a/apps/desktop/src/store/preview.ts b/apps/desktop/src/store/preview.tsindex 7a8eb148e35..e37bd4d4188 100644--- a/apps/desktop/src/store/preview.ts+++ b/apps/desktop/src/store/preview.ts@@ -160,14 +160,10 @@ function parseTabList(parsed: unknown): PreviewTab[] {tab.sessionId !== undefined || tab.pinned !== undefined ? tab : { ...tab, pinned: true })- // File tab identities are session-scoped: a row written before the scope- // existed (or by an id-collapsing legacy build) rekeys onto the canonical- // `file:<session>:<path>` form, deduping the same file persisted under both- // old and new ids. Browser (URL) rows keep their MINTED id verbatim: ids are- // never rekeyed (#119850), because the pop-out window hand-off looks tabs up- // by the persisted id, and reusing a navigated Browser depends on the id- // surviving restore. Keep only the LAST row per id — the most recently- // opened wins.+ // One Browser: rekey restored URL tabs onto the singleton id (rows written+ // before the id existed carried one id per address). File tabs rekey onto+ // their session-scoped canonical id. Keep only the LAST row per id — the+ // most recently opened wins.const lastUrl = owned.findLast(tab => tab.target.kind === 'url')const deduped = new Map<string, PreviewTab>()@@ -176,9 +172,12 @@ function parseTabList(parsed: unknown): PreviewTab[] {continue}- const id = tab.target.kind === 'file' ? previewTabId(tab.target, tab.sessionId) : tab.id+ const id =+ tab.target.kind === 'url' || tab.target.kind === 'file'+ ? previewTabId(tab.target, tab.sessionId)+ : tab.id- deduped.set(id, tab.target.kind === 'file' ? { ...tab, id } : tab)+ deduped.set(id, { ...tab, id })}return [...deduped.values()]