systeminit / si

The System Initiative software
https://systeminit.com
Apache License 2.0
1.58k stars 261 forks source link

Ensure values are updated correctly when changing a component's type. #4629

Closed britmyerss closed 1 month ago

britmyerss commented 1 month ago

This PR adds an ability to update_type_by_id which, when called, and the component type is changing to or from an up or down frame, ensures we update any relevant attribute values that have different inputs given the new type.

I also fixed up some of the tests that are manually setting the type on creation to use a helper, and added comments to differentiate when we should update_type_by_id vs. set_type_by_id which does not update necessary values, nor does it ensure that the new component type won't cause other problems.