Remove legacy tab snapshot provider
- commit
- 3eadacfc95d831da2d150324d720e4304da9f61d
- author
- brice · · 2026-05-05 13:47 UTC
- parent
- acba2a5
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +3 -138
M .mockery.yaml +0 -1
| @@ -15,7 +15,6 @@ packages: | |||
| 15 | 15 | DiffFormatter: {} | |
| 16 | 16 | SessionLogger: {} | |
| 17 | 17 | SessionSpawner: {} | |
| 18 | - | TabListProvider: {} | |
| 19 | 18 | WindowStateProvider: {} | |
| 20 | 19 | WebView: {} | |
| 21 | 20 | WebViewFactory: {} | |
| @@ -15,7 +15,6 @@ packages: | |||||
| 15 | DiffFormatter: {} | 15 | DiffFormatter: {} | ||
| 16 | SessionLogger: {} | 16 | SessionLogger: {} | ||
| 17 | SessionSpawner: {} | 17 | SessionSpawner: {} | ||
| 18 | - | TabListProvider: {} | |||
| 19 | WindowStateProvider: {} | 18 | WindowStateProvider: {} | ||
| 20 | WebView: {} | 19 | WebView: {} | ||
| 21 | WebViewFactory: {} | 20 | WebViewFactory: {} | ||
M internal/application/port/mocks/mocks.go +0 -117
| @@ -10675,123 +10675,6 @@ func (_c *MockSessionLogger_CreateLogger_Call) RunAndReturn(run func(ctx context | |||
| 10675 | 10675 | return _c | |
| 10676 | 10676 | } | |
| 10677 | 10677 | ||
| 10678 | - | // NewMockTabListProvider creates a new instance of MockTabListProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 10679 | - | // The first argument is typically a *testing.T value. | |
| 10680 | - | func NewMockTabListProvider(t interface { | |
| 10681 | - | mock.TestingT | |
| 10682 | - | Cleanup(func()) | |
| 10683 | - | }) *MockTabListProvider { | |
| 10684 | - | mock := &MockTabListProvider{} | |
| 10685 | - | mock.Mock.Test(t) | |
| 10686 | - | ||
| 10687 | - | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 10688 | - | ||
| 10689 | - | return mock | |
| 10690 | - | } | |
| 10691 | - | ||
| 10692 | - | // MockTabListProvider is an autogenerated mock type for the TabListProvider type | |
| 10693 | - | type MockTabListProvider struct { | |
| 10694 | - | mock.Mock | |
| 10695 | - | } | |
| 10696 | - | ||
| 10697 | - | type MockTabListProvider_Expecter struct { | |
| 10698 | - | mock *mock.Mock | |
| 10699 | - | } | |
| 10700 | - | ||
| 10701 | - | func (_m *MockTabListProvider) EXPECT() *MockTabListProvider_Expecter { | |
| 10702 | - | return &MockTabListProvider_Expecter{mock: &_m.Mock} | |
| 10703 | - | } | |
| 10704 | - | ||
| 10705 | - | // GetSessionID provides a mock function for the type MockTabListProvider | |
| 10706 | - | func (_mock *MockTabListProvider) GetSessionID() entity.SessionID { | |
| 10707 | - | ret := _mock.Called() | |
| 10708 | - | ||
| 10709 | - | if len(ret) == 0 { | |
| 10710 | - | panic("no return value specified for GetSessionID") | |
| 10711 | - | } | |
| 10712 | - | ||
| 10713 | - | var r0 entity.SessionID | |
| 10714 | - | if returnFunc, ok := ret.Get(0).(func() entity.SessionID); ok { | |
| 10715 | - | r0 = returnFunc() | |
| 10716 | - | } else { | |
| 10717 | - | r0 = ret.Get(0).(entity.SessionID) | |
| 10718 | - | } | |
| 10719 | - | return r0 | |
| 10720 | - | } | |
| 10721 | - | ||
| 10722 | - | // MockTabListProvider_GetSessionID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSessionID' | |
| 10723 | - | type MockTabListProvider_GetSessionID_Call struct { | |
| 10724 | - | *mock.Call | |
| 10725 | - | } | |
| 10726 | - | ||
| 10727 | - | // GetSessionID is a helper method to define mock.On call | |
| 10728 | - | func (_e *MockTabListProvider_Expecter) GetSessionID() *MockTabListProvider_GetSessionID_Call { | |
| 10729 | - | return &MockTabListProvider_GetSessionID_Call{Call: _e.mock.On("GetSessionID")} | |
| 10730 | - | } | |
| 10731 | - | ||
| 10732 | - | func (_c *MockTabListProvider_GetSessionID_Call) Run(run func()) *MockTabListProvider_GetSessionID_Call { | |
| 10733 | - | _c.Call.Run(func(args mock.Arguments) { | |
| 10734 | - | run() | |
| 10735 | - | }) | |
| 10736 | - | return _c | |
| 10737 | - | } | |
| 10738 | - | ||
| 10739 | - | func (_c *MockTabListProvider_GetSessionID_Call) Return(sessionID entity.SessionID) *MockTabListProvider_GetSessionID_Call { | |
| 10740 | - | _c.Call.Return(sessionID) | |
| 10741 | - | return _c | |
| 10742 | - | } | |
| 10743 | - | ||
| 10744 | - | func (_c *MockTabListProvider_GetSessionID_Call) RunAndReturn(run func() entity.SessionID) *MockTabListProvider_GetSessionID_Call { | |
| 10745 | - | _c.Call.Return(run) | |
| 10746 | - | return _c | |
| 10747 | - | } | |
| 10748 | - | ||
| 10749 | - | // GetTabList provides a mock function for the type MockTabListProvider | |
| 10750 | - | func (_mock *MockTabListProvider) GetTabList() *entity.TabList { | |
| 10751 | - | ret := _mock.Called() | |
| 10752 | - | ||
| 10753 | - | if len(ret) == 0 { | |
| 10754 | - | panic("no return value specified for GetTabList") | |
| 10755 | - | } | |
| 10756 | - | ||
| 10757 | - | var r0 *entity.TabList | |
| 10758 | - | if returnFunc, ok := ret.Get(0).(func() *entity.TabList); ok { | |
| 10759 | - | r0 = returnFunc() | |
| 10760 | - | } else { | |
| 10761 | - | if ret.Get(0) != nil { | |
| 10762 | - | r0 = ret.Get(0).(*entity.TabList) | |
| 10763 | - | } | |
| 10764 | - | } | |
| 10765 | - | return r0 | |
| 10766 | - | } | |
| 10767 | - | ||
| 10768 | - | // MockTabListProvider_GetTabList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTabList' | |
| 10769 | - | type MockTabListProvider_GetTabList_Call struct { | |
| 10770 | - | *mock.Call | |
| 10771 | - | } | |
| 10772 | - | ||
| 10773 | - | // GetTabList is a helper method to define mock.On call | |
| 10774 | - | func (_e *MockTabListProvider_Expecter) GetTabList() *MockTabListProvider_GetTabList_Call { | |
| 10775 | - | return &MockTabListProvider_GetTabList_Call{Call: _e.mock.On("GetTabList")} | |
| 10776 | - | } | |
| 10777 | - | ||
| 10778 | - | func (_c *MockTabListProvider_GetTabList_Call) Run(run func()) *MockTabListProvider_GetTabList_Call { | |
| 10779 | - | _c.Call.Run(func(args mock.Arguments) { | |
| 10780 | - | run() | |
| 10781 | - | }) | |
| 10782 | - | return _c | |
| 10783 | - | } | |
| 10784 | - | ||
| 10785 | - | func (_c *MockTabListProvider_GetTabList_Call) Return(tabList *entity.TabList) *MockTabListProvider_GetTabList_Call { | |
| 10786 | - | _c.Call.Return(tabList) | |
| 10787 | - | return _c | |
| 10788 | - | } | |
| 10789 | - | ||
| 10790 | - | func (_c *MockTabListProvider_GetTabList_Call) RunAndReturn(run func() *entity.TabList) *MockTabListProvider_GetTabList_Call { | |
| 10791 | - | _c.Call.Return(run) | |
| 10792 | - | return _c | |
| 10793 | - | } | |
| 10794 | - | ||
| 10795 | 10678 | // NewMockWindowStateProvider creates a new instance of MockWindowStateProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 10796 | 10679 | // The first argument is typically a *testing.T value. | |
| 10797 | 10680 | func NewMockWindowStateProvider(t interface { | |
| @@ -10675,123 +10675,6 @@ func (_c *MockSessionLogger_CreateLogger_Call) RunAndReturn(run func(ctx context | |||||
| 10675 | return _c | 10675 | return _c | ||
| 10676 | } | 10676 | } | ||
| 10677 | 10677 | ||||
| 10678 | - | // NewMockTabListProvider creates a new instance of MockTabListProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 10679 | - | // The first argument is typically a *testing.T value. | |||
| 10680 | - | func NewMockTabListProvider(t interface { | |||
| 10681 | - | mock.TestingT | |||
| 10682 | - | Cleanup(func()) | |||
| 10683 | - | }) *MockTabListProvider { | |||
| 10684 | - | mock := &MockTabListProvider{} | |||
| 10685 | - | mock.Mock.Test(t) | |||
| 10686 | - | ||||
| 10687 | - | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 10688 | - | ||||
| 10689 | - | return mock | |||
| 10690 | - | } | |||
| 10691 | - | ||||
| 10692 | - | // MockTabListProvider is an autogenerated mock type for the TabListProvider type | |||
| 10693 | - | type MockTabListProvider struct { | |||
| 10694 | - | mock.Mock | |||
| 10695 | - | } | |||
| 10696 | - | ||||
| 10697 | - | type MockTabListProvider_Expecter struct { | |||
| 10698 | - | mock *mock.Mock | |||
| 10699 | - | } | |||
| 10700 | - | ||||
| 10701 | - | func (_m *MockTabListProvider) EXPECT() *MockTabListProvider_Expecter { | |||
| 10702 | - | return &MockTabListProvider_Expecter{mock: &_m.Mock} | |||
| 10703 | - | } | |||
| 10704 | - | ||||
| 10705 | - | // GetSessionID provides a mock function for the type MockTabListProvider | |||
| 10706 | - | func (_mock *MockTabListProvider) GetSessionID() entity.SessionID { | |||
| 10707 | - | ret := _mock.Called() | |||
| 10708 | - | ||||
| 10709 | - | if len(ret) == 0 { | |||
| 10710 | - | panic("no return value specified for GetSessionID") | |||
| 10711 | - | } | |||
| 10712 | - | ||||
| 10713 | - | var r0 entity.SessionID | |||
| 10714 | - | if returnFunc, ok := ret.Get(0).(func() entity.SessionID); ok { | |||
| 10715 | - | r0 = returnFunc() | |||
| 10716 | - | } else { | |||
| 10717 | - | r0 = ret.Get(0).(entity.SessionID) | |||
| 10718 | - | } | |||
| 10719 | - | return r0 | |||
| 10720 | - | } | |||
| 10721 | - | ||||
| 10722 | - | // MockTabListProvider_GetSessionID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSessionID' | |||
| 10723 | - | type MockTabListProvider_GetSessionID_Call struct { | |||
| 10724 | - | *mock.Call | |||
| 10725 | - | } | |||
| 10726 | - | ||||
| 10727 | - | // GetSessionID is a helper method to define mock.On call | |||
| 10728 | - | func (_e *MockTabListProvider_Expecter) GetSessionID() *MockTabListProvider_GetSessionID_Call { | |||
| 10729 | - | return &MockTabListProvider_GetSessionID_Call{Call: _e.mock.On("GetSessionID")} | |||
| 10730 | - | } | |||
| 10731 | - | ||||
| 10732 | - | func (_c *MockTabListProvider_GetSessionID_Call) Run(run func()) *MockTabListProvider_GetSessionID_Call { | |||
| 10733 | - | _c.Call.Run(func(args mock.Arguments) { | |||
| 10734 | - | run() | |||
| 10735 | - | }) | |||
| 10736 | - | return _c | |||
| 10737 | - | } | |||
| 10738 | - | ||||
| 10739 | - | func (_c *MockTabListProvider_GetSessionID_Call) Return(sessionID entity.SessionID) *MockTabListProvider_GetSessionID_Call { | |||
| 10740 | - | _c.Call.Return(sessionID) | |||
| 10741 | - | return _c | |||
| 10742 | - | } | |||
| 10743 | - | ||||
| 10744 | - | func (_c *MockTabListProvider_GetSessionID_Call) RunAndReturn(run func() entity.SessionID) *MockTabListProvider_GetSessionID_Call { | |||
| 10745 | - | _c.Call.Return(run) | |||
| 10746 | - | return _c | |||
| 10747 | - | } | |||
| 10748 | - | ||||
| 10749 | - | // GetTabList provides a mock function for the type MockTabListProvider | |||
| 10750 | - | func (_mock *MockTabListProvider) GetTabList() *entity.TabList { | |||
| 10751 | - | ret := _mock.Called() | |||
| 10752 | - | ||||
| 10753 | - | if len(ret) == 0 { | |||
| 10754 | - | panic("no return value specified for GetTabList") | |||
| 10755 | - | } | |||
| 10756 | - | ||||
| 10757 | - | var r0 *entity.TabList | |||
| 10758 | - | if returnFunc, ok := ret.Get(0).(func() *entity.TabList); ok { | |||
| 10759 | - | r0 = returnFunc() | |||
| 10760 | - | } else { | |||
| 10761 | - | if ret.Get(0) != nil { | |||
| 10762 | - | r0 = ret.Get(0).(*entity.TabList) | |||
| 10763 | - | } | |||
| 10764 | - | } | |||
| 10765 | - | return r0 | |||
| 10766 | - | } | |||
| 10767 | - | ||||
| 10768 | - | // MockTabListProvider_GetTabList_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTabList' | |||
| 10769 | - | type MockTabListProvider_GetTabList_Call struct { | |||
| 10770 | - | *mock.Call | |||
| 10771 | - | } | |||
| 10772 | - | ||||
| 10773 | - | // GetTabList is a helper method to define mock.On call | |||
| 10774 | - | func (_e *MockTabListProvider_Expecter) GetTabList() *MockTabListProvider_GetTabList_Call { | |||
| 10775 | - | return &MockTabListProvider_GetTabList_Call{Call: _e.mock.On("GetTabList")} | |||
| 10776 | - | } | |||
| 10777 | - | ||||
| 10778 | - | func (_c *MockTabListProvider_GetTabList_Call) Run(run func()) *MockTabListProvider_GetTabList_Call { | |||
| 10779 | - | _c.Call.Run(func(args mock.Arguments) { | |||
| 10780 | - | run() | |||
| 10781 | - | }) | |||
| 10782 | - | return _c | |||
| 10783 | - | } | |||
| 10784 | - | ||||
| 10785 | - | func (_c *MockTabListProvider_GetTabList_Call) Return(tabList *entity.TabList) *MockTabListProvider_GetTabList_Call { | |||
| 10786 | - | _c.Call.Return(tabList) | |||
| 10787 | - | return _c | |||
| 10788 | - | } | |||
| 10789 | - | ||||
| 10790 | - | func (_c *MockTabListProvider_GetTabList_Call) RunAndReturn(run func() *entity.TabList) *MockTabListProvider_GetTabList_Call { | |||
| 10791 | - | _c.Call.Return(run) | |||
| 10792 | - | return _c | |||
| 10793 | - | } | |||
| 10794 | - | ||||
| 10795 | // NewMockWindowStateProvider creates a new instance of MockWindowStateProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | 10678 | // NewMockWindowStateProvider creates a new instance of MockWindowStateProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | ||
| 10796 | // The first argument is typically a *testing.T value. | 10679 | // The first argument is typically a *testing.T value. | ||
| 10797 | func NewMockWindowStateProvider(t interface { | 10680 | func NewMockWindowStateProvider(t interface { | ||
M internal/application/port/session_state.go +0 -11
| @@ -6,17 +6,6 @@ import ( | |||
| 6 | 6 | "github.com/bnema/dumber/internal/domain/entity" | |
| 7 | 7 | ) | |
| 8 | 8 | ||
| 9 | - | // TabListProvider provides access to the current tab list state. | |
| 10 | - | // Implemented by the UI layer to allow the snapshot service to read state. | |
| 11 | - | // | |
| 12 | - | // Deprecated: use WindowStateProvider for v2 window-scoped snapshots. | |
| 13 | - | type TabListProvider interface { | |
| 14 | - | // GetTabList returns the current tab list state. | |
| 15 | - | GetTabList() *entity.TabList | |
| 16 | - | // GetSessionID returns the current session ID. | |
| 17 | - | GetSessionID() entity.SessionID | |
| 18 | - | } | |
| 19 | - | ||
| 20 | 9 | // WindowStateProvider provides window-scoped browser state for v2 snapshots. | |
| 21 | 10 | // Implemented by the UI layer and consumed by the snapshot service. | |
| 22 | 11 | type WindowStateProvider interface { | |
| @@ -6,17 +6,6 @@ import ( | |||||
| 6 | "github.com/bnema/dumber/internal/domain/entity" | 6 | "github.com/bnema/dumber/internal/domain/entity" | ||
| 7 | ) | 7 | ) | ||
| 8 | 8 | ||||
| 9 | - | // TabListProvider provides access to the current tab list state. | |||
| 10 | - | // Implemented by the UI layer to allow the snapshot service to read state. | |||
| 11 | - | // | |||
| 12 | - | // Deprecated: use WindowStateProvider for v2 window-scoped snapshots. | |||
| 13 | - | type TabListProvider interface { | |||
| 14 | - | // GetTabList returns the current tab list state. | |||
| 15 | - | GetTabList() *entity.TabList | |||
| 16 | - | // GetSessionID returns the current session ID. | |||
| 17 | - | GetSessionID() entity.SessionID | |||
| 18 | - | } | |||
| 19 | - | ||||
| 20 | // WindowStateProvider provides window-scoped browser state for v2 snapshots. | 9 | // WindowStateProvider provides window-scoped browser state for v2 snapshots. | ||
| 21 | // Implemented by the UI layer and consumed by the snapshot service. | 10 | // Implemented by the UI layer and consumed by the snapshot service. | ||
| 22 | type WindowStateProvider interface { | 11 | type WindowStateProvider interface { | ||
M internal/ui/app.go +3 -9
| @@ -680,8 +680,7 @@ func (a *App) activateBrowserWindow(bw *browserWindow) { | |||
| 680 | 680 | if a.tabs != nil && activeID != "" { | |
| 681 | 681 | if a.tabs.Find(activeID) == nil { | |
| 682 | 682 | if tab := perWinTabs.Find(activeID); tab != nil { | |
| 683 | - | tabSnapshot := *tab | |
| 684 | - | a.tabs.Add(&tabSnapshot) | |
| 683 | + | a.tabs.Add(cloneTabForGlobalList(tab)) | |
| 685 | 684 | } | |
| 686 | 685 | } | |
| 687 | 686 | if a.tabs.Find(activeID) != nil { | |
| @@ -1900,12 +1899,7 @@ func (a *App) initUpdateCoordinator(ctx context.Context) { | |||
| 1900 | 1899 | log.Debug().Msg("update coordinator initialized") | |
| 1901 | 1900 | } | |
| 1902 | 1901 | ||
| 1903 | - | // GetTabList implements port.TabListProvider. | |
| 1904 | - | func (a *App) GetTabList() *entity.TabList { | |
| 1905 | - | return a.tabs | |
| 1906 | - | } | |
| 1907 | - | ||
| 1908 | - | // GetSessionID implements port.TabListProvider and port.WindowStateProvider. | |
| 1902 | + | // GetSessionID implements port.WindowStateProvider. | |
| 1909 | 1903 | func (a *App) GetSessionID() entity.SessionID { | |
| 1910 | 1904 | if a.deps == nil { | |
| 1911 | 1905 | return "" | |
| @@ -1979,7 +1973,7 @@ func (a *App) GetWindowSnapshotState() ([]entity.WindowTabListState, int) { | |||
| 1979 | 1973 | tabs = entity.NewTabList() | |
| 1980 | 1974 | for _, tab := range globalTabs.Tabs { | |
| 1981 | 1975 | if tabOwners[tab.ID] == wid { | |
| 1982 | - | tabs.Add(tab) | |
| 1976 | + | tabs.Add(cloneTabForGlobalList(tab)) | |
| 1983 | 1977 | } | |
| 1984 | 1978 | } | |
| 1985 | 1979 | ||
| @@ -680,8 +680,7 @@ func (a *App) activateBrowserWindow(bw *browserWindow) { | |||||
| 680 | if a.tabs != nil && activeID != "" { | 680 | if a.tabs != nil && activeID != "" { | ||
| 681 | if a.tabs.Find(activeID) == nil { | 681 | if a.tabs.Find(activeID) == nil { | ||
| 682 | if tab := perWinTabs.Find(activeID); tab != nil { | 682 | if tab := perWinTabs.Find(activeID); tab != nil { | ||
| 683 | - | tabSnapshot := *tab | 683 | + | a.tabs.Add(cloneTabForGlobalList(tab)) |
| 684 | - | a.tabs.Add(&tabSnapshot) | |||
| 685 | } | 684 | } | ||
| 686 | } | 685 | } | ||
| 687 | if a.tabs.Find(activeID) != nil { | 686 | if a.tabs.Find(activeID) != nil { | ||
| @@ -1900,12 +1899,7 @@ func (a *App) initUpdateCoordinator(ctx context.Context) { | |||||
| 1900 | log.Debug().Msg("update coordinator initialized") | 1899 | log.Debug().Msg("update coordinator initialized") | ||
| 1901 | } | 1900 | } | ||
| 1902 | 1901 | ||||
| 1903 | - | // GetTabList implements port.TabListProvider. | 1902 | + | // GetSessionID implements port.WindowStateProvider. |
| 1904 | - | func (a *App) GetTabList() *entity.TabList { | |||
| 1905 | - | return a.tabs | |||
| 1906 | - | } | |||
| 1907 | - | ||||
| 1908 | - | // GetSessionID implements port.TabListProvider and port.WindowStateProvider. | |||
| 1909 | func (a *App) GetSessionID() entity.SessionID { | 1903 | func (a *App) GetSessionID() entity.SessionID { | ||
| 1910 | if a.deps == nil { | 1904 | if a.deps == nil { | ||
| 1911 | return "" | 1905 | return "" | ||
| @@ -1979,7 +1973,7 @@ func (a *App) GetWindowSnapshotState() ([]entity.WindowTabListState, int) { | |||||
| 1979 | tabs = entity.NewTabList() | 1973 | tabs = entity.NewTabList() | ||
| 1980 | for _, tab := range globalTabs.Tabs { | 1974 | for _, tab := range globalTabs.Tabs { | ||
| 1981 | if tabOwners[tab.ID] == wid { | 1975 | if tabOwners[tab.ID] == wid { | ||
| 1982 | - | tabs.Add(tab) | 1976 | + | tabs.Add(cloneTabForGlobalList(tab)) |
| 1983 | } | 1977 | } | ||
| 1984 | } | 1978 | } | ||
| 1985 | 1979 | ||||