RFC-0033: Seams and standards, one register of the contracts between the lab's parts¶
Status: Accepted (the operator, 2026-12-02): every gap of section 5 is to be built now, on
branch seams, to merge when baseline-a ends; open question 1 as recommended (the profile's layer
entry), 2 as recommended (the navigator API's schema), 3 as recommended (the two SE2 implementations
stay) and 4 as recommended (one RPC client in runfile, after gap 1). Built on the branch and
merged into main 2026-12-02: section 3.2, the error table (runfile.jsonrpc); section 4, the
shared names (runfile.navcontract); the navigator API's schema (open question 2); gap 1 as
RFC-0028; gaps 2 to 6; and the one JSON-RPC client (open question 4, runfile.jsonrpc.Client).
Date: 2026-12-02
Builds on: RFC-0003 (JSON-RPC for every robot),
RFC-0017 (the gate protocol), RFC-0018
§5.2-5.3 (the four contracts, versioning), RFC-0022 (the
layout), ADR-0001 (ROS-aligned names),
ADR-0007 (run format 2),
ADR-0027 (a simulator is a host kind).
Asked by the operator, 2026-12-02: "would like to define better seams and standards between
components", then "yes, draft that RFC and fix problem you noticed".
Evidence: read at 1899390: the server loops, the clients and the definitions named below.
What I did not verify is in section 8.
1. Motivation¶
The map (How the platform fits together, "The map") names eight seams on its edges. RFC-0018 §5.2 says four contracts hold the platform and "nothing else may cross a project line". Today sixteen cross one (section 2). Five of them carry a version. What the inventory found:
- Errors differed per server. The navigator API answered every error with
id: null. The duck's payload andstraight.pyanswered-32000for everything, including an unknown method, and dropped a line that was not JSON without a reply. The camera socket reported anyKeyErrorinside a method as "no method". Two clients (labrunner.rpc,duck_lab.nav.client) wait for their own id and skip every other line. Against anid: nullerror they waited out their socket timeout. Measured before the fix: 10.01 s, the whole timeout (libs/runner/tests/test_rpc_replies.py). Mission Control's client (duck.py:253) reads one line whatever its id and was not affected. - Names were defined three times. The guardrail names were in
missions.guardrails,labrunner.guard.TRUTHandduck_lab.nav.guardrails.SUPPORTED. The goal kinds were inmissions.goals.KINDSandduck_lab.nav.server.GOAL_KINDS. They agreed, but nothing held them equal. - The host kind leaks into the runner. The scene writer,
labrunner/scene.py:118mjcf, writes MuJoCo XML from Pollen'sscene_backlash.xml. A second simulator (Gazebo, MVP 2) would have to edit the runner. - The gate names one robot's methods.
robotgate/__init__.py:27-28OPEN_METHODSlists Pollen's reads (robot.modelApi,robot.vetbook,pad.status, ...). - A learned model is identified but never checked.
learned.py:240computes the model's sha256 and:276records it. Nothing declares the value the model should have, and nothing compares the two. ADR-0028 decided that loading refuses a mismatch (decisions 2 and 3); its "Built" section lists the robot-and-layer check as not built. helloanswers two shapes. Through the gate,hello {client}answers the gate'sprotocol. On a navigator,helloanswers{name, version, contract, kinds, camera}. Mission Control calls both (duck.py:70and:264).- RFC-0018 §5.2 is stale. It lists four contracts and a
viewer/CONTRACT.mdthat is nowapps/observatory/CONTRACT.md, and it marks the gate "proposed, not built".
2. The register¶
One row per seam. A seam is whatever crosses between two parts that ship or run apart. "Shape" means a machine-readable description of the messages. "Test" means one that runs both sides.
| # | Seam | Between | Owner | Version | Shape | Test |
|---|---|---|---|---|---|---|
| 1 | Navigator API | runner, Mission Control ↔ navigator | libs/runner/CONTRACT.md, runfile.navcontract |
contract 1.9 | libs/runfile/src/runfile/schemas/navigator-api-1.9.json (JSON Schema, built by runfile.navschema) |
robots/duck/tests/test_contract.py (both duck navigators, every request and reply validated), test_navschema.py (the file is what the builder writes) |
| 2 | Payload | navigator API ↔ payload | same, PAYLOAD_METHODS |
contract 1.9 | the same file: the payload's methods are in it | test_contract.py, test_payload_replies.py |
| 3 | Gate | every client ↔ a robot | libs/gate (RFC-0017); a robot's reads in its profile's control.open_methods |
protocol 1 | none | test_gate.py, test_gate_proxy.py |
| 4 | Robot socket | gate ↔ Pollen's robotd | Pollen | robotd's own (v60 named in robotgate) |
none | none of ours |
| 5 | Host kind | runner ↔ a simulator | libs/simhost (RFC-0028, built) |
none | none | test_simhost.py |
| 6 | Truth reader | runner ↔ the simulator's body server | simhost.truth |
none | none | (to verify) |
| 7 | Camera socket | navigator ↔ the runner's camera | labrunner/camera.py |
hello contract 1 (CAMERA_CONTRACT) |
none | test_camera_server.py |
| 8 | Run format | every writer ↔ the Observatory | ADR-0007, apps/observatory/CONTRACT.md |
format 2 | runfile/schemas.py (JSON Schema) |
the Observatory's tests |
| 9 | Observatory API | pages, agents ↔ Observatory | apps/observatory/CONTRACT.md |
API 2 | none | test_server.py (to verify) |
| 10 | Mission Control API | people, agents ↔ Mission Control | apps/mission-control/CONTRACT.md |
API 1 | none | test_api.py (against a running server) |
| 11 | Missions | Mission Control ↔ missions |
a Python import | none | n/a | test_vocabulary.py (new) |
| 12 | Scene file | scenes ↔ runner, simulators | runfile.scenefile |
scene_version 1 (absent is 1) |
none | test_scenefile.py, test_versions.py |
| 13 | ticks.jsonl |
navigator ↔ runner, Observatory | the duck's navigator | ticks_version 1 on the first line (absent is 1) |
none | test_versions.py (the reader's side) |
| 14 | Learned model | training ↔ the learned layer | learned.py, duck-model |
the declared robot and layer | ONNX in/out shape | test_model_check.py |
| 15 | NXT | Mission Control ↔ the NXT | JSON-RPC through the gate (nxt-web nxt_lab/gate.py, mission_control/nxt.py) |
hello protocol 1 |
none | test_gate_socket.py, test_nxt_adapter.py |
| 16 | Profile | the robot file ↔ every part | runfile profile |
profile_version 1 and checksum |
schema rules | test_profile_schema.py |
3. Standards¶
3.1 Transport¶
JSON-RPC 2.0, one JSON object per line, on every socket between our parts (RFC-0003). HTTP is used only where a browser is the client (the two APIs). The NXT was the one exception; it is built now (section 5, gap 4). Records are MCAP in run format 2. Names follow ADR-0001.
3.2 Errors (built)¶
runfile.jsonrpc holds one table and one answer(line, call) that every server uses. The servers
are the navigator API in front of Mission Control, the duck's navigator API, the payload,
straight.py and the camera socket.
| Code | When | id |
|---|---|---|
| -32700 | the line is not JSON | null (it cannot be read) |
| -32600 | JSON, but not an object, no method, or params that are not an object |
the request's, when it has one |
| -32601 | no such method (UnknownMethod, a KeyError) |
the request's |
| -32603 | the method raised: a bug, or a failure it did not mean to report | the request's |
| -32000 | the server's own refusal, its reason in data (the gate's lease codes) |
the request's |
A refusal a method means to make, such as start_failed or held, stays in the result or in
-32000 with data. It is never an exception. Every reply echoes the request's id. Params that
are not an object are -32600 as well.
The review of the merge found two gates that did not follow the table. The lease proxy
(labrunner/gate.py) answered a request with no method with -32700 and id null, and nxt-web's
gate answered non-object params with -32603. Both now read a line with
runfile.jsonrpc.read_request, which answer uses too.
3.3 Hello¶
Every socket answers hello with {name, version} and the number of the contract it speaks.
The gate's field is protocol and a navigator's is contract. Both names stay, because clients
read them today. A client tells which seam it reached by the field. The camera socket and the
host kind get a hello when they get a version (section 5, gap 3).
3.4 Versions¶
RFC-0018 §5.3 stands. A minor version only adds. A reader accepts its own major version and
refuses another with a message. Every row of the register carries a number: a socket's at
hello, a file's in its first line or a top-level field.
3.5 Shapes and tests¶
Each seam gets one machine-readable shape: JSON Schema for each method's params and result, kept
by the owner. The navigator API comes first, because it is the most crossed (built, question 2).
Each seam gets one test that runs the real client against the real server, as test_contract.py
and test_rpc_replies.py do. A test that mocks one side does not count.
4. One vocabulary (built)¶
runfile.navcontract holds GOAL_KINDS, GUARDRAILS and TRUTH_GUARDRAILS.
labrunner.guard.TRUTH, duck_lab.nav.guardrails.SUPPORTED and
duck_lab.nav.server.GOAL_KINDS import them. missions is standard library only by design, so
it keeps its own copies; apps/mission-control/tests/test_vocabulary.py holds them equal.
test_contract.py holds the payload's kinds and the navigator's and robot side's guardrails
inside the contract's names.
Not merged, on purpose:
- Two SE2 implementations.
labrunner/frames.pywraps yaw andrunfile.se2does not; merging them changes numbers (open question 3). - Three RPC clients. These are
labrunner.rpc,duck_lab.nav.clientandstraight.py's. RFC-0022 kept them apart so a robot's package does not import the runner. One client inrunfileis open question 4.
5. Gaps, in order¶
- The host kind contract (RFC-0028, reserved by
docs/wip/NXT-D0.md). The scene writer and the contact source go behind the kind, and the runner asks the kind for a scene file and for contacts. This comes first because Gazebo is MVP 2's simulator and the third kind should need no runner change. - The model check ADR-0028 decided (built). A model declares its robot and layer, in its
metadata or a sidecar
duck-model declarewrites, with the file's sha256. The profile names the one model a run may load:plugins.local_controllerlearned@<sha8>besidemodels.local_controller.sha256(open question 1). Loading refuses another file, another robot or another layer, and a real profile cannot name a learned controller (ADR-0028 decisions 2, 3 and 6). A model named by no profile still loads in the simulator, its sha256 recorded. - Versions on the unversioned seams (built). The camera socket answers
hellowith its contract.scene.jsoncarriesscene_version, outside its checksum.ticks.jsonlcarriesticks_versionon its first line, the calibration event, instead of a separate header line. A file without one is version 1; a reader refuses another version, naming it. - The NXT seam (built). JSON-RPC through the gate, as RFC-0003 agreed: nxt-web serves it on a socket beside its HTTP page, Mission Control calls it, and one lock fronts both. The alternative, a version on the HTTP API, was not taken.
- The gate's robot-specific names (built). The gate passes the lab's own reads
(
robot.state,robot.health) and the robot's, which its profile lists incontrol.open_methods.lab-gatereads them from the robot's own profile, never a tuned version in the store: they are the robot's interface, shipped with its code. - RFC-0018 §5.2 (built) points to this register; its own table is kept as its first cut.
6. Open questions (answered 2026-12-02: all as recommended)¶
- Where does a model's expected sha256 live: the profile's layer entry, the sidecar, or the
record of the training run (RFC-0031)? ADR-0028 says a model is named by its SHA-256 but not
where the name is written. Recommended: the profile's layer entry, which today reads
"local_controller": "rules@1"(robots/duck/profile.json:241). A learned entry would readlearned@<sha8>, the build identity's form (plugins/interfaces.py:141), with the full sha256 beside it. The profile is what a run records and what the operator versions, so a changed model would show as a changed profile. - Is JSON Schema per method worth its upkeep before a second implementer of the navigator API
exists? Recommended: yes for the navigator API only, generated into
runfilenext tonavcontract. Built (2026-12-02):runfile.navschemawritesschemas/navigator-api-1.9.json, one document with a$defsentry per method's params and result;make navigator-schemarewrites it,make test-libsfails while it differs, andtest_contract.pyvalidates both duck navigators against it. - Should
runfile.se2wrap yaw? It would change recorded numbers. Recommended: no change until a run shows a difference. - One RPC client in
runfile? Recommended: yes, after gap 1, when the host kind needs one too.
7. Alternatives considered¶
- Protobuf or gRPC on every seam. It gives typed, generated code. It also means a new dependency, every client rewritten, and grpc-web for the browsers. No.
- ROS 2 topics and services on every seam. Gazebo speaks ROS 2 (Jazzy), but this would tie the duck, which has no ROS, to a ROS install. ROS stays inside the Gazebo host kind.
- JSON Schema on every seam at once. The cost comes before any value. Start with the seam most crossed.
- Leave it as it is. The two problems were real: names defined three times and four error
conventions. With an
id: nullerror, the runner's client waited out its whole timeout.
8. Not verified¶
- The "(to verify)" cells: whether a test runs both sides of the truth reader,
ticks.jsonl, the Observatory API and the NXT. - Whether an
id: nullerror ever made a real run wait out the timeout. The test shows that it can; I did not search the run logs. - Pollen's robotd version beyond the
v60named inrobotgate. - How a learned controller is chosen today (a command-line option or the profile); open question 1 assumes the profile.
- Who reads
ticks.jsonlbesidesrunfile/adapters/duck.py,labrunner/explore.pyandlabrunner/rooms.py.
Discussion¶
- 2026-12-02: drafted at the operator's ask. Sections 3.2 and 4 are built on branch
seamswith their tests (test_jsonrpc.py,test_rpc_replies.py,test_payload_replies.py,test_vocabulary.py, and an id check intest_nav_server.py). They merge after baseline-a, so the running baseline's code does not change under it. - 2026-12-02: accepted by the operator, who asked for every gap now: "why not do everything? that seems like where we want to be". The four open questions as recommended.