Skip to content

[ISSUE-13] Add PUDU JSON adapters, protocol artifact boundaries, and lazy Opentrons simulation gate#81

Merged
Gonza10V merged 1 commit into
full_buildfrom
codex/implement-pudu-and-protocol-json-adapters
May 6, 2026
Merged

[ISSUE-13] Add PUDU JSON adapters, protocol artifact boundaries, and lazy Opentrons simulation gate#81
Gonza10V merged 1 commit into
full_buildfrom
codex/implement-pudu-and-protocol-json-adapters

Conversation

@Gonza10V
Copy link
Copy Markdown
Contributor

@Gonza10V Gonza10V commented May 6, 2026

Motivation

  • Provide compiler-only PUDU adapters for transformation and plating so assembly/transformation/plating stages can produce deterministic in-memory JSON without importing automation libraries.
  • Add a minimal protocol-artifact boundary so file output is opt-in and deterministic, and ensure Opentrons simulation is explicitly opt-in and lazily imported.
  • Preserve the compiler-first constraint: no PUDU, Opentrons, SynBioHub, or SBOLInventory imports at core import time and no simulation by default.

Description

  • Added PUDU adapters that emit in-memory JSON: transformation_to_pudu_json and transformations_to_pudu_json in src/buildcompiler/adapters/pudu/transformation_json.py, and plating_to_pudu_json in src/buildcompiler/adapters/pudu/plating_json.py, both producing deterministic payloads.
  • Added protocol artifact boundary ProtocolArtifact and maybe_write_protocol_artifacts in src/buildcompiler/adapters/protocols.py which only writes files when options.mode is MANUAL/AUTOMATED and options.results_dir is provided; otherwise artifacts remain in-memory.
  • Added Opentrons simulation boundary OpentronsSimulationAdapter, SimulationResult, and OptionalAutomationDependencyError in src/buildcompiler/adapters/opentrons/simulation.py that skips importing opentrons when ProtocolOptions.simulate is False and lazily imports (raising a clear error if missing) when True.
  • Updated lightweight exports to avoid optional side effects in src/buildcompiler/adapters/__init__.py, src/buildcompiler/adapters/pudu/__init__.py, and src/buildcompiler/adapters/opentrons/__init__.py and added focused unit tests for the adapters and boundaries.

Testing

  • Import smoke checks succeeded: python -c "from buildcompiler.api import BuildOptions, ProtocolMode", python -c "from buildcompiler.execution import BuildContext, FullBuildExecutor", and python -c "from buildcompiler.adapters.pudu import assembly_route_to_pudu_json, transformation_to_pudu_json, plating_to_pudu_json", and python -c "from buildcompiler.adapters.opentrons import OpentronsSimulationAdapter" all passed.
  • Unit tests run: pytest tests/unit/adapters passed and full targeted run pytest tests/unit/api tests/unit/execution tests/unit/adapters passed (all tests in those suites passed).
  • Lint/format: running ruff format on the modified files and scoped ruff check on adapter files/tests passed; a repository-wide ruff check . surfaced unrelated legacy lint issues outside this change.
  • Environment/network note: uv run pytest ... (virtualenv creation) failed because fetching the optional SBOLInventory git dependency failed due to a network/Git access error (git clone returned CONNECT tunnel 403); this prevented creating the ephemeral env with optional extras, but local pytest runs for the added tests completed successfully.

Codex Task

@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

path.write_text(
json.dumps(payload, indent=2, sort_keys=True), encoding="utf-8"

P2 Badge Preserve raw text artifacts instead of JSON-encoding them

Handle string payloads separately before writing: maybe_write_protocol_artifacts currently runs json.dumps(...) for every artifact, so text artifacts (for example protocol scripts or markdown content) are written with extra quotes and escape sequences, which makes them unusable as direct protocol files when protocol output is enabled. This regression is triggered whenever a caller passes a str payload in payloads.

ℹ️ 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".

@Gonza10V Gonza10V merged commit 80de92e into full_build May 6, 2026
0 of 4 checks passed
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