OpentronsOT2ChatterboxBackend: a dry-run OT-2 backend with I/O logging, via a transport seam#1132
Open
BioCam wants to merge 5 commits into
Open
OpentronsOT2ChatterboxBackend: a dry-run OT-2 backend with I/O logging, via a transport seam#1132BioCam wants to merge 5 commits into
OpentronsOT2ChatterboxBackend: a dry-run OT-2 backend with I/O logging, via a transport seam#1132BioCam wants to merge 5 commits into
Conversation
Characterization tests ahead of the transport-seam refactor (Phase 0). The existing suite already asserts the pickup/drop/aspirate/dispense wire calls; this adds the four remaining ot_api call sites so the seam refactor cannot change them silently: - home() issues one ot_api.health.home() - list_connected_modules() returns ot_api.modules.list_connected_modules() verbatim - stop() cancels the active run via the requestor and clears mounted pipettes - a discard to the deck trash at api_version >= 7.1.0 routes through the addressable area (move_to_addressable_area_for_drop_tip + drop_tip_in_place), not drop_tip No production code changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduces a single transport seam (Phase 1): every ot_api call - including the run-cancel requestor calls in stop() - now goes through self._ot, set to the ot_api module in __init__. Behaviour is unchanged (self._ot is ot_api), but a subclass can now dry-run the backend by swapping the handle for a recording stand-in, the way STARChatterboxBackend overrides STAR's transport. The dedicated `import ot_api.requestor as _req` is dropped; ot_api.requestor is reachable through the handle (self._ot.requestor). Guarded by the Phase 0 characterization tests, which patch ot_api.* and stay green because self._ot is the same module object. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nsport seam Phase 2. A chatterbox sibling to OpentronsOT2Backend that swaps the self._ot transport handle for a recorder, so the real backend logic - pipette selection, tip and volume tracking, the per-operation wire calls - runs unchanged with no hardware and no ot_api library. Mirrors STARChatterboxBackend (transport-only override) rather than OpentronsOT2Simulator (which reimplements the high-level methods single-channel). Issued calls are printed and collected in .commands. The recorder returns canned data for the reads setup() and the operations make back (mounted pipettes, api version, labware define, save_position, modules). Exported from backends/__init__. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…mulator Phase 3. Direct tests run the chatterbox with no ot_api installed: setup resolves both mounts, a pickup -> aspirate -> dispense -> trash-discard records exactly one wire call per operation, an unknown pipette name raises, and serialize() captures the mounts. A differential audit runs the same single-channel protocol through the chatterbox and the reference OpentronsOT2Simulator and asserts identical tracked outcomes (tip mounted, source/destination volumes). The audit is scoped to the single-channel overlap, since the simulator cannot represent a multi-channel head. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
OpentronsOT2Backend: route all ot_api I/O through a self._ot handleOpentronsOT2ChatterboxBackend: a dry-run OT-2 backend, via a transport seam
The OT-2 talks HTTP through ot_api rather than a pylabrobot.io transport, so its wire traffic never reached the IO log other backends produce. Wrap the real ot_api handle in a transparent _IOLogger proxy that logs every call (submodules recursed, plain attributes passed through) at LOG_LEVEL_IO. The chatterbox recorder logs the same way, so a dry run captures the same wire trace as a real run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 30, 2026
OpentronsOT2ChatterboxBackend: a dry-run OT-2 backend, via a transport seamOpentronsOT2ChatterboxBackend: a dry-run OT-2 backend with I/O logging, via a transport seam
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
OpentronsOT2ChatterboxBackend, a dry-run backend for the OT-2 that runs the real backend logic with no hardware and noot_apilibrary, mirroring howSTARChatterboxBackenddry-runsSTARBackend. UnlikeOpentronsOT2Simulator(which overrides the high-level methods with single-channel stubs), the chatterbox replaces only the transport, so pipette selection, tip/volume tracking, and the per-operation wire calls all run unchanged.To enable that, the backend routes every
ot_apicall - including the run-cancel calls instop()- through a singleself._ottransport handle. The real handle wrapsot_apiin a transparent_IOLoggerproxy that logs every HTTP call atLOG_LEVEL_IO, like other backends get from their io object; the chatterbox swaps the handle for a recorder that logs the same way, so a dry run captures the same wire trace as a real run.Characterization tests pin the existing wire calls (home / stop-cancel / list_connected_modules / addressable-area trash drop) so the seam refactor cannot change them silently; chatterbox tests run a full protocol with no
ot_apiinstalled and assert the recorded calls.Foundation of the OT-2 series; depends on nothing else in it.
🤖 Generated with Claude Code