Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions docs/plans/issue135_viewer_bind_implementation_20260929.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Managed viewer bind implementation checkpoint

Replaces the planning-only state of PR #159; relates to #135. The connection address remains `StreamingDefaults.host`. The independently declared `StreamingDefaults.listen_host` defaults to `127.0.0.1` and projects through the existing `ViewerProcessLaunchConfig` into both detached Napari/Fiji entrypoints. Both server constructors pass that declaration to the existing ZMQ endpoint owner, which derives and binds data and control sockets. Explicit interfaces and `*` remain supported; IPC ignores the bind host. Externally owned viewers are connected to, not rebound by this change.

No new catalog, registry, launch store, or string-switch router was introduced. The existing Napari process-launch comparison includes the listen address for a process the lifecycle owns. External viewers retain their own listener policy: their connection reuse checks Qt font DPI but does not request a listener change or restart. Missing old wire declarations fail decoding rather than acquiring a compatibility default.

Focused source verification: 46 tests passed in 3.58 seconds across `test_viewer_listener_binding.py`, `test_streaming_config_factory_registry.py`, and `test_viewer_protocol.py`. The network cases construct real Napari/Fiji server owners and bind their actual data/control sockets, asserting `ZMQ_LAST_ENDPOINT` for loopback, explicit wildcard, and IPC. They do not start the GUI or Fiji JVM. The detached argument test verifies connection host and bind host remain independent.

Outstanding acceptance: actual fresh detached Napari process through the installed user entrypoint, both OS listeners observed, and image/control response; existing external-viewer reuse through that same live path; explicit remote bind in a controlled environment. Installed source remains unchanged while the blind H003 run is active. This checkpoint is an implementation draft, not a live-readiness claim. Heavy validation is serialized with the issue batch's resource lock.

Follow-up ownership check: local versus external listener reuse is now owned by `ViewerProcessLaunchConfig.matches_existing_viewer`, with a regression proving an external wildcard listener is not rejected/restarted because the local launch default is loopback. The focused suite now passes 47 tests in 3.01 seconds; two additional Napari launch/report tests passed separately. New listener tests pass Ruff; broad existing modules retain pre-existing lint findings, not a claimed lint-clean baseline. H003 is now frozen and its viewer slot released; fresh installed-viewer validation is the next acceptance step.
25 changes: 25 additions & 0 deletions docs/plans/issue135_viewer_bind_receipt_20260929.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# #135: Managed viewer listen address

**Plan status:** provisional design, not a fix. **Source:** `OpenHCSDev/openhcs` `main` `0c7b898f852a8bedc0e1bc38b93f36088d301808`; external/ZMQRuntime gitlink `1d3b32f4fcead23d5d2079c975eb2ae7646a1478`. **Issue contract:** a localhost-requested managed TCP viewer must not expose its control endpoint on every network interface; a remotely addressable viewer remains a separate supported capability when explicitly chosen.

## Determining facts and consumers

- `openhcs/core/config.py:982–1010` calls `StreamingDefaults.host` the **viewer host** for client connection and permits remote TCP. `openhcs/core/streaming_config_factory.py:118–125,168–187` projects it into `ViewerTransportEndpoint` and runtime config.
- `openhcs/runtime/viewer_protocol.py:671–699` defines launch requests without a listen address; `:1289–1330` builds the client-facing runtime endpoint. `openhcs/runtime/napari_stream_visualizer.py:83–97` constructs detached arguments without a host.
- `openhcs/runtime/napari_viewer_server.py:5890–5926` constructs the server request; `:5540–5565` unconditionally gives the ZMQ parent `host="*"`. The reported `ss` observation in #135 is consistent with this source. The inherited parent binds data and control sockets; check both at the pinned dependency implementation before applying.
- `openhcs/runtime/fiji_viewer_server.py:1972` also passes `"*"`. This is a separate viewer family and a potential same-policy crossing, not automatically a regression covered by the Napari report. `openhcs/runtime/zmq_config.py:24–47` already distinguishes execution-server `client_host` and `server_host`; do not copy execution settings into viewer policy without evidence.

## Required answers and provisional relation

For a **locally launched** viewer, what address may the two TCP sockets bind, and what address do clients use? Candidate `R*`: the authorized listen-interface declaration must determine both the data and control bind addresses; the existing viewer transport endpoint determines connection/routing. These are different questions even if both are `127.0.0.1`. For IPC, bind-host selection must not change the local socket contract. For an **externally owned** remote viewer, OpenHCS may connect without launching or rebinding it; verify lifecycle behavior before deciding that a remote host is invalid at local launch. Unknown/OPEN: how the launch manager distinguishes local versus external ownership, exact ZMQRuntime bind propagation, Fiji parity, existing-viewer reuse, IPv6, and Windows TCP behavior. No missing class or inheritance edge is claimed.

## Candidate owner and falsifiers

Prefer an explicit viewer launch/bind policy carried through the existing `StreamingViewerRuntimeConfig` → managed lifecycle → detached server request, while retaining client `ViewerTransportEndpoint.host` for connection. **Do not silently reinterpret `host` as a bind interface**; remote connections and old configurations would answer different questions. Check whether the existing ZMQRuntime endpoint can carry this distinction before creating any new wrapper. The new-case test is a viewer reachable by an explicit remote host: connection host can vary without accidentally opening an all-interfaces listener when the viewer is started locally. A second falsifier is reused externally managed viewer state, which should not be killed/rebound just to honor a local setting.

## Implementation and proof gates before promotion from draft

1. Trace the pinned ZMQRuntime `StreamingVisualizerServer` bind and control-port policy, launcher argument serialization, Napari and Fiji lifecycles, and all other `host="*"` viewer sites. Obtain a complete contextual NRA scan and source class census if prescribing a broader owner move; log scan mode, coverage and raw record exclusions. The completed *runtime-subpackage* census/overlay is not that scan.
2. Choose/document default listen policy and explicit opt-in for remote binding with the owner if current configuration does not establish it. External ZMQ/OS socket semantics are authoritative contracts; no blanket compatibility ban may remove remote support.
3. On a real, fresh TCP viewer, assert both data and control listeners are loopback-bound for a loopback request; test an explicit remote-bind route and connection/reporting consistency. Exercise IPC, external-viewer reuse and failure cleanup. A mock asserting only constructor arguments is insufficient.
4. Gate completion on observed socket listeners and behavioral tests at the pushed SHA; review crossings with drafts #153/#154 and any Fiji equivalent. No code migration or CLI behavior is certified by this planning PR.
25 changes: 25 additions & 0 deletions docs/plans/open_issue_surface_index_20260929.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Open issue surfaces: first planning cut

**Source baseline:** `OpenHCSDev/openhcs` `main` at `0c7b898f852a8bedc0e1bc38b93f36088d301808` (2026-09-29). This is a triage index, not an architecture audit or permission to rewrite. The source checkout is an isolated worktree; the primary checkout is dirty and was not edited. Open PRs #153–#157, #151, #125 and #110 were inventoried before this cut.

## Evidence and limits

The Python 3.14.2 refactor-audit scripts parsed `openhcs/runtime`: 18,078 code lines, census headline 3.1 per 1,000 lines; overlay reported five `isinstance_switch`, three `raw_shape`, three `god_class`, nine `god_function` and 27 *heuristic* `dead_module` leads. These package-level counts are **not** evidence for any issue below, and entrypoints may be wrongly called dead. No complete NRA `--json --raw-findings --json-payload full` scan was completed, so there is no global detector coverage, class-first corpus or admitted `R*`. Issue reports are observations to verify at the implementation head. No migrations or DSL operations are proposed here.

| Surface | Reported problem and present evidence | Ownership question / first gate | Crossing |
|---|---|---|---|
| [#135](https://github.com/OpenHCSDev/openhcs/issues/135) managed viewer bind | `StreamingDefaults.host` is a client address; `NapariViewerServer` passes `host="*"` for both sockets. [Focused receipt](issue135_viewer_bind_receipt_20260929.md). | Distinguish requested connection host from an authorized listen interface; test real TCP socket and remote-viewer reuse before deciding topology. | Draft #154 viewer control, #153 viewer result route; Fiji's separate server also passes `"*"`. |
| [#140](https://github.com/OpenHCSDev/openhcs/issues/140) execution terminality | The [independent investigation receipt in draft PR #160](https://github.com/OpenHCSDev/openhcs/pull/160) is not part of this branch. Pinned ZMQRuntime already has FAILED transitions and waiter handling; failure mechanism is OPEN. | Reproduce matching execution ID and inspect status/transport after fault, then name the broken owner. | #157 edits OpenHCS server and result path; pinned external/ZMQRuntime is a separate repository. |
| [#133](https://github.com/OpenHCSDev/openhcs/issues/133) measurement subject | Issue reports inspection/compile acceptance followed by runtime `_declared_subject` rejection. Source trace not yet performed. | Determine which artifact declaration establishes subject relation; require one compile/inspection validation at the correct phase, retain runtime integrity guard as appropriate. | #153 result inspection, #157 runtime export. |
| [#132](https://github.com/OpenHCSDev/openhcs/issues/132) Bio-Formats and ROI cost | Issue reports 16 CZI containers opened for one-axis work; comment establishes ZIP contour fragments are not biological objects. Source trace not yet performed. | Separate source-discovery filtering from label→contour→ZIP projection. Profile and preserve parent label/geometry identity before optimizing either. | Materialization #156 and result review #153; no proof these PRs touch the same code. |
| [#138](https://github.com/OpenHCSDev/openhcs/issues/138) native benchmark bootstrap | Issue reports absent pinned headless CellProfiler 4.2.8.1 / Python 3.9 / JDK 11 bootstrap. Source trace not yet performed. | A reproducible oracle environment receipt is distinct from an OpenHCS result; specify build constraints and a JVM/Pipeline acceptance check. | #155 consumes fresh native baselines but does not supply installation bootstrap. |
| [#131](https://github.com/OpenHCSDev/openhcs/issues/131) suspected MCP retention | Issue has a one-time memory snapshot, no growth slope or clean baseline. Source trace not yet performed. | Isolate MCP requests, import/native footprint, caches, separate execution server and host tmpfs swap before attributing retained memory. | MCP operation/benchmark work; do not delete other users' temporary files. |

## Order and coordination

1. Investigate #135's exposed TCP bind and #140's reported unbounded waiter in disjoint worktrees. Both have draft planning PRs, **not fixes**. Preserve actual external transport semantics and reject unsupported claims of equivalence.
2. Trace #133's compile/runtime declaration and #138's benchmark bootstrap independently; do not let #155's reproducibility figures substitute for environment creation.
3. Profile #132's two stages separately. Investigate #131 only with a clean, bounded process baseline, never as a presumed leak.
4. Write a fresh, scoped receipt at dispatch for each remaining surface against that day's main and overlapping PR heads. Run complete contextual NRA analysis where an ownership claim needs it; record `scan_status`, omissions, raw records and OPEN edges. If resource limits prevent it, keep design provisional, do not call the scan complete.

No common new abstraction has yet been justified by multiple verified surfaces. Existing transport endpoints, artifact declarations, viewer lifecycle and status records are *candidates to inspect*, not licenses to create a parallel registry or an all-purpose base class. Each surface owner owns its own PR/worktree and coordinates file crossings directly. Tests protect observable bind, failure, subject, fidelity or benchmark behavior, not an imagined class layout; existing external protocol contracts remain binding.
Loading
Loading