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.

On this page

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.

MessageControl typeSenderInstructionv1.0.0v0.0.2-beta
Handshake—either—yesyes
HandshakeResponse—CEM—yesyes
ResourceManagerDetails—RM—yesyes
SelectControlType—CEM—yesyes
SessionRequest—either—yesyes
ReceptionStatus—either—yesyes
InstructionStatusUpdate—RM—yesyes
PowerMeasurement—RM—yesyes
PowerForecast—RM—yesyes
RevokeObject—either—yesyes
PEBC.PowerConstraintsPowerEnvelopeBasedControlRM—yesyes
PEBC.EnergyConstraintPowerEnvelopeBasedControlRM—yesyes
PEBC.InstructionPowerEnvelopeBasedControlCEMyesyesyes
PPBC.PowerProfileDefinitionPowerProfileBasedControlRM—yesyes
PPBC.PowerProfileStatusPowerProfileBasedControlRM—yesyes
PPBC.ScheduleInstructionPowerProfileBasedControlCEMyesyesyes
PPBC.StartInterruptionInstructionPowerProfileBasedControlCEMyesyesyes
PPBC.EndInterruptionInstructionPowerProfileBasedControlCEMyesyesyes
OMBC.SystemDescriptionOperationModeBasedControlRM—yesyes
OMBC.StatusOperationModeBasedControlRM—yesyes
OMBC.TimerStatusOperationModeBasedControlRM—yesyes
OMBC.InstructionOperationModeBasedControlCEMyesyesyes
FRBC.SystemDescriptionFillRateBasedControlRM—yesyes
FRBC.StorageStatusFillRateBasedControlRM—yesyes
FRBC.ActuatorStatusFillRateBasedControlRM—yesyes
FRBC.TimerStatusFillRateBasedControlRM—yesyes
FRBC.LeakageBehaviourFillRateBasedControlRM—yesyes
FRBC.UsageForecastFillRateBasedControlRM—yesyes
FRBC.FillLevelTargetProfileFillRateBasedControlRM—yesyes
FRBC.InstructionFillRateBasedControlCEMyesyesyes
DDBC.SystemDescriptionDemandDrivenBasedControlRM—yesyes
DDBC.ActuatorStatusDemandDrivenBasedControlRM—yesyes
DDBC.TimerStatusDemandDrivenBasedControlRM—yesyes
DDBC.AverageDemandRateForecastDemandDrivenBasedControlRM—yesyes
DDBC.PresentDemandStatusDemandDrivenBasedControlRM—yes—
DDBC.InstructionDemandDrivenBasedControlCEMyesyesyes

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.

StateCEM may sendRM may send
negotiatingHandshake, HandshakeResponse, SessionRequest, ReceptionStatusHandshake, SessionRequest, ReceptionStatus
connectedHandshake, HandshakeResponse, SelectControlType, SessionRequest, ReceptionStatusHandshake, ResourceManagerDetails, SessionRequest, ReceptionStatus, PowerMeasurement, PowerForecast
PowerEnvelopeBasedControlSelectControlType, SessionRequest, ReceptionStatus, RevokeObject, PEBC.InstructionResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, PEBC.PowerConstraints, PEBC.EnergyConstraint
PowerProfileBasedControlSelectControlType, SessionRequest, ReceptionStatus, RevokeObject, PPBC.ScheduleInstruction, PPBC.StartInterruptionInstruction, PPBC.EndInterruptionInstructionResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, PPBC.PowerProfileDefinition, PPBC.PowerProfileStatus
OperationModeBasedControlSelectControlType, SessionRequest, ReceptionStatus, RevokeObject, OMBC.InstructionResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, OMBC.SystemDescription, OMBC.Status, OMBC.TimerStatus
FillRateBasedControlSelectControlType, SessionRequest, ReceptionStatus, RevokeObject, FRBC.InstructionResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, FRBC.SystemDescription, FRBC.StorageStatus, FRBC.ActuatorStatus, FRBC.TimerStatus, FRBC.LeakageBehaviour, FRBC.UsageForecast, FRBC.FillLevelTargetProfile
DemandDrivenBasedControlSelectControlType, SessionRequest, ReceptionStatus, RevokeObject, DDBC.InstructionResourceManagerDetails, SessionRequest, ReceptionStatus, InstructionStatusUpdate, PowerMeasurement, PowerForecast, RevokeObject, DDBC.SystemDescription, DDBC.ActuatorStatus, DDBC.TimerStatus, DDBC.AverageDemandRateForecast, DDBC.PresentDemandStatus
NotControllableHandshake, HandshakeResponse, SelectControlType, SessionRequest, ReceptionStatusHandshake, ResourceManagerDetails, SessionRequest, ReceptionStatus, PowerMeasurement, PowerForecast
NoSelectionHandshake, HandshakeResponse, SelectControlType, SessionRequest, ReceptionStatusHandshake, 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

ProfileProtocol version stringMessages
V1_0_01.0.036
V0_0_2Beta0.0.2-beta35

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.

PartState
Pairing, both sides, with the per-node rate limit and the mandatory delayyes
Session initiation, both sides, with the two-phase token commityes
LAN trust: unverified during pairing, CA-pinned afterwardsyes
DNS-SD advertise and browse, _cem / _rm subtypesyes
LAN-only operations: /endpoint, /nodes, /preparePairing, /cancelPreparePairingyes
The same-subnet check those operations require, v4 and v6yes
Long-polling (/waitForPairing), both halves: the client holds a request open, the server wakes ityes
WAN endpoint registryno

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.

PeerControl typeOutcome
s2-example-implementations/batteryFRBCpeer defect, caught by S2-INST-002
s2-example-implementations/pv-installationPEBCpeer defect, caught by S2-NUM-002
s2-example-implementations/pv-installationNOT_CONTROLABLEclean

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