Validate application configuration after file parsing and CLI overrides
Problem
Configuration validation is partial and runs at the wrong point for CLI overrides.
AppConfig::new currently validates only the library layout percentages. Later, main applies --config-override values without running that validation again. An override can therefore bypass the existing invariant.
Other bounded values are accepted without a central validation pass, including device volume, bitrate, refresh intervals, playback window dimensions, and mouse volume step. Keymaps and actions can also collide across their separate collections and become silently unreachable.
Expected behavior
The final effective configuration should be validated once after all configuration sources and overrides have been applied.
Suggested approach
Introduce a single AppConfig::validate or Configs::validate entry point. Call it after file parsing and after all CLI overrides. Return field-specific errors.
Acceptance criteria
- Invalid layout percentages are rejected when supplied through
--config-override. - Device volume is restricted to 0 through 100.
- Bitrate and other enumerated numeric options accept only supported values.
- Refresh and layout values cannot create a busy loop or unusable layout.
- Command and action key collisions are rejected or reported clearly.
- Table-driven tests cover file and override inputs.
Source: aome510/spotify-player