refactor(engine): remove dead Internal* bridge methods and clean port.Engine interface
- commit
- 9cd77133f63b956d1a819ec5ba5900102ada1760
- author
- brice · · 2026-03-18 05:43 UTC
- parent
- 54ea5e7
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +5 -60
M cmd/dumber/main.go +2 -1
| @@ -28,6 +28,7 @@ import ( | |||
| 28 | 28 | "github.com/bnema/dumber/internal/infrastructure/snapshot" | |
| 29 | 29 | "github.com/bnema/dumber/internal/infrastructure/textinput" | |
| 30 | 30 | "github.com/bnema/dumber/internal/infrastructure/updater" | |
| 31 | + | "github.com/bnema/dumber/internal/infrastructure/webkit" | |
| 31 | 32 | "github.com/bnema/dumber/internal/infrastructure/xdg" | |
| 32 | 33 | "github.com/bnema/dumber/internal/logging" | |
| 33 | 34 | "github.com/bnema/dumber/internal/ui" | |
| @@ -514,7 +515,7 @@ func buildUIDependencies( | |||
| 514 | 515 | currentSessionID entity.SessionID, | |
| 515 | 516 | startupCrashReports []string, | |
| 516 | 517 | ) *ui.Dependencies { | |
| 517 | - | filterManager := engine.InternalFilterManager() | |
| 518 | + | filterManager := engine.(*webkit.Engine).InternalFilterManager() | |
| 518 | 519 | ||
| 519 | 520 | focusProvider := textinput.NewFocusProvider() | |
| 520 | 521 | ||
| @@ -28,6 +28,7 @@ import ( | |||||
| 28 | "github.com/bnema/dumber/internal/infrastructure/snapshot" | 28 | "github.com/bnema/dumber/internal/infrastructure/snapshot" | ||
| 29 | "github.com/bnema/dumber/internal/infrastructure/textinput" | 29 | "github.com/bnema/dumber/internal/infrastructure/textinput" | ||
| 30 | "github.com/bnema/dumber/internal/infrastructure/updater" | 30 | "github.com/bnema/dumber/internal/infrastructure/updater" | ||
| 31 | + | "github.com/bnema/dumber/internal/infrastructure/webkit" | |||
| 31 | "github.com/bnema/dumber/internal/infrastructure/xdg" | 32 | "github.com/bnema/dumber/internal/infrastructure/xdg" | ||
| 32 | "github.com/bnema/dumber/internal/logging" | 33 | "github.com/bnema/dumber/internal/logging" | ||
| 33 | "github.com/bnema/dumber/internal/ui" | 34 | "github.com/bnema/dumber/internal/ui" | ||
| @@ -514,7 +515,7 @@ func buildUIDependencies( | |||||
| 514 | currentSessionID entity.SessionID, | 515 | currentSessionID entity.SessionID, | ||
| 515 | startupCrashReports []string, | 516 | startupCrashReports []string, | ||
| 516 | ) *ui.Dependencies { | 517 | ) *ui.Dependencies { | ||
| 517 | - | filterManager := engine.InternalFilterManager() | 518 | + | filterManager := engine.(*webkit.Engine).InternalFilterManager() |
| 518 | 519 | ||||
| 519 | focusProvider := textinput.NewFocusProvider() | 520 | focusProvider := textinput.NewFocusProvider() | ||
| 520 | 521 | ||||
M internal/application/port/engine.go +0 -4
| @@ -143,10 +143,6 @@ type Engine interface { | |||
| 143 | 143 | ||
| 144 | 144 | // SetHandlerContext sets the base context for message handler dispatch. | |
| 145 | 145 | SetHandlerContext(ctx context.Context) | |
| 146 | - | ||
| 147 | - | // InternalFilterManager returns the FilterManager for content filter lifecycle. | |
| 148 | - | // Returns nil if content filtering is not supported. | |
| 149 | - | InternalFilterManager() FilterManager | |
| 150 | 146 | } | |
| 151 | 147 | ||
| 152 | 148 | // EngineSettingsUpdate carries a runtime config change to the engine. | |
| @@ -143,10 +143,6 @@ type Engine interface { | |||||
| 143 | 143 | ||||
| 144 | // SetHandlerContext sets the base context for message handler dispatch. | 144 | // SetHandlerContext sets the base context for message handler dispatch. | ||
| 145 | SetHandlerContext(ctx context.Context) | 145 | SetHandlerContext(ctx context.Context) | ||
| 146 | - | ||||
| 147 | - | // InternalFilterManager returns the FilterManager for content filter lifecycle. | |||
| 148 | - | // Returns nil if content filtering is not supported. | |||
| 149 | - | InternalFilterManager() FilterManager | |||
| 150 | } | 146 | } | ||
| 151 | 147 | ||||
| 152 | // EngineSettingsUpdate carries a runtime config change to the engine. | 148 | // EngineSettingsUpdate carries a runtime config change to the engine. | ||
M internal/application/port/mocks/mocks.go +0 -46
| @@ -2922,52 +2922,6 @@ func (_c *MockEngine_FilterApplier_Call) RunAndReturn(run func() port.FilterAppl | |||
| 2922 | 2922 | return _c | |
| 2923 | 2923 | } | |
| 2924 | 2924 | ||
| 2925 | - | // InternalFilterManager provides a mock function for the type MockEngine | |
| 2926 | - | func (_mock *MockEngine) InternalFilterManager() port.FilterManager { | |
| 2927 | - | ret := _mock.Called() | |
| 2928 | - | ||
| 2929 | - | if len(ret) == 0 { | |
| 2930 | - | panic("no return value specified for InternalFilterManager") | |
| 2931 | - | } | |
| 2932 | - | ||
| 2933 | - | var r0 port.FilterManager | |
| 2934 | - | if returnFunc, ok := ret.Get(0).(func() port.FilterManager); ok { | |
| 2935 | - | r0 = returnFunc() | |
| 2936 | - | } else { | |
| 2937 | - | if ret.Get(0) != nil { | |
| 2938 | - | r0 = ret.Get(0).(port.FilterManager) | |
| 2939 | - | } | |
| 2940 | - | } | |
| 2941 | - | return r0 | |
| 2942 | - | } | |
| 2943 | - | ||
| 2944 | - | // MockEngine_InternalFilterManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InternalFilterManager' | |
| 2945 | - | type MockEngine_InternalFilterManager_Call struct { | |
| 2946 | - | *mock.Call | |
| 2947 | - | } | |
| 2948 | - | ||
| 2949 | - | // InternalFilterManager is a helper method to define mock.On call | |
| 2950 | - | func (_e *MockEngine_Expecter) InternalFilterManager() *MockEngine_InternalFilterManager_Call { | |
| 2951 | - | return &MockEngine_InternalFilterManager_Call{Call: _e.mock.On("InternalFilterManager")} | |
| 2952 | - | } | |
| 2953 | - | ||
| 2954 | - | func (_c *MockEngine_InternalFilterManager_Call) Run(run func()) *MockEngine_InternalFilterManager_Call { | |
| 2955 | - | _c.Call.Run(func(args mock.Arguments) { | |
| 2956 | - | run() | |
| 2957 | - | }) | |
| 2958 | - | return _c | |
| 2959 | - | } | |
| 2960 | - | ||
| 2961 | - | func (_c *MockEngine_InternalFilterManager_Call) Return(filterManager port.FilterManager) *MockEngine_InternalFilterManager_Call { | |
| 2962 | - | _c.Call.Return(filterManager) | |
| 2963 | - | return _c | |
| 2964 | - | } | |
| 2965 | - | ||
| 2966 | - | func (_c *MockEngine_InternalFilterManager_Call) RunAndReturn(run func() port.FilterManager) *MockEngine_InternalFilterManager_Call { | |
| 2967 | - | _c.Call.Return(run) | |
| 2968 | - | return _c | |
| 2969 | - | } | |
| 2970 | - | ||
| 2971 | 2925 | // InternalSchemePath provides a mock function for the type MockEngine | |
| 2972 | 2926 | func (_mock *MockEngine) InternalSchemePath() string { | |
| 2973 | 2927 | ret := _mock.Called() | |
| @@ -2922,52 +2922,6 @@ func (_c *MockEngine_FilterApplier_Call) RunAndReturn(run func() port.FilterAppl | |||||
| 2922 | return _c | 2922 | return _c | ||
| 2923 | } | 2923 | } | ||
| 2924 | 2924 | ||||
| 2925 | - | // InternalFilterManager provides a mock function for the type MockEngine | |||
| 2926 | - | func (_mock *MockEngine) InternalFilterManager() port.FilterManager { | |||
| 2927 | - | ret := _mock.Called() | |||
| 2928 | - | ||||
| 2929 | - | if len(ret) == 0 { | |||
| 2930 | - | panic("no return value specified for InternalFilterManager") | |||
| 2931 | - | } | |||
| 2932 | - | ||||
| 2933 | - | var r0 port.FilterManager | |||
| 2934 | - | if returnFunc, ok := ret.Get(0).(func() port.FilterManager); ok { | |||
| 2935 | - | r0 = returnFunc() | |||
| 2936 | - | } else { | |||
| 2937 | - | if ret.Get(0) != nil { | |||
| 2938 | - | r0 = ret.Get(0).(port.FilterManager) | |||
| 2939 | - | } | |||
| 2940 | - | } | |||
| 2941 | - | return r0 | |||
| 2942 | - | } | |||
| 2943 | - | ||||
| 2944 | - | // MockEngine_InternalFilterManager_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InternalFilterManager' | |||
| 2945 | - | type MockEngine_InternalFilterManager_Call struct { | |||
| 2946 | - | *mock.Call | |||
| 2947 | - | } | |||
| 2948 | - | ||||
| 2949 | - | // InternalFilterManager is a helper method to define mock.On call | |||
| 2950 | - | func (_e *MockEngine_Expecter) InternalFilterManager() *MockEngine_InternalFilterManager_Call { | |||
| 2951 | - | return &MockEngine_InternalFilterManager_Call{Call: _e.mock.On("InternalFilterManager")} | |||
| 2952 | - | } | |||
| 2953 | - | ||||
| 2954 | - | func (_c *MockEngine_InternalFilterManager_Call) Run(run func()) *MockEngine_InternalFilterManager_Call { | |||
| 2955 | - | _c.Call.Run(func(args mock.Arguments) { | |||
| 2956 | - | run() | |||
| 2957 | - | }) | |||
| 2958 | - | return _c | |||
| 2959 | - | } | |||
| 2960 | - | ||||
| 2961 | - | func (_c *MockEngine_InternalFilterManager_Call) Return(filterManager port.FilterManager) *MockEngine_InternalFilterManager_Call { | |||
| 2962 | - | _c.Call.Return(filterManager) | |||
| 2963 | - | return _c | |||
| 2964 | - | } | |||
| 2965 | - | ||||
| 2966 | - | func (_c *MockEngine_InternalFilterManager_Call) RunAndReturn(run func() port.FilterManager) *MockEngine_InternalFilterManager_Call { | |||
| 2967 | - | _c.Call.Return(run) | |||
| 2968 | - | return _c | |||
| 2969 | - | } | |||
| 2970 | - | ||||
| 2971 | // InternalSchemePath provides a mock function for the type MockEngine | 2925 | // InternalSchemePath provides a mock function for the type MockEngine | ||
| 2972 | func (_mock *MockEngine) InternalSchemePath() string { | 2926 | func (_mock *MockEngine) InternalSchemePath() string { | ||
| 2973 | ret := _mock.Called() | 2927 | ret := _mock.Called() | ||
M internal/infrastructure/webkit/engine.go +3 -9
| @@ -88,15 +88,9 @@ func (e *Engine) FaviconDatabase() port.FaviconDatabase { | |||
| 88 | 88 | return &faviconDatabaseAdapter{wkCtx: e.wkCtx} | |
| 89 | 89 | } | |
| 90 | 90 | ||
| 91 | - | // --- Temporary accessors for migration (M3->M4 bridge) --- | |
| 92 | - | // These will be removed when ui.Dependencies is updated to use port.Engine. | |
| 93 | - | ||
| 94 | - | func (e *Engine) InternalContext() *WebKitContext { return e.wkCtx } | |
| 95 | - | func (e *Engine) InternalSettings() *SettingsManager { return e.settings } | |
| 96 | - | func (e *Engine) InternalInjector() *ContentInjector { return e.injector } | |
| 97 | - | func (e *Engine) InternalMessageRouter() *MessageRouter { return e.messageRouter } | |
| 98 | - | func (e *Engine) InternalPool() *WebViewPool { return e.pool } | |
| 99 | - | func (e *Engine) InternalFactory() *WebViewFactory { return e.factory } | |
| 91 | + | // InternalFilterManager returns the FilterManager for content filter lifecycle. | |
| 92 | + | // This is on the concrete *Engine type (not the port.Engine interface) because | |
| 93 | + | // FilterManager is a webkit-specific concern used only during dependency wiring. | |
| 100 | 94 | func (e *Engine) InternalFilterManager() port.FilterManager { return e.filterManager } | |
| 101 | 95 | ||
| 102 | 96 | // SetHandlerContext sets the base context for message handler dispatch. | |
| @@ -88,15 +88,9 @@ func (e *Engine) FaviconDatabase() port.FaviconDatabase { | |||||
| 88 | return &faviconDatabaseAdapter{wkCtx: e.wkCtx} | 88 | return &faviconDatabaseAdapter{wkCtx: e.wkCtx} | ||
| 89 | } | 89 | } | ||
| 90 | 90 | ||||
| 91 | - | // --- Temporary accessors for migration (M3->M4 bridge) --- | 91 | + | // InternalFilterManager returns the FilterManager for content filter lifecycle. |
| 92 | - | // These will be removed when ui.Dependencies is updated to use port.Engine. | 92 | + | // This is on the concrete *Engine type (not the port.Engine interface) because |
| 93 | - | 93 | + | // FilterManager is a webkit-specific concern used only during dependency wiring. | |
| 94 | - | func (e *Engine) InternalContext() *WebKitContext { return e.wkCtx } | |||
| 95 | - | func (e *Engine) InternalSettings() *SettingsManager { return e.settings } | |||
| 96 | - | func (e *Engine) InternalInjector() *ContentInjector { return e.injector } | |||
| 97 | - | func (e *Engine) InternalMessageRouter() *MessageRouter { return e.messageRouter } | |||
| 98 | - | func (e *Engine) InternalPool() *WebViewPool { return e.pool } | |||
| 99 | - | func (e *Engine) InternalFactory() *WebViewFactory { return e.factory } | |||
| 100 | func (e *Engine) InternalFilterManager() port.FilterManager { return e.filterManager } | 94 | func (e *Engine) InternalFilterManager() port.FilterManager { return e.filterManager } | ||
| 101 | 95 | ||||
| 102 | // SetHandlerContext sets the base context for message handler dispatch. | 96 | // SetHandlerContext sets the base context for message handler dispatch. | ||