refactor(api): Delete dead PipetteStore code and type nozzle maps as non-Optional#16481
refactor(api): Delete dead PipetteStore code and type nozzle maps as non-Optional#16481SyntaxColoring merged 10 commits intoedgefrom
Conversation
This reverts commit cb1f6396bdd851d4e61fbaadf93fef12a78e9cb0.
| static_config = self._state.static_config_by_id.get(pipette_id) | ||
| if static_config: | ||
| self._state.nozzle_configuration_by_id[ | ||
| pipette_id | ||
| ] = static_config.default_nozzle_map |
There was a problem hiding this comment.
Because of the if static_config: line, this chunk of code in _set_load_pipette() depended on running after _update_pipette_config(). We do not obey that order, so it looked at first like this was broken.
However, it turns out _update_pipette_config() also sets this attribute, and _update_pipette_config() is always called in practice whenever _set_load_pipette() is called. So it's moot.
For clarity, therefore, delete this code. Each attribute of self._state is now affected either by _set_load_pipette() or _update_pipette_config(), never both.
Relying on _update_pipette_config() always being called in practice whenever _set_load_pipette() is called feels a little icky to me. I think we can upgrade that from being "in practice" to being "as guaranteed by the types" by rearranging StateUpdate a little bit, but I'm not doing that here.
sfoster1
left a comment
There was a problem hiding this comment.
Definitely the way to go, thank you!
Overview
Minor refactors to
PipetteStoreto follow up on #16469 (comment) and close EXEC-768.Test Plan and Hands on Testing
KeyErroror anything.Changelog
PipetteStatewas typed to allow a nozzle map ofNone. Since #14529, this never occurs in practice—a properly-loaded pipette always has a nozzle map. So, remove theNonepossibility and simplify the consumers accordingly.PipetteStoretests to more closely reflect howLoadPipetteImplementationuses it.Review requests
Does my comment below seem right?
Risk assessment
Low if I do the manual testing described above.