Problem description
tools/migrate_config_v2_to_v3.py::_validate structures the migrated dictionary with cattrs.structure(nested_v3, Config) and checks nothing else. cattrs discards a key the schema does not define, so a migrated file carrying an orphan key structures cleanly and the tool reports the migration as a success. Every run made from that file afterwards sits on the schema default for that parameter, with nothing said at any point.
A key the migration itself failed to translate is precisely the case this would catch, which makes the migration tool a poor place for the check to be absent.
#799 put find_key_problems in front of structuring wherever a configuration is loaded. The migration tool was outside that change, so it is now the one path that writes a config without accounting for its keys.
Expected behavior
_validate runs the orphan-key walk before structuring and refuses to write a file whose keys it cannot account for, naming them the way read_config_object does.
Evidence
tools/migrate_config_v2_to_v3.py, the body of _validate, in full:
cattrs.structure(nested_v3, Config)
That is the entire validation.
My computer
macOS on arm64, Python 3.12.
Additional notes
proteus.config.read_config_object already composes reading, key-checking and structuring, but it takes a path and the tool holds a nested dict, so the fix is probably find_key_problems followed by the existing cattrs.structure call rather than a switch to the composed entry point.
Relevant people
Nobody outside this repo; this one is mine.
Problem description
tools/migrate_config_v2_to_v3.py::_validatestructures the migrated dictionary withcattrs.structure(nested_v3, Config)and checks nothing else.cattrsdiscards a key the schema does not define, so a migrated file carrying an orphan key structures cleanly and the tool reports the migration as a success. Every run made from that file afterwards sits on the schema default for that parameter, with nothing said at any point.A key the migration itself failed to translate is precisely the case this would catch, which makes the migration tool a poor place for the check to be absent.
#799 put
find_key_problemsin front of structuring wherever a configuration is loaded. The migration tool was outside that change, so it is now the one path that writes a config without accounting for its keys.Expected behavior
_validateruns the orphan-key walk before structuring and refuses to write a file whose keys it cannot account for, naming them the wayread_config_objectdoes.Evidence
tools/migrate_config_v2_to_v3.py, the body of_validate, in full:That is the entire validation.
My computer
macOS on arm64, Python 3.12.
Additional notes
proteus.config.read_config_objectalready composes reading, key-checking and structuring, but it takes a path and the tool holds a nested dict, so the fix is probablyfind_key_problemsfollowed by the existingcattrs.structurecall rather than a switch to the composed entry point.Relevant people
Nobody outside this repo; this one is mine.