Service JSON RPC Contracts
Service JSON RPC contracts are the shared request and response types used by login, game, control plane, control panel, and control agent flows. They are separate from realtime packets: they move control, auth, admin, coordination, status, and service-health data over HTTP JSON.
Contract Families
auth covers login and session-facing payloads. admin covers account and operational actions. coordination covers control-plane assignment, handoff, transfer, and registry calls. system covers service status, metrics, endpoints, allocation snapshots, and health payloads. internal_service names signed caller identities.
Keep new service JSON types in common-proto when more than one crate or service must understand the shape.
Version Fields And Defaults
Internal coordination request types carry version fields with current defaults. Handlers validate the version before mutating state. Future clients should fail clearly with unsupported-version errors rather than partially applying new fields.
If a request can be persisted, replayed, or sent by multiple service versions, give it an explicit version and a migration story.
Compatibility Rules
Additive optional fields are usually safe. Required field changes, enum renames, semantic default changes, and id reinterpretation are not. Keep serde defaults compatible with already deployed callers and add tests for old payloads when the contract is durable.
Route Identity Coupling
JSON contracts and route identity policy move together. A request type can be well-formed and still be rejected if the signed service identity is not allowed on that route.
Adding Fields Safely
Add the field to the shared type, choose a default, update route handlers, update client helpers, and add round-trip tests. If the field affects allocation, admin, or handoff behavior, update the relevant operation page in the wiki.
Test Checklist
Test serde defaults, unsupported future versions, unknown enum handling, route status mapping, and client helper URL construction. For admin and coordination calls, include signed identity coverage.