The settings for calculating a new proposal are generated from the config file for the initial proposal and from D-Bus for new proposals. In both cases, the provided data is not validated at all. That means that a wrong type could be given for a setting, or even unknwon settings could be passed.
All those issues should be validated and somehow reported. Maybe logging issues and using proper defaults is ok.
Some notes:
Sometimes we need quite similar validations when the settings are generated from the config file and from D-Bus.
The class Agama::Storage::ProposalSettingsReader reads the settings from config file.
The class Agama::DBus::Storage::ProposalSettingsConversion::FromDBus reads the settings from D-Bus data.
Crazy idea: perhaps, we could have an intermediate representation of the settings (e.g., Agama::Storage::RawProposalSettings). The settings from config file and from D-Bus would be converted to raw settings without any kind of validation. Then, the raw settings would be conveted to the real proposal settings, performing all validations and using proper default values. In that way, we don't need to check things twice.
The settings for calculating a new proposal are generated from the config file for the initial proposal and from D-Bus for new proposals. In both cases, the provided data is not validated at all. That means that a wrong type could be given for a setting, or even unknwon settings could be passed.
All those issues should be validated and somehow reported. Maybe logging issues and using proper defaults is ok.
Some notes:
Agama::Storage::ProposalSettingsReader
reads the settings from config file.Agama::DBus::Storage::ProposalSettingsConversion::FromDBus
reads the settings from D-Bus data.Crazy idea: perhaps, we could have an intermediate representation of the settings (e.g.,
Agama::Storage::RawProposalSettings
). The settings from config file and from D-Bus would be converted to raw settings without any kind of validation. Then, the raw settings would be conveted to the real proposal settings, performing all validations and using proper default values. In that way, we don't need to check things twice.