MingaEditor.Frontend.FrameTransaction (Minga v0.1.0)

Copy Markdown View Source

Validates the render-frame boundary before a command batch reaches a frontend.

Semantic render commands must appear between matching begin_frame and commit_frame markers. Only a deliberately small set of setup and side-channel commands may be emitted outside a frame. The manager logs violations before it writes the batch so a producer regression is attributable without inspecting payload content.

Summary

Functions

Formats a validation error using only protocol metadata, never command payloads.

Validates one ordered frontend command batch without inspecting payload data.

Types

frame_seq()

@type frame_seq() :: non_neg_integer()

state()

@type state() :: :outside | {:inside, frame_seq()}

validation_error()

@type validation_error() ::
  {:malformed_command}
  | {:begin_while_open, frame_seq()}
  | {:commit_without_begin, frame_seq()}
  | {:commit_seq_mismatch, expected :: frame_seq(), received :: frame_seq()}
  | {:unterminated_frame, frame_seq()}
  | {:out_of_transaction_command, opcode :: non_neg_integer()}

Functions

format_error(arg)

@spec format_error(validation_error()) :: String.t()

Formats a validation error using only protocol metadata, never command payloads.

validate(commands)

@spec validate([binary()]) :: :ok | {:error, validation_error()}

Validates one ordered frontend command batch without inspecting payload data.