fix(api): prevent moving a labware onto itself #16600
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Fixes PLAT-572.
This PR fixes a bug found where you were able to move a labware that could be stacked upon the same labware type (for example, the thermocycler lid) onto the same instance of the labware, ie.e stacking it on itself. Not only does this make no logical or physical sense, it would cause a
RecursionError
the next time any gantry movement happened, since during the course of finding the highest Z we would recursively find the height of any stacked labware. If a labware's parent happens to be itself (which should never happen), it will keep recursively trying to find a deck slot or module until the max recursion error occurs.Now, when moving to an
OnLabwareLocation
, we check to make sure that the labware ID of the labware being moved does not match the labware ID of the new location. If it does, we will raise an error informing that the labware is trying to be moved on itself.For more information on this recursive error, see PR #16600.
Test Plan and Hands on Testing
The following protocol now fails with a
LabwareMovementNotAllowedError
on themove_labware
line, not with aRecursionError
on thepick_up_tip
line.Changelog
Risk assessment
Low.