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
8 changes: 4 additions & 4 deletions docs/audits/architecture_n_z_development.json
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@
},
{
"path": "openhcs/agent/dto/execution.py",
"sha256": "9cabb87dec2c865d2fddd3babe298b200e2830ae6dd0bfe5a26afa8b8ad9bf1c",
"sha256": "1fbdc008937e3a043cf077e2243b40f6a0efba34d9166716c423af9b85445684",
"role": "Declares the typed public job status and delegates terminal semantics to the generic lifecycle declaration."
},
{
Expand Down Expand Up @@ -2612,7 +2612,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns nominal gallery scenario identity, publication targets, representative images, copy, accessibility text, dimensions, contextual and stable-window capture targets, and derivative contracts."
},
{
Expand Down Expand Up @@ -2869,7 +2869,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the nominal gallery scenario lattice, stable-window and contextual capture targets, publication targets, derivative inventory, source evidence, card rendering, and generated release record."
},
{
Expand Down Expand Up @@ -3027,7 +3027,7 @@
},
{
"path": "openhcs/agent/dto/execution.py",
"sha256": "9cabb87dec2c865d2fddd3babe298b200e2830ae6dd0bfe5a26afa8b8ad9bf1c",
"sha256": "1fbdc008937e3a043cf077e2243b40f6a0efba34d9166716c423af9b85445684",
"role": "Declares the public typed execution status and progress observation result."
},
{
Expand Down
25 changes: 25 additions & 0 deletions docs/audits/gallery_connection_owner_review_20260924.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Gallery connection declaration owner review (2026-09-24)

The shared `ExecutionConnectionSpec` declaration moved unchanged from
`openhcs/agent/dto/execution.py` into
`openhcs/agent/dto/execution_connection.py`. The former module re-exports the
same class for existing clients. `scripts/gallery_catalog.py` now imports the
lightweight owner at runtime, so its `GallerySourceCaptureRequest` annotation
is resolvable by `typing.get_type_hints` and `dataclass_from_mapping` without
loading the heavy execution DTO graph or pandas during website validation.

This is an import/ownership change, not a gallery scenario, capture target,
connection field, protocol, job-status, or progress-projection change. The
existing audited user and development pages that cite `scripts/gallery_catalog.py`
retain their scenario and publication claims. The two pages citing
`openhcs/agent/dto/execution.py` for job/progress DTOs retain those claims;
the moved connection declaration was not the authority for those claims.

Validation: the focused gallery request round-trip test passed; a fresh import
of the catalog left `pandas` unloaded and `get_type_hints` resolved the
connection type. The gallery and website unit group passed (63 tests), and
documentation validation passed (155 audited sources). The agent-service group
passed 106 tests; its one function-catalog preparation test initially hit an
`EDQUOT` disk-quota error in a subprocess, then passed when `TMPDIR` was placed
on the analysis drive (107 tests passing across the two runs). Full CI remains
the publication gate.
22 changes: 11 additions & 11 deletions docs/audits/user_docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the documentation-enabled Function Selector capture declaration, accessibility text, capture target, and generated visual projection."
},
{
Expand Down Expand Up @@ -1349,7 +1349,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the documentation-enabled global, pipeline, step, and nested function configuration capture declarations, accessibility text, capture targets, and generated visual projections."
}
],
Expand Down Expand Up @@ -1557,7 +1557,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the documentation-enabled source-image browser capture, caption, accessibility text, dimensions, and source evidence."
},
{
Expand Down Expand Up @@ -1808,7 +1808,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the documentation-enabled synthetic generator, plate metadata, and live measurement result capture declarations used by the first-workflow tutorial."
}
],
Expand Down Expand Up @@ -2832,7 +2832,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the landing-page workspace scenario, representative image, caption, description, alt text, dimensions, and release evidence."
}
],
Expand Down Expand Up @@ -3219,7 +3219,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Projects every registered stable-window identity into its documentation scenario, capture target, filename, and accessibility text."
},
{
Expand Down Expand Up @@ -3396,7 +3396,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the lazy-inheritance scenario, representative poster, caption, description, alt text, dimensions, and release evidence."
},
{
Expand Down Expand Up @@ -3594,7 +3594,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the documentation-enabled Custom Function Manager capture declaration, accessibility text, capture target, and generated visual projection."
},
{
Expand Down Expand Up @@ -3922,7 +3922,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the documentation-enabled execution-log capture, caption, accessibility text, dimensions, and source evidence."
}
],
Expand Down Expand Up @@ -3994,7 +3994,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the local-MCP endpoint-startup scenario, representative poster, caption, description, alt text, dimensions, and release evidence."
},
{
Expand Down Expand Up @@ -4142,7 +4142,7 @@
},
{
"path": "scripts/gallery_catalog.py",
"sha256": "bda42a36c1c510af7ac587dc2642548758d28c4a0061d581ebe38a5be4fb3743",
"sha256": "7f493e0cb305e14ee4cf7d3e995c67df4200186a8a8aaf00eef0bc66d8d191cf",
"role": "Owns the Napari ROI-navigation and Fiji ROI-review scenarios, representative images, captions, descriptions, alt text, dimensions, and release evidence."
}
],
Expand Down
109 changes: 4 additions & 105 deletions openhcs/agent/dto/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

from abc import abstractmethod
from collections.abc import Mapping, Sequence
from dataclasses import asdict, dataclass, field, replace
from dataclasses import dataclass, field, replace
from functools import wraps
from typing import TYPE_CHECKING, Self
from typing import Self

from python_introspect import project_dataclass, validate_annotated_dataclass
from python_introspect import validate_annotated_dataclass
from zmqruntime.config import (
NonBlankString,
PositiveInteger,
SocketPort,
TransportMode,
)
from zmqruntime.execution import ExecutionProgressObservation
Expand All @@ -23,7 +22,6 @@
RunningExecutionInfo,
WorkerState,
)
from zmqruntime.transport import TransportEndpoint, resolve_transport_mode

from openhcs.agent.dto.common import (
SCHEMA_VERSION,
Expand All @@ -35,6 +33,7 @@
JsonObject,
JsonValue,
)
from openhcs.agent.dto.execution_connection import ExecutionConnectionSpec
from openhcs.agent.ui_bridge_identities import (
PlateManagerOrchestratorCodeDocumentIdentity,
)
Expand All @@ -43,109 +42,9 @@
from openhcs.runtime.zmq_config import OPENHCS_ZMQ_CONFIG
from openhcs.runtime.zmq_execution_signature import ZMQRuntimeObservationExportScope

if TYPE_CHECKING:
from openhcs.runtime.zmq_config import OpenHCSZMQConfig
from openhcs.runtime.zmq_execution_client import ZMQExecutionClient


MAX_EXECUTION_STATUS_TRACEBACK_CHARS = 3000


@dataclass(frozen=True, slots=True)
class ExecutionConnectionSpec:
host: NonBlankString = "localhost"
port: SocketPort | None = None
transport_mode: TransportMode | None = None
persistent: bool = True

def __post_init__(self) -> None:
validate_annotated_dataclass(self)

def require_port(self, purpose: str) -> int:
if self.port is None:
raise ValueError(f"{purpose} requires an explicit port.")
return self.port

def transport_mode_value(self) -> str | None:
return TransportMode.optional_to_text(self.transport_mode)

def runtime_arguments(self) -> dict[str, object]:
"""Project exact typed constructor arguments for this connection."""

return asdict(self.public_connection())

def specified_runtime_arguments(self) -> dict[str, object]:
"""Project typed constructor arguments while omitting unset optionals."""

return {
name: value
for name, value in self.runtime_arguments().items()
if value is not None
}

def tool_arguments(self) -> JsonObject:
"""Project the canonical JSON-compatible tool argument fields."""

arguments = self.runtime_arguments()
arguments["transport_mode"] = self.transport_mode_value()
return arguments

def public_connection(self) -> ExecutionConnectionSpec:
"""Return the credential-free base connection declaration."""

return project_dataclass(ExecutionConnectionSpec, self)

def zmq_data_url(self, config) -> str:
from zmqruntime.transport import get_zmq_transport_url

return get_zmq_transport_url(
self.require_port("ZMQ data URL"),
host=self.host,
mode=self.transport_mode,
config=config,
)

def zmq_control_port(self, config) -> int:
from zmqruntime.transport import get_control_port

return get_control_port(self.require_port("ZMQ control port"), config)

def zmq_control_url(self, config) -> str:
from zmqruntime.transport import get_control_url

return get_control_url(
self.require_port("ZMQ control URL"),
self.transport_mode,
host=self.host,
config=config,
)

def transport_endpoint(self) -> TransportEndpoint:
"""Project this connection declaration to its generic endpoint identity."""

return TransportEndpoint(
host=self.host,
port=self.require_port("ZMQ transport endpoint"),
transport_mode=resolve_transport_mode(self.transport_mode),
)

def execution_client(
self,
config: "OpenHCSZMQConfig",
) -> "ZMQExecutionClient":
"""Construct the OpenHCS execution client for this exact connection."""

from openhcs.runtime.zmq_execution_client import ZMQExecutionClient

return ZMQExecutionClient(
port=self.port,
host=self.host,
persistent=self.persistent,
transport_mode=self.transport_mode,
config=config,
)


@dataclass(frozen=True, kw_only=True)
class ExecutionConnectionProjection:
connection: ExecutionConnectionSpec = field(default_factory=ExecutionConnectionSpec)
Expand Down
Loading
Loading