Skip to content

[ISSUE-09] Implement lvl1 assembly stage and PUDU assembly JSON adapter#76

Merged
Gonza10V merged 2 commits into
full_buildfrom
codex/implement-lvl1-assembly-stage-and-pudu-adapter
May 6, 2026
Merged

[ISSUE-09] Implement lvl1 assembly stage and PUDU assembly JSON adapter#76
Gonza10V merged 2 commits into
full_buildfrom
codex/implement-lvl1-assembly-stage-and-pudu-adapter

Conversation

@Gonza10V
Copy link
Copy Markdown
Contributor

@Gonza10V Gonza10V commented May 6, 2026

Motivation

  • Provide a thin orchestration stage for level-1 assembly that glues route selection, reagent/backbone resolution, and the SBOL AssemblyService into a StageResult while emitting a compiler-only PUDU-compatible JSON intermediate.
  • Surface expected missing inputs as structured MissingBuildInput blockers and preserve planner ordering/cardinality warnings instead of raising exceptions.
  • Keep digestion/ligation and route selection responsibilities in AssemblyService and CompatibilitySelector respectively, avoiding changes to those internals.

Description

  • Added AssemblyLvl1Stage in src/buildcompiler/stages/assembly_lvl1.py which: extracts ordered part identities from request constraints, calls CompatibilitySelector.select_lvl1_route, produces MissingBuildInput records for missing parts/backbone/reagents, resolves default reagents from BuildOptions/Inventory, delegates assembly to AssemblyService.run, appends request.source_identity to generated product insert_identities, indexes generated products via Inventory.add_generated_product, and attaches an in-memory PUDU JSON intermediate via assembly_route_to_pudu_json.
  • Implemented PUDU adapter assembly_route_to_pudu_json and batch helper assembly_routes_to_pudu_json in src/buildcompiler/adapters/pudu/assembly_json.py which produce in-memory dictionaries with keys Product, Backbone, PartsList, and Restriction Enzyme using stable identities/names.
  • Exported AssemblyLvl1Stage and PUDU adapter functions by updating src/buildcompiler/stages/__init__.py and src/buildcompiler/adapters/pudu/__init__.py.
  • Added unit tests: tests/unit/adapters/pudu/test_assembly_json.py to validate adapter shape/values and tests/unit/stages/test_assembly_lvl1.py to 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

  • Import smoke checks: python -c "from buildcompiler.stages import AssemblyLvl1Stage" and python -c "from buildcompiler.adapters.pudu import assembly_route_to_pudu_json" succeeded.
  • Unit tests: pytest tests/unit/stages/test_assembly_lvl1.py tests/unit/adapters/pudu/test_assembly_json.py passed (all tests green).
  • Lint/format: ruff check and ruff format were run against changed files and succeeded after formatting (no remaining failures).
  • Optional uv workflow: uv run pytest tests/unit/stages/test_assembly_lvl1.py tests/unit/adapters/pudu/test_assembly_json.py was attempted but the uv bootstrap failed to fetch an external SBOLInventory git dependency (HTTP 403), so local pytest was used as a fallback and succeeded.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +204 to +209
ordered = constraints.get("ordered_part_identities")
if ordered:
return list(ordered)
unordered = constraints.get("part_identities")
if unordered:
return list(unordered)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@codex good catch, please fix this issue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Testing

  • pytest tests/unit/stages/test_assembly_lvl1.py

View task →

@Gonza10V Gonza10V merged commit a3424a8 into full_build May 6, 2026
0 of 4 checks passed
@Gonza10V Gonza10V deleted the codex/implement-lvl1-assembly-stage-and-pudu-adapter branch May 6, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant