Skip to content

Typed commands (Command[P, T]) — positional/Any args, None/DT/Any returns #393

Description

@coretl

Scope

  • Lift the zero-arg restriction in Method/Command._validate; keep the captured inspect.Signature as the public signature.
  • Args and Returns treated separately (0015 L97): Args = [] | [DT1, DT2, …] (positional, known types). Returns = None | DT.
  • No Any middle case. A statically-declared Command always has fully-known P/T. A driver that knows nothing statically (e.g. fastcs-secop, discovered entirely from an over-the-wire describe) does not annotate a Command at all — it builds the whole structure, attributes and commands alike, at runtime. So P/T are either completely known or the whole structure is unknown; there is no in-between Command[Any, Any]. (Resolved by @Tom-Willemsen on #402; last commit of WIP: What is the current state of the refactor #402 drops the Any option from ADR 0015.)
  • No metadata ⇒ use the python type (consistent with the DataType drop, getter/setter IO rework; remove AttributeIORef and DataType #392). ControllerAPI exposes the signature; transports declare capability: EPICS CA/PVA serve void/void and skip typed commands with a warning at IOC startup (post-construction, when populated controllers are handed to transports); Tango/REST/GraphQL serve fully.
  • Keyword-arg commands are OUT of scope → handled by spike SPIKE (Opus/local): typed-command keyword-arg support via TYPE_CHECKING stub #403 (interactive/Opus).

Key files (§9)

src/fastcs/methods/ (Method/Command/Scan), transports.

Acceptance

uv run --locked tox -e pre-commit,type-checking,tests green.

ADR: 0015
Parent: #388
Blocked by: #392

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions