Part of #50 (device-layer refactor). Do this first — no behavior change, unblocks every reader of the /api/* surface.
Problem
The device-layer HTTP contract (/api/microscope/execute, /api/devices/stream,
/api/detect_embryos, /api/status, …) is defined only implicitly inside the diSPIM
plugin and re-parsed by hand in three places:
gently/hardware/dispim/client.py
gently/app/device_state_monitor.py
gently/harness/microscope.py
Client and server agree only by convention, so a field rename silently breaks a
consumer.
Goal
Pin the wire contract in one shared schema/dataclass module (request/response
payloads for each /api/* endpoint, plus the SSE event shapes) that both server and
all clients import, so they agree by construction.
Scope
- New module (e.g.
gently/harness/wire.py or core/) with dataclasses for each
endpoint's request/response + stream event.
- Server (
device_layer.py handlers) and the three consumers above serialize/parse
through it.
- Pure refactor: no endpoint added/removed, no behavior change. diSPIM stays byte-for-byte
compatible on the wire.
Why first
This is the seam #2 depends on — BaseDeviceLayer should speak the shared contract, not
redefine it.
Part of #50 (device-layer refactor). Do this first — no behavior change, unblocks every reader of the
/api/*surface.Problem
The device-layer HTTP contract (
/api/microscope/execute,/api/devices/stream,/api/detect_embryos,/api/status, …) is defined only implicitly inside the diSPIMplugin and re-parsed by hand in three places:
gently/hardware/dispim/client.pygently/app/device_state_monitor.pygently/harness/microscope.pyClient and server agree only by convention, so a field rename silently breaks a
consumer.
Goal
Pin the wire contract in one shared schema/dataclass module (request/response
payloads for each
/api/*endpoint, plus the SSE event shapes) that both server andall clients import, so they agree by construction.
Scope
gently/harness/wire.pyorcore/) with dataclasses for eachendpoint's request/response + stream event.
device_layer.pyhandlers) and the three consumers above serialize/parsethrough it.
compatible on the wire.
Why first
This is the seam #2 depends on —
BaseDeviceLayershould speak the shared contract, notredefine it.