Defer external resources until process initialization - #292
toby-coleman wants to merge 7 commits into
Conversation
Add a small backend selector for ZMQ imports so existing PyZMQ behavior remains default while PLUGBOARD_ZMQ_BACKEND=pyomq can use pyomq. Wire the ZMQ channel and proxy through the selector, add the optional plugboard[omq] extra, and cover backend selection plus pyomq socket/proxy smoke paths.
# Conflicts: # pyproject.toml # uv.lock
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01db9f6974
ℹ️ 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".
| self._actor: _t.Any = None | ||
| self._init_lock = asyncio.Lock() |
There was a problem hiding this comment.
Preserve direct RayChannel usability after construction
When callers instantiate the public RayChannel class directly rather than obtaining it through RayConnector, the actor now remains None, so send(), recv(), close(), maxsize, and is_closed all fail with AttributeError unless the caller knows to invoke the newly added RayChannel.init() first. Channel has no initialization lifecycle in its interface, and these operations worked immediately after construction before this change; either retain that behavior for direct instances or formally expose and enforce the new lifecycle across the channel API.
AGENTS.md reference: AGENTS.md:L140-L145
Useful? React with 👍 / 👎.
Process construction currently truncates
FileWriterdestinations and starts Ray/ZMQ resources, so read-only CLI operations such asvalidateanddiagramcan mutate external state. This change adds an explicit async connector initialization phase, validates topology before that phase, and defers file truncation plus Ray component/channel/state actors and ZMQ sockets/proxies until execution initialization.Regression coverage verifies that construction, validation, diagramming, and export preserve existing output files and make no actor, socket, or proxy calls. It also verifies that invalid topology fails before writers or connectors initialize.
Validation:
uv run ruff checkuv run ruff format --checkuv run ty check plugboard/ plugboard-schemas/plugboard_schemas/ tests/The broader unit run reached 116 passed and 6 skipped before the local Ray worker environment stalled while rebuilding the project from Ray's packaged working directory, where setuptools-scm could not find Git metadata.