Conformance
What s2-kit implements of S2 JSON and S2 Connect, generated from the crate itself: the message catalogue, the state table, the wire profiles, and what is explicitly not claimed.
This page is generated from the crate itself, so it cannot disagree with the code.
Generated by cargo xtask gen-conformance from the crate itself — do not edit.
Each table is read out of the code, so a claim here is a claim the compiler is holding up. What is not claimed is listed at the end.
Messages
All 36 messages of S2 JSON v1.0.0 are modelled, validated and routed.
| Message | Control type | Sender | Instruction | v1.0.0 | v0.0.2-beta |
|---|---|---|---|---|---|
Handshake | — | either | — | yes | yes |
HandshakeResponse | — | CEM | — | yes | yes |
ResourceManagerDetails | — | RM | — | yes | yes |
SelectControlType | — | CEM | — | yes | yes |
SessionRequest | — | either | — | yes | yes |
ReceptionStatus | — | either | — | yes | yes |
InstructionStatusUpdate | — | RM | — | yes | yes |
PowerMeasurement | — | RM | — | yes | yes |
PowerForecast | — | RM | — | yes | yes |
RevokeObject | — | either | — | yes | yes |
PEBC.PowerConstraints | PowerEnvelopeBasedControl | RM | — | yes | yes |
PEBC.EnergyConstraint | PowerEnvelopeBasedControl | RM | — | yes | yes |
PEBC.Instruction | PowerEnvelopeBasedControl | CEM | yes | yes | yes |
PPBC.PowerProfileDefinition | PowerProfileBasedControl | RM | — | yes | yes |
PPBC.PowerProfileStatus | PowerProfileBasedControl | RM | — | yes | yes |
PPBC.ScheduleInstruction | PowerProfileBasedControl | CEM | yes | yes | yes |
PPBC.StartInterruptionInstruction | PowerProfileBasedControl | CEM | yes | yes | yes |
PPBC.EndInterruptionInstruction | PowerProfileBasedControl | CEM | yes | yes | yes |
OMBC.SystemDescription | OperationModeBasedControl | RM | — | yes | yes |
OMBC.Status | OperationModeBasedControl | RM | — | yes | yes |
OMBC.TimerStatus | OperationModeBasedControl | RM | — | yes | yes |
OMBC.Instruction | OperationModeBasedControl | CEM | yes | yes | yes |
FRBC.SystemDescription | FillRateBasedControl | RM | — | yes | yes |
FRBC.StorageStatus | FillRateBasedControl | RM | — | yes | yes |
FRBC.ActuatorStatus | FillRateBasedControl | RM | — | yes | yes |
FRBC.TimerStatus | FillRateBasedControl | RM | — | yes | yes |
FRBC.LeakageBehaviour | FillRateBasedControl | RM | — | yes | yes |
FRBC.UsageForecast | FillRateBasedControl | RM | — | yes | yes |
FRBC.FillLevelTargetProfile | FillRateBasedControl | RM | — | yes | yes |
FRBC.Instruction | FillRateBasedControl | CEM | yes | yes | yes |
DDBC.SystemDescription | DemandDrivenBasedControl | RM | — | yes | yes |
DDBC.ActuatorStatus | DemandDrivenBasedControl | RM | — | yes | yes |
DDBC.TimerStatus | DemandDrivenBasedControl | RM | — | yes | yes |
DDBC.AverageDemandRateForecast | DemandDrivenBasedControl | RM | — | yes | yes |
DDBC.PresentDemandStatus | DemandDrivenBasedControl | RM | — | yes | — |
DDBC.Instruction | DemandDrivenBasedControl | CEM | yes | yes | yes |
State of communication
S2C §State of communication as this crate enforces it: what each side may send in each state. Both engines refuse an outbound message outside this table at the call site, and answer an inbound one with INVALID_CONTENT.
The first row is not in the standard’s own table, which starts at WebSocket Connected because S2 Connect settles the version before the socket opens. A bare WebSocket session has one row before that: until the Handshake has completed, neither side knows which schema the next message is to be read against.
| State | CEM may send | RM may send |
|---|---|---|
| negotiating | Handshake, HandshakeResponse, SessionRequest, ReceptionStatus | Handshake, SessionRequest, ReceptionStatus |
| connected | Handshake, HandshakeResponse, SelectControlType, SessionRequest, ReceptionStatus | Handshake, ResourceManagerDetails, SessionRequest, ReceptionStatus, PowerMeasurement, PowerForecast |
| PowerEnvelopeBasedControl | SelectControlType, SessionRequest, ReceptionStatus, RevokeObject, PEBC.Instruction | ResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, PEBC.PowerConstraints, PEBC.EnergyConstraint |
| PowerProfileBasedControl | SelectControlType, SessionRequest, ReceptionStatus, RevokeObject, PPBC.ScheduleInstruction, PPBC.StartInterruptionInstruction, PPBC.EndInterruptionInstruction | ResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, PPBC.PowerProfileDefinition, PPBC.PowerProfileStatus |
| OperationModeBasedControl | SelectControlType, SessionRequest, ReceptionStatus, RevokeObject, OMBC.Instruction | ResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, OMBC.SystemDescription, OMBC.Status, OMBC.TimerStatus |
| FillRateBasedControl | SelectControlType, SessionRequest, ReceptionStatus, RevokeObject, FRBC.Instruction | ResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, FRBC.SystemDescription, FRBC.StorageStatus, FRBC.ActuatorStatus, FRBC.TimerStatus, FRBC.LeakageBehaviour, FRBC.UsageForecast, FRBC.FillLevelTargetProfile |
| DemandDrivenBasedControl | SelectControlType, SessionRequest, ReceptionStatus, RevokeObject, DDBC.Instruction | ResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, DDBC.SystemDescription, DDBC.ActuatorStatus, DDBC.TimerStatus, DDBC.AverageDemandRateForecast, DDBC.PresentDemandStatus |
| NotControllable | Handshake, HandshakeResponse, SelectControlType, SessionRequest, ReceptionStatus | Handshake, ResourceManagerDetails, SessionRequest, ReceptionStatus, PowerMeasurement, PowerForecast |
| NoSelection | Handshake, HandshakeResponse, SelectControlType, SessionRequest, ReceptionStatus | Handshake, ResourceManagerDetails, SessionRequest, ReceptionStatus, PowerMeasurement, PowerForecast |
Semantic validation
65 rules — 45 errors, 20 warnings — each quoting the sentence it implements. The full catalogue is in the rule reference; every one of them has a test that fires it.
33 of them need session context — a rule that compares a message against what the peer said earlier cannot fire on a message read from a file.
Wire profiles
| Profile | Protocol version string | Messages |
|---|---|---|
V1_0_0 | 1.0.0 | 36 |
V0_0_2Beta | 0.0.2-beta | 35 |
Only in v1.0.0: DDBC.PresentDemandStatus.
Only in v0.0.2-beta: —.
S2 Connect
Discovery, pairing, session initiation and the transport are implemented for both sides. tests/connect_e2e.rs pairs this crate’s client against this crate’s server over a real TLS connection, which exercises the one thing an in-memory test cannot: the leaf-certificate fingerprint the challenge response binds to comes out of a genuine handshake.
| Part | State |
|---|---|
| Pairing, both sides, with the per-node rate limit and the mandatory delay | yes |
| Session initiation, both sides, with the two-phase token commit | yes |
| LAN trust: unverified during pairing, CA-pinned afterwards | yes |
DNS-SD advertise and browse, _cem / _rm subtypes | yes |
LAN-only operations: /endpoint, /nodes, /preparePairing, /cancelPreparePairing | yes |
| The same-subnet check those operations require, v4 and v6 | yes |
Long-polling (/waitForPairing), both halves: the client holds a request open, the server wakes it | yes |
| WAN endpoint registry | no |
Interoperability
Two kinds, because they find different things.
At the wire. The official s2energy crate is a dev-dependency, and every one of the 35 messages of 0.0.2-beta — with every optional field set — is encoded here, re-encoded through its model and read back. Two results worth stating plainly: the official crate refuses 25 of the 43 messages in the standard’s own published walkthroughs because it models ID as a UUID, and it speaks only 0.0.2-beta — it requires the field v1.0.0 removed and has no variant for the message v1.0.0 added. This crate reads all 43 and speaks both.
That is also the limit of the exercise. No other implementation implements v1.0.0, so the two messages the tags disagree about have no second reading to be checked against; what they are checked against is the official JSON schema, which is the only other authority that exists for them.
As a conversation. cargo xtask interop runs this crate’s CEM against implementations nobody here wrote, over a real WebSocket. Each row records what that peer does today, so the job fails only when this crate regresses or a peer is fixed upstream.
| Peer | Control type | Outcome |
|---|---|---|
s2-example-implementations/battery | FRBC | peer defect, caught by S2-INST-002 |
s2-example-implementations/pv-installation | PEBC | peer defect, caught by S2-NUM-002 |
s2-example-implementations/pv-installation | NOT_CONTROLABLE | clean |
The peer defects are described in the project’s interop notes; in each case the schema is unambiguous. A matrix that only ever agreed would be the one to distrust.
Not claimed
- Interoperability beyond the matrix below.
cargo xtask interopruns this crate’s CEM against the FlexiblePower example Resource Managers over a real socket. It does not yet reachs2-python,cem-reference-1ors2-analyzerin the middle, it runs one role and one wire profile, and its peers speak bare WebSocket — so it says nothing at all about S2 Connect against another implementation. Pairing this crate against itself proves self-consistency, which is not the same thing. - Certification. There is no S2 certification programme, and this document is not one.
- Deciding whether you are a LAN or a WAN endpoint.
routerserves only the authenticated operations, so a WAN endpoint answers404on the rest, asS2Crecommends.lan_routeradds them and requiresLocalSubnets, so the unauthenticated operations cannot be exposed without their access control. Which one you mount is yours to choose; forgetting the subnet check is not.