Skip to contents

Runs at every stage entry. Three outcomes:

  1. Proceed — schema matches, invariants hold.

  2. Auto-migrate — a registered migration path exists.

  3. Typed failure — returns a StageResult with status "failure" rather than throwing.

Usage

validate_boundary(data, required_schema = SCHEMA_VERSION, stage = "unknown")

Arguments

data

StateTransitionData (or anything, to catch type errors early)

required_schema

character required schema version

stage

character stage name used in error messages

Value

StateTransitionData (possibly migrated) on success; StageResult with status = "failure" on failure