You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
client can only send but not receive; server is the converse
re. client<->server communication:
Rocq process is run on the client, but server is actually "driving" the interaction
client:
initiates a connection with the (downstream/private) server via (?) a setup request
replays rocq actions based on server actions, forwarding results to the server
b) the server drives the interaction the
==>rocq-pipeline/.../microrpc/duplex.py was added to bridge this gap
wire proto. <-> deserialization
microrpc/ defines custom (de)serializers, but:
risk: leakage of private / internal data; no logic (in main or this PR) that controls what gets (de)serialized in different contexts; examples:
tracebacks from server that might contain private internals
configs from clients/server that might contain env variables
...
does not utilize "full" json interfaces (i.e. only adding a slim JSONEncoder, but not matching JSONDecoder interface
does not uniformly handle nested types:
special casing for certain types at the top-level of serialization (rdm_api.Err, rdm_api.Resp`)
instead of forcing clients to request deserialization at a particular type (based on client<->server proto), it uses type-tags in a non-uniform way to support deserialization
special casing for exception types (which can be removed)
dataclasses vs. BaseModel
currently: a lot of special case logic to deal with the few dataclasses we currently have, but which could/should become BaseModels
dataclasses should (almost always) be prohibited from use at deserialization time since they don't have validators
Background
Note: more triage required.
Currently:
rocq-pipeline/.../microrpc/tunnel.py:WsMux+WsServerrocq-pipeline/.../microrpc/duplex.pywas added to bridge this gapmicrorpc/defines custom (de)serializers, but:jsoninterfaces (i.e. only adding a slimJSONEncoder, but not matchingJSONDecoderinterfacerdm_api.Err, rdm_api.Resp`)dataclassesvs.BaseModelBaseModelsdataclassesshould (almost always) be prohibited from use at deserialization time since they don't have validatorsRelated GH PRs
microrpcby moving to a JsonRPC based approachtunnel.pyduplex.py: unifies the client/server sides into a single interfaceBaseModelforErr+Resptypes #282 (+ downstream PR)BaseModelTechnical Notes
microrpc/is meant to be generic (at least with Gregory's PR)ocaml-jsonrpc-tpauto-generates the RDM methods/types, so we could also try to autogenerate schemas for the args/retval of methodsrocq-agent-toolkit-utilswould be a good place to upstream/centralize many of the common utilities related to:Open Design Questions
Discussion
protocol.pyfile from Gregory's PR):BaseModels that codify the protocolGoal
Technical Details
failure_reasons #186dataclasses(cf. refactor(ocaml-jsonrpc-tp/python): use pydanticBaseModelforErr+Resptypes #282)atdpyto generatetask_output.py& write it by hand usingBaseModelsjsonmodule (de)serialization interfaces (note: preferrocq_agent_toolkit_utils/.../json.pypydanticserialization & validation