Skip to content

feat(protocol-designer,step-generation): eagerly computes enriched robot state at initial deck state#21275

Open
ncdiehl11 wants to merge 3 commits intoedgefrom
vacuum_enrichment-efficiency
Open

feat(protocol-designer,step-generation): eagerly computes enriched robot state at initial deck state#21275
ncdiehl11 wants to merge 3 commits intoedgefrom
vacuum_enrichment-efficiency

Conversation

@ncdiehl11
Copy link
Copy Markdown
Collaborator

@ncdiehl11 ncdiehl11 commented Apr 15, 2026

NOTE: This PR is targeting another branch upon whose merging this PR is dependent so that the diff is clear. Once that PR merges, I will rebase this branch off edge

Overview

This PR tightens how PD and step-generation build the labware stack graph (stackedOnNode and sibling contains). Labware temporal properties are enriched with these two properties once when building getInitialRobotState, instead of again on every active timeline step, so mid-protocol state is expected to stay correct via command updaters (moves, stacker flows, etc.). Related PD selectors still expose largest stacks and free addressable areas for the initial deck and the active simulated step based on these populated properties, but they will not recompute the enriched graph.

Test Plan and Hands on Testing

  • unit testing
  • logging inside enrichRobotStateForStackGraphTraversals across steps to ensure it only is run when initial deck setup changes

Changelog

  • only enrich labware temporal properties with stackedOnNode/contains at migration or initial deck setup
  • remove straggling console log!

Review requests

Please mainly review code for sanity and style

Risk assessment

lowish

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 42.10526% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.30%. Comparing base (4aee81d) to head (b3c3ee0).

Files with missing lines Patch % Lines
...tocol-designer/src/file-data/selectors/commands.ts 0.00% 5 Missing ⚠️
...igner/src/top-selectors/labware-locations/index.ts 28.57% 5 Missing ⚠️
...col-designer/src/file-data/selectors/traversals.ts 80.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             edge   #21275   +/-   ##
=======================================
  Coverage   57.30%   57.30%           
=======================================
  Files        3991     3991           
  Lines      327450   327418   -32     
  Branches    46619    46618    -1     
=======================================
- Hits       187651   187634   -17     
+ Misses     139580   139565   -15     
  Partials      219      219           
Flag Coverage Δ
app 44.93% <31.57%> (-0.03%) ⬇️
protocol-designer 19.97% <31.57%> (-0.01%) ⬇️
step-generation 5.90% <10.52%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
shared-data/js/fixtures.ts 75.96% <ø> (-0.03%) ⬇️
step-generation/src/utils/traversals.ts 94.39% <100.00%> (-0.03%) ⬇️
...col-designer/src/file-data/selectors/traversals.ts 64.51% <80.00%> (+0.23%) ⬆️
...tocol-designer/src/file-data/selectors/commands.ts 42.96% <0.00%> (-1.32%) ⬇️
...igner/src/top-selectors/labware-locations/index.ts 10.88% <28.57%> (-0.98%) ⬇️

... and 1 file with indirect coverage changes

🚀 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.

@ncdiehl11 ncdiehl11 self-assigned this Apr 15, 2026
@ncdiehl11 ncdiehl11 marked this pull request as ready for review April 15, 2026 17:06
@ncdiehl11 ncdiehl11 requested a review from a team as a code owner April 15, 2026 17:06
labware = assignContainsAmongSiblings(labware, labwareEntities)
}
// assign contains among siblings
labware = assignContainsAmongSiblings(labware, labwareEntities)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there is any possibility that labwareEntities gets null/undefined?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this should never be the case. At worst it will be an empty object {}. Typechecks enforce this as well

Copy link
Copy Markdown
Contributor

@koji koji left a comment

Choose a reason for hiding this comment

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

left one question but the changes look good to me.

Base automatically changed from vacuum_state-updates to edge April 15, 2026 21:50
…s wire up

This PR threads `stackedOnNode` (and related `contains`) throuh PD’s initial deck setup and through step generation robot state updates so stack-graph logic stays consistent with the PE model.
…bot state at initial deck state

This PR tightens how PD and step-generation build the labware stack graph (stackedOnNode and sibling contains). Labware temporal properties are enriched with these two properties once when building getInitialRobotState, instead of again on every active timeline step, so mid-protocol state is expected to stay correct via command updaters (moves, stacker flows, etc.). Related PD selectors still expose largest stacks and free addressable areas for the initial deck and the active simulated step based on these populated properties, but they will not recompute the enriched graph.
@ncdiehl11 ncdiehl11 force-pushed the vacuum_enrichment-efficiency branch from eb5b6af to b3c3ee0 Compare April 15, 2026 21:56
@ncdiehl11 ncdiehl11 deployed to pd-non-prod April 15, 2026 22:01 — with GitHub Actions Active
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.

2 participants