Protocol Rules
These are the mandatory behaviors every RUF implementation must follow. The keywords MUST, MUST NOT, and MAY are used in the RFC 2119 sense.
Client rules
State management
- The client MUST send the full current
SessionMetaon every action request. - The client MUST NOT mutate
SessionMetadirectly. Only the server may transition state. - The client MUST derive all necessary state from components. When shared state needs to be updated optimistically, a dedicated state-holding component must be used — not a direct meta mutation. See Sharing Global State.
- The client MUST apply
metapatches from server responses via shallow merge, not full replacement.
Component cache
- The client MUST maintain a component cache keyed by screen name and component
rel. - The client MUST apply the
mergeStrategyfield when updating cached components. If no strategy is present,REPLACEis assumed.
Navigation
- The client MUST execute navigation directives returned in the
navigationfield of a Session response. - The client MUST roll back the navigation stack to its pre-action state when
Navigation.modeisFAILED. - The client MAY apply navigation optimistically before the server responds, but MUST roll back if the server returns
FAILED.
Metrics
- The client MUST fire
navigationMetricswhen a screen becomes the active screen. - The client MUST fire
metricswhen a screen is loaded. - The client MUST fire
actionMetricsafter an action completes successfully.
Requests
- The client MUST include a unique
x-request-idheader on every request for idempotency.
Server rules
Responses
- The server MUST include a
Navigation.idin every navigation directive to support idempotency and rollback matching. - The server MUST return only the screens and components that changed in a given response. Full responses on every request are wasteful and discouraged.
- The server MUST return
Navigation.mode = FAILEDwhen a navigation cannot be completed, rather than omitting the navigation field.
State ownership
- The server MUST be the sole authority on
SessionMetachanges. It communicates state changes via themetafield in the response. - The server MUST treat the
metafield in the action request as the authoritative current state of the client.