Skip to content

Device layer: pin the /api/* HTTP wire contract in one shared schema module #79

Description

@subindevs

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions