Skip to content

Conversation

@ddcc4
Copy link
Collaborator

@ddcc4 ddcc4 commented Oct 23, 2025

Overview

Part 5 for tiprack definition lookups in PD.

Back in PR #19041, @ncdiehl11 introduced the function getMatchingTipLiquidSpecsFromSpec() that takes a tiprack URI and tries to look up the tiprack definition. It sometimes fails, producing Sentry errors like:

However, there is no need for getMatchingTipLiquidSpecsFromSpec() itself to look up the tiprack definition, because the caller already has the tiprack definition.

So this PR changes getMatchingTipLiquidSpecsFromSpec() to take a tiprack labware definition instead of a tiprack URI.

Note that the existing implementation in load-file/migration/8_5_0.ts to find the tiprack definition is not quite correct, and would fail for custom tipracks. But we'll fix that in a future PR.

Test Plan and Hands on Testing

CI tests.

Risk assessment

Low.

@ddcc4 ddcc4 requested review from jerader and ncdiehl11 October 23, 2025 20:02
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.00%. Comparing base (4415bdf) to head (4f47795).

Files with missing lines Patch % Lines
protocol-designer/src/utils/index.ts 0.00% 4 Missing ⚠️
protocol-designer/src/load-file/migration/8_5_0.ts 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                   Coverage Diff                   @@
##           chore_release-pd-8.6.1   #19901   +/-   ##
=======================================================
  Coverage                   58.00%   58.00%           
=======================================================
  Files                        3413     3413           
  Lines                      283910   283906    -4     
  Branches                    39369    39369           
=======================================================
  Hits                       164671   164671           
+ Misses                     118966   118962    -4     
  Partials                      273      273           
Flag Coverage Δ
protocol-designer 18.83% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
protocol-designer/src/load-file/migration/8_5_0.ts 1.03% <0.00%> (-0.01%) ⬇️
protocol-designer/src/utils/index.ts 38.00% <0.00%> (+0.41%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@ncdiehl11 ncdiehl11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me. I left a couple of comments regarding typing

?.byTipType.find(byTipType => byTipType.tiprack === tiprack)
// TODO: this won't find the definition for a custom tiprack
const tiprackDef = getAllDefinitions()[tiprack]
console.assert(tiprackDef, `could not find labware definition for ${tiprack}`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to be a bit more explicit

Suggested change
console.assert(tiprackDef, `could not find labware definition for ${tiprack}`)
console.assert(tiprackDef != null, `could not find labware definition for ${tiprack}`)

pipetteSpecs: PipetteV2Specs,
volume: number,
tiprackUri: string
tiprackDef: LabwareDefinition2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding this, I think this type should be a union including null

Suggested change
tiprackDef: LabwareDefinition2
tiprackDef: LabwareDefinition2 | null

.find(byPipette => byPipette.pipetteModel === pipetteName)
?.byTipType.find(byTipType => byTipType.tiprack === tiprack)
// TODO: this won't find the definition for a custom tiprack
const tiprackDef = getAllDefinitions()[tiprack]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for types to agree when passing this arg

Suggested change
const tiprackDef = getAllDefinitions()[tiprack]
const tiprackDef = getAllDefinitions()[tiprack] ?? null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants