[ISSUE-09] Implement lvl1 assembly stage and PUDU assembly JSON adapter#76
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4e65169aa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ordered = constraints.get("ordered_part_identities") | ||
| if ordered: | ||
| return list(ordered) | ||
| unordered = constraints.get("part_identities") | ||
| if unordered: | ||
| return list(unordered) |
There was a problem hiding this comment.
Accept planner
part_order in lvl1 part extraction
The new stage only reads ordered_part_identities/part_identities, but planner-produced level-1 requests currently provide parts under constraints["part_order"] for combinatorial designs (src/buildcompiler/planning/combinatorial.py) and no alternate key normalization is present before execution. In this state, _extract_part_identities returns an empty list and run() immediately returns StageStatus.FAILED, so valid planner outputs cannot reach route selection or assembly. Please include part_order (or normalize planner constraints) when extracting part identities.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
@codex good catch, please fix this issue
There was a problem hiding this comment.
Summary
- Updated lvl1 part extraction to recognize planner-provided
constraints["part_order"]as a supported fallback, so valid planner requests no longer fail early whenordered_part_identitiesis absent. src/buildcompiler/stages/assembly_lvl1.pyL203-L213 - Added a regression test that uses only
part_orderin request constraints and verifies lvl1 assembly proceeds successfully. tests/unit/stages/test_assembly_lvl1.pyL172-L186
Testing
- ✅
pytest tests/unit/stages/test_assembly_lvl1.py
Motivation
AssemblyServiceinto aStageResultwhile emitting a compiler-only PUDU-compatible JSON intermediate.MissingBuildInputblockers and preserve planner ordering/cardinality warnings instead of raising exceptions.AssemblyServiceandCompatibilitySelectorrespectively, avoiding changes to those internals.Description
AssemblyLvl1Stageinsrc/buildcompiler/stages/assembly_lvl1.pywhich: extracts ordered part identities from request constraints, callsCompatibilitySelector.select_lvl1_route, producesMissingBuildInputrecords for missing parts/backbone/reagents, resolves default reagents fromBuildOptions/Inventory, delegates assembly toAssemblyService.run, appendsrequest.source_identityto generated productinsert_identities, indexes generated products viaInventory.add_generated_product, and attaches an in-memory PUDU JSON intermediate viaassembly_route_to_pudu_json.assembly_route_to_pudu_jsonand batch helperassembly_routes_to_pudu_jsoninsrc/buildcompiler/adapters/pudu/assembly_json.pywhich produce in-memory dictionaries with keysProduct,Backbone,PartsList, andRestriction Enzymeusing stable identities/names.AssemblyLvl1Stageand PUDU adapter functions by updatingsrc/buildcompiler/stages/__init__.pyandsrc/buildcompiler/adapters/pudu/__init__.py.tests/unit/adapters/pudu/test_assembly_json.pyto validate adapter shape/values andtests/unit/stages/test_assembly_lvl1.pyto cover success (product + JSON intermediate + warning propagation + inventory indexing) and blocked paths (structured missing kinds for promoter/rbs/cds/terminator/backbone/restriction_enzyme/ligase).Testing
python -c "from buildcompiler.stages import AssemblyLvl1Stage"andpython -c "from buildcompiler.adapters.pudu import assembly_route_to_pudu_json"succeeded.pytest tests/unit/stages/test_assembly_lvl1.py tests/unit/adapters/pudu/test_assembly_json.pypassed (all tests green).ruff checkandruff formatwere run against changed files and succeeded after formatting (no remaining failures).uvworkflow:uv run pytest tests/unit/stages/test_assembly_lvl1.py tests/unit/adapters/pudu/test_assembly_json.pywas attempted but theuvbootstrap failed to fetch an externalSBOLInventorygit dependency (HTTP 403), so localpytestwas used as a fallback and succeeded.Codex Task