refactor(api): Allow cache_tip() to overwrite the current tip #16587
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
The hardware API has two similar methods,
add_tip()
andcache_tip()
. One of their differences is that if there's already a tip,add_tip()
no-ops, whereascache_tip()
raises anAssertionError
.Neither behavior is really appropriate for error recovery. We mostly want Protocol Engine's state to be the single source of truth, and we want to synchronize the hardware API's state to it (if the hardware API must have its own state at all). It's difficult to do that reliably if the hardware API's state-setting methods are context-sensitive like this.
So this changes
cache_tip()
to idempotently overwrite the hardware API's current tip instead of raising anAssertionError
.Goes towards EXEC-778.
Test Plan and Hands on Testing
edge
tipPhysicallyMissing
error and make sure the "retry failed step" error recovery flow still works.Changelog
1f9bbff: Move
cache_tip()
next toadd_tip()
. As long as we have to maintain them both in parallel, this makes that easier. No behavioral change. This highlights some additional subtle differences between the two methods (likeset_current_volume()
), which I'm not addressing in this PR.0cb1605: The actual behavioral change described in the overview.
1bfc529: Get Protocol Engine to uniformly use
cache_tip()
instead ofadd_tip()
.This is theoretically a behavioral change, but it should be safe, given the two call sites.
HardwareStopper
was basically setting the tip to...the current tip, so it's just another flavor of no-op.pick_up_tip()
should only ever get to this point after it's validated that there is no tip on the pipette, so the behavioral difference doesn't come into play.Review requests
Does this seem like a not-wrong hardware API direction?
Risk assessment
Low.