Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app): mark protocol anlayses as stale if they lack RTP #14763

Merged
merged 4 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3936,5 +3936,6 @@
"description": "",
"displayColor": "#b925ff"
}
]
],
"runTimeParameters": []
Copy link
Collaborator

Choose a reason for hiding this comment

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

🚀 yay so cool seeing this key in fixtures!!

}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('write failed analysis', () => {
modules: [],
pipettes: [],
liquids: [],
runTimeParameters: [],
})
})
})
Expand Down
1 change: 1 addition & 0 deletions app-shell/src/protocol-analysis/writeFailedAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function createFailedAnalysis(
pipettes: [],
modules: [],
liquids: [],
runTimeParameters: [],
// TODO(mc, 2022-05-04): this field does not make sense for an
// analysis that was unable to complete, but is required by
// ProtocolAnalysisOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ describe('protocol storage directory utilities', () => {
pipettes: [],
modules: [],
labware: [],
runTimeParameters: [],
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const modifiedStoredProtocolData = {
commands: storedProtocolData?.mostRecentAnalysis?.commands,
liquids: storedProtocolData?.mostRecentAnalysis?.liquids,
errors: storedProtocolData?.mostRecentAnalysis?.errors,
runTimeParameters:
storedProtocolData?.mostRecentAnalysis?.runTimeParameters,
},
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/organisms/ProtocolsLanding/__tests__/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const mockStoredProtocolData = [
displayColor: '#ff4f4f',
},
],
runTimeParameters: [],
errors: [],
} as ProtocolAnalysisOutput,
},
Expand Down Expand Up @@ -183,6 +184,7 @@ const mockStoredProtocolData = [
displayColor: '#ff4f4f',
},
],
runTimeParameters: [],
errors: [],
} as ProtocolAnalysisOutput,
},
Expand Down Expand Up @@ -273,6 +275,7 @@ const mockStoredProtocolData = [
displayColor: '#ff4f4f',
},
],
runTimeParameters: [],
errors: [],
} as ProtocolAnalysisOutput,
},
Expand Down
36 changes: 35 additions & 1 deletion app/src/organisms/ProtocolsLanding/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { describe, it, expect } from 'vitest'
import { getisFlexProtocol, getRobotTypeDisplayName } from '../utils'
import {
getAnalysisStatus,
getisFlexProtocol,
getRobotTypeDisplayName,
} from '../utils'
import type { ProtocolAnalysisOutput } from '@opentrons/shared-data'

const mockOT3ProtocolAnalysisOutput = {
Expand All @@ -10,6 +14,36 @@ const mockOT2ProtocolAnalysisOutput = {
robotType: 'OT-2 Standard',
} as ProtocolAnalysisOutput

describe('getAnalysisStatus', () => {
it('should return stale if no liquids in analysis', () => {
const result = getAnalysisStatus(false, {
...mockOT3ProtocolAnalysisOutput,
liquids: [],
errors: [],
})
expect(result).toBe('stale')
})

it('should return stale if no runTimeParameters in analysis', () => {
const result = getAnalysisStatus(false, {
...mockOT3ProtocolAnalysisOutput,
runTimeParameters: [],
errors: [],
})
expect(result).toBe('stale')
})

it('should return complete if liquids and runTimeParameters in analysis', () => {
const result = getAnalysisStatus(false, {
...mockOT3ProtocolAnalysisOutput,
liquids: [],
runTimeParameters: [],
errors: [],
})
expect(result).toBe('complete')
})
})

describe('getisFlexProtocol', () => {
it('should return true for protocols intended for a Flex', () => {
const result = getisFlexProtocol(mockOT3ProtocolAnalysisOutput)
Expand Down
5 changes: 4 additions & 1 deletion app/src/organisms/ProtocolsLanding/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export function getAnalysisStatus(
): AnalysisStatus {
if (isAnalyzing) {
return 'loading'
} else if (analysis != null && analysis?.liquids == null) {
} else if (
analysis != null &&
(analysis.liquids == null || analysis.runTimeParameters == null)
) {
return 'stale'
} else if (analysis != null) {
return analysis.errors.length > 0 ? 'error' : 'complete'
Expand Down
2 changes: 2 additions & 0 deletions shared-data/protocol/types/schemaV8/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
LoadedLabware,
LoadedModule,
Liquid,
RunTimeParameter,
} from '../../../js'
import type { CommandAnnotation } from '../../../commandAnnotation/types'
import type { LabwareDefinition2, RobotType } from '../../../js/types'
Expand Down Expand Up @@ -136,6 +137,7 @@ export interface ProtocolAnalysisOutput {
modules: LoadedModule[]
liquids: Liquid[]
errors: AnalysisError[]
runTimeParameters: RunTimeParameter[]
robotType?: RobotType
}

Expand Down
Loading