feat: add opt-in contextual execution event bus - #1198
Open
j0nch wants to merge 12 commits into
Open
Conversation
added 12 commits
August 6, 2026 15:02
j0nch
marked this pull request as ready for review
August 11, 2026 01:55
Member
|
this is sick! very nice
|
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.
Summary
Introduces an opt-in, in-process structured EventBus for contextual PLR execution events.
pylabrobot.eventswith a synchronous fan-outEventBus, scoped/default bus helpers, inherited operation context, JSON-friendly resource/coordinate references, and correlatedstarted/completed/failedoperation events.Current implementation coverage
This is deliberately an initial, opt-in implementation. It does not automatically instrument every PLR device or public method.
Currently instrumented frontends:
legacy.machines.Machine:setup,stoplegacy.storage.Incubator:fetch_plate,take_in_platelegacy.liquid_handling.LiquidHandler: resource pickup/move/drop, tip pickup/drop, 96-head tip pickup/drop, aspirate, and dispenselegacy.shaking.Shaker:shake,stop_shakinglegacy.temperature_controlling.TemperatureController: set temperature, wait for temperature, deactivatebrooks.precise_flex.PreciseFlex: lifecycle, fault/home/freedrive, joint/cartesian/rail/gripper motion, pick/drop, and parkDiagnostic transport coverage, not semantic frontend-operation coverage:
io.Serial,io.USB, andio.FTDI:io.readandio.writehamilton.transport.usb.HamiltonUSBDriver:firmware.command.started,.completed, and.failedThese records are complementary diagnostic coverage: semantic events describe PLR-level operations, while diagnostic events describe the transport and controller activity performed to execute them.
Proposed driver-adoption contract
New and existing drivers can adopt EventBus support incrementally at their public semantic API boundaries. The included EventBus operation semantics guide defines:
The guide intentionally does not require irrelevant fields for every device. Drivers should describe what their PLR frontend actually did, while downstream consumers derive their own display or protocol views from the structured references.
Dependency
This branch is intentionally stacked on #1194 (
f0f05d513, real-time legacy arm resource-state updates ported tomain). Until #1194 merges, this PR's comparison againstmainincludes that commit. Once it lands, this branch will be rebased onto upstreammainso this PR contains only the EventBus changes.Event model
Semantic operations emit correlated lifecycle records such as:
The event context carries a stable operation ID and can be augmented by callers with execution context. Event data identifies the issuing device and direct PLR resources, without requiring consumers to infer resource identity from controller-level commands.