fix(app): Tolerate old tip length calibration records without a uri
field
#14622
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
This fixes RESC-215.
Apparently, old tip length calibration records don't have a
uri
field. (It looks likeuri
was introduced in #7136, v4.1.0.) We used to safely drop these records via thisexcept ValidationError
block. But PR #14512 started accessing theuri
field manually, accidentally bringing it outside the coverage of theexcept
block and turning it into an HTTP 500 error.Test Plan
To reproduce this manually, you can download the
data/
directory from RESC-215 and run this in theapi
project directory:OT_API_TIP_LENGTH_CALIBRATION_DIR=/path/to/downloaded/data/tip_lengths \ pipenv run python -c \ 'from opentrons import calibration_storage; print(calibration_storage.get_all_tip_length_calibrations())'
On v7.1.1, it will work. On v7.2.0, it will raise an error. On this branch, it will work again.
I've also added a unit test.
Changelog
uri
is missing from an old tip length calibration record, silently ignore that record.JSONDecodeError
catch. (This turned out to not be the problem, but it's still probably a good idea to fix.)Review requests
Risk assessment
Low.