detached 3432396

fix: zero out old section defaults so migrate apply doesn't write them back

DefaultConfig() still populated Rendering, Performance, Privacy, Runtime
struct fields with non-zero defaults. When `dumber config migrate` applied
changes, the full Config struct was marshaled back to TOML, re-introducing
old sections that had just been migrated away.

Zero out old section structs in DefaultConfig() and remove their viper
default setters. Media's migrated GStreamer fields are also zeroed.
Old struct types are kept for backward-compat during unmarshal/migration.
commit
3432396c986a8446039d4acd446fc31fa4fd64f5
author
brice · · 2026-03-15 20:27 UTC
parent
c1c32b5
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +19 -47
M internal/infrastructure/config/defaults.go +7 -43
@@ -156,23 +156,10 @@ func DefaultConfig() *Config {
156156 GLRenderingMode: GLRenderingModeAuto,
157157 },
158158 },
159- Rendering: RenderingConfig{
160- Mode: RenderingModeGPU,
161- DisableDMABufRenderer: false,
162- ForceCompositingMode: false,
163- DisableCompositingMode: false,
164- GSKRenderer: GSKRendererAuto, // Let GTK choose - Vulkan can conflict with WebKit's DMA-BUF
165- DisableMipmaps: false,
166- PreferGL: false,
167- DrawCompositingIndicators: false,
168- ShowFPS: false,
169- SampleMemory: false,
170- DebugFrames: false,
171- },
172- Privacy: PrivacyConfig{
173- CookiePolicy: CookiePolicyNoThirdParty,
174- ITPEnabled: true,
175- },
159+ // Rendering, Privacy, Runtime, Performance: zeroed out.
160+ // These sections have been migrated to [engine]/[engine.webkit].
161+ // Keeping zero-value structs so the Config type remains backward-compatible
162+ // for unmarshalling old config files during migration.
176163 DefaultWebpageZoom: 1.2, // 120% default zoom for better readability
177164 DefaultUIScale: defaultUIScale, // 1.0 = 100%, 2.0 = 200%
178165 Workspace: WorkspaceConfig{
@@ -307,32 +294,9 @@ func DefaultConfig() *Config {
307294 HardwareDecodingMode: HardwareDecodingAuto, // auto allows sw fallback
308295 PreferAV1: false, // Don't force codec preference, let site choose
309296 ShowDiagnosticsOnStartup: false, // Disabled - diagnostics can be noisy
310- ForceVSync: false, // Let compositor handle VSync
311- GLRenderingMode: GLRenderingModeAuto, // GStreamer picks best GL API
312- GStreamerDebugLevel: 0, // Disabled by default
313- },
314- Runtime: RuntimeConfig{
315- Prefix: "",
316- },
317- Performance: PerformanceConfig{
318- Profile: ProfileDefault, // Use WebKit defaults by default
319- ZoomCacheSize: defaultZoomCacheSize,
320- WebViewPoolPrewarmCount: defaultWebViewPoolPrewarmCount,
321- // Skia threading - balanced defaults (unset = use WebKit defaults)
322- // These only apply when Profile is "custom"
323- SkiaCPUPaintingThreads: defaultSkiaCPUPaintingThreads,
324- SkiaGPUPaintingThreads: defaultSkiaGPUPaintingThreads,
325- SkiaEnableCPURendering: false,
326- // Web process memory pressure - all unset by default
327- WebProcessMemoryLimitMB: 0,
328- WebProcessMemoryPollIntervalSec: 0,
329- WebProcessMemoryConservativeThreshold: 0,
330- WebProcessMemoryStrictThreshold: 0,
331- // Network process memory pressure - all unset by default
332- NetworkProcessMemoryLimitMB: 0,
333- NetworkProcessMemoryPollIntervalSec: 0,
334- NetworkProcessMemoryConservativeThreshold: 0,
335- NetworkProcessMemoryStrictThreshold: 0,
297+ // GStreamer fields (ForceVSync, GLRenderingMode, GStreamerDebugLevel)
298+ // moved to [engine.webkit] — zero values here prevent them from being
299+ // written back when marshaling the Config struct.
336300 },
337301 Update: UpdateConfig{
338302 EnableOnStartup: true, // Check for updates on startup by default
@@ -156,23 +156,10 @@ func DefaultConfig() *Config {
156 GLRenderingMode: GLRenderingModeAuto,156 GLRenderingMode: GLRenderingModeAuto,
157 },157 },
158 },158 },
159- Rendering: RenderingConfig{159+ // Rendering, Privacy, Runtime, Performance: zeroed out.
160- Mode: RenderingModeGPU,160+ // These sections have been migrated to [engine]/[engine.webkit].
161- DisableDMABufRenderer: false,161+ // Keeping zero-value structs so the Config type remains backward-compatible
162- ForceCompositingMode: false,162+ // for unmarshalling old config files during migration.
163- DisableCompositingMode: false,
164- GSKRenderer: GSKRendererAuto, // Let GTK choose - Vulkan can conflict with WebKit's DMA-BUF
165- DisableMipmaps: false,
166- PreferGL: false,
167- DrawCompositingIndicators: false,
168- ShowFPS: false,
169- SampleMemory: false,
170- DebugFrames: false,
171- },
172- Privacy: PrivacyConfig{
173- CookiePolicy: CookiePolicyNoThirdParty,
174- ITPEnabled: true,
175- },
176 DefaultWebpageZoom: 1.2, // 120% default zoom for better readability163 DefaultWebpageZoom: 1.2, // 120% default zoom for better readability
177 DefaultUIScale: defaultUIScale, // 1.0 = 100%, 2.0 = 200%164 DefaultUIScale: defaultUIScale, // 1.0 = 100%, 2.0 = 200%
178 Workspace: WorkspaceConfig{165 Workspace: WorkspaceConfig{
@@ -307,32 +294,9 @@ func DefaultConfig() *Config {
307 HardwareDecodingMode: HardwareDecodingAuto, // auto allows sw fallback294 HardwareDecodingMode: HardwareDecodingAuto, // auto allows sw fallback
308 PreferAV1: false, // Don't force codec preference, let site choose295 PreferAV1: false, // Don't force codec preference, let site choose
309 ShowDiagnosticsOnStartup: false, // Disabled - diagnostics can be noisy296 ShowDiagnosticsOnStartup: false, // Disabled - diagnostics can be noisy
310- ForceVSync: false, // Let compositor handle VSync297+ // GStreamer fields (ForceVSync, GLRenderingMode, GStreamerDebugLevel)
311- GLRenderingMode: GLRenderingModeAuto, // GStreamer picks best GL API298+ // moved to [engine.webkit] — zero values here prevent them from being
312- GStreamerDebugLevel: 0, // Disabled by default299+ // written back when marshaling the Config struct.
313- },
314- Runtime: RuntimeConfig{
315- Prefix: "",
316- },
317- Performance: PerformanceConfig{
318- Profile: ProfileDefault, // Use WebKit defaults by default
319- ZoomCacheSize: defaultZoomCacheSize,
320- WebViewPoolPrewarmCount: defaultWebViewPoolPrewarmCount,
321- // Skia threading - balanced defaults (unset = use WebKit defaults)
322- // These only apply when Profile is "custom"
323- SkiaCPUPaintingThreads: defaultSkiaCPUPaintingThreads,
324- SkiaGPUPaintingThreads: defaultSkiaGPUPaintingThreads,
325- SkiaEnableCPURendering: false,
326- // Web process memory pressure - all unset by default
327- WebProcessMemoryLimitMB: 0,
328- WebProcessMemoryPollIntervalSec: 0,
329- WebProcessMemoryConservativeThreshold: 0,
330- WebProcessMemoryStrictThreshold: 0,
331- // Network process memory pressure - all unset by default
332- NetworkProcessMemoryLimitMB: 0,
333- NetworkProcessMemoryPollIntervalSec: 0,
334- NetworkProcessMemoryConservativeThreshold: 0,
335- NetworkProcessMemoryStrictThreshold: 0,
336 },300 },
337 Update: UpdateConfig{301 Update: UpdateConfig{
338 EnableOnStartup: true, // Check for updates on startup by default302 EnableOnStartup: true, // Check for updates on startup by default
M internal/infrastructure/config/defaults_test.go +12 -4
@@ -6,12 +6,20 @@ import (
66 "github.com/stretchr/testify/assert"
77 )
88
9-func TestDefaultConfig_RuntimeLoggingProfile(t *testing.T) {
9+func TestDefaultConfig_CoreDefaults(t *testing.T) {
1010 cfg := DefaultConfig()
1111 assert.Equal(t, "info", cfg.Logging.Level)
1212 assert.False(t, cfg.Logging.CaptureGTKLogs)
13- assert.Equal(t, ProfileDefault, cfg.Performance.Profile)
14- assert.Equal(t, CookiePolicyNoThirdParty, cfg.Privacy.CookiePolicy)
15- assert.True(t, cfg.Privacy.ITPEnabled)
1613 assert.False(t, cfg.Media.ShowDiagnosticsOnStartup)
14+
15+ // Engine defaults (replaces old Performance/Privacy sections)
16+ assert.Equal(t, "webkit", cfg.Engine.Type)
17+ assert.Equal(t, ProfileDefault, cfg.Engine.Profile)
18+ assert.Equal(t, CookiePolicyNoThirdParty, cfg.Engine.CookiePolicy)
19+ assert.True(t, cfg.Engine.WebKit.ITPEnabled)
20+
21+ // Old sections should be zero-valued
22+ assert.Empty(t, string(cfg.Performance.Profile))
23+ assert.Empty(t, string(cfg.Privacy.CookiePolicy))
24+ assert.Empty(t, string(cfg.Rendering.Mode))
1725 }
@@ -6,12 +6,20 @@ import (
6 "github.com/stretchr/testify/assert"6 "github.com/stretchr/testify/assert"
7 )7 )
8 8
9-func TestDefaultConfig_RuntimeLoggingProfile(t *testing.T) {9+func TestDefaultConfig_CoreDefaults(t *testing.T) {
10 cfg := DefaultConfig()10 cfg := DefaultConfig()
11 assert.Equal(t, "info", cfg.Logging.Level)11 assert.Equal(t, "info", cfg.Logging.Level)
12 assert.False(t, cfg.Logging.CaptureGTKLogs)12 assert.False(t, cfg.Logging.CaptureGTKLogs)
13- assert.Equal(t, ProfileDefault, cfg.Performance.Profile)
14- assert.Equal(t, CookiePolicyNoThirdParty, cfg.Privacy.CookiePolicy)
15- assert.True(t, cfg.Privacy.ITPEnabled)
16 assert.False(t, cfg.Media.ShowDiagnosticsOnStartup)13 assert.False(t, cfg.Media.ShowDiagnosticsOnStartup)
14+
15+ // Engine defaults (replaces old Performance/Privacy sections)
16+ assert.Equal(t, "webkit", cfg.Engine.Type)
17+ assert.Equal(t, ProfileDefault, cfg.Engine.Profile)
18+ assert.Equal(t, CookiePolicyNoThirdParty, cfg.Engine.CookiePolicy)
19+ assert.True(t, cfg.Engine.WebKit.ITPEnabled)
20+
21+ // Old sections should be zero-valued
22+ assert.Empty(t, string(cfg.Performance.Profile))
23+ assert.Empty(t, string(cfg.Privacy.CookiePolicy))
24+ assert.Empty(t, string(cfg.Rendering.Mode))
17 }25 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close