Skip to content

Commit 650726d

Browse files
fix(shared-data): ensure agreement between top frustum and well dimensions
Co-authored-by: Max Marrone <[email protected]> (cherry picked from commit e5b41f7 / PR #19126)
1 parent 8ad8229 commit 650726d

File tree

5 files changed

+317
-273
lines changed

5 files changed

+317
-273
lines changed

shared-data/js/__tests__/labwareDefSchemaV2.test.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,50 @@ const checkGeometryDefinitions = (labwareDef: LabwareDefinition2): void => {
285285
}
286286
})
287287

288+
test('first frustum section should match well diameter or x/y dimensions within ±1 mm', () => {
289+
// TODO(rc, 2025-08-05): Review labware with 0–2 mm geometry discrepancies.
290+
const wells = labwareDef.wells ?? {}
291+
const geometries = labwareDef.innerLabwareGeometry ?? {}
292+
// Allow minor mismatch due to simplified geometric approximation
293+
const allowedDiscrepancy = 2
294+
// Ignoring bc of a known x y mismatch
295+
if (
296+
labwareDef.parameters.loadName === 'nest_1_reservoir_195ml' &&
297+
labwareDef.version === 3
298+
) {
299+
return
300+
}
301+
302+
for (const well of Object.values(wells)) {
303+
const geometryId = well.geometryDefinitionId ?? ''
304+
const geometry = geometries[geometryId]
305+
306+
if (
307+
!geometry ||
308+
!('sections' in geometry) ||
309+
!Array.isArray(geometry.sections)
310+
) {
311+
continue
312+
}
313+
314+
const section = geometry.sections[0]
315+
if (!section) continue
316+
317+
if (well.shape === 'circular' && section.shape === 'conical') {
318+
expect(
319+
Math.abs(section.topDiameter - well.diameter)
320+
).toBeLessThanOrEqual(allowedDiscrepancy)
321+
} else if (well.shape === 'rectangular' && section.shape === 'cuboidal') {
322+
expect(
323+
Math.abs(section.topXDimension - well.xDimension)
324+
).toBeLessThanOrEqual(allowedDiscrepancy)
325+
expect(
326+
Math.abs(section.topYDimension - well.yDimension)
327+
).toBeLessThanOrEqual(allowedDiscrepancy)
328+
}
329+
}
330+
})
331+
288332
test('the bottom of a well geometry should be at height 0', () => {
289333
for (const geometry of Object.values(
290334
labwareDef.innerLabwareGeometry ?? {}

0 commit comments

Comments
 (0)