Skip to content

The envelope

Event is the single top-level envelope. Every event family rides in it: a stable set of context fields identifying, ordering and scoping the event, carrying an opaque per-family payload. It is an immutable (frozen=True) Pydantic model; the package validates the context fields and leaves the payload to the family’s own model. The generated schema page renders the normative envelope schema with diagram, properties and source.

Source: src/spec_kitty_events/models.py.

Fields

FieldTypeMeaning
event_idstrUnique id. Accepts a 26-char ULID, 32-char hex, or 36-char hyphenated UUID; normalised by normalize_event_id (ULID upper-cased, UUID lower-cased and hyphenated).
event_typestrThe event-type string, e.g. "WPStatusChanged". Selects the payload contract.
aggregate_idstrIdentity of the entity this event modifies, e.g. mission/WP01.
payloaddict[str, Any]Event-specific data, opaque to the envelope (default {}). Validated against the family’s payload model.
timestampdatetimeProducer-assigned wall-clock occurrence time (ISO-8601 UTC). Consumers preserve it and record receipt time separately. Not used for ordering.
build_idstrCanonical checkout/worktree identity that produced the event.
node_idstrCausal emitter identity; used for Lamport ordering and deterministic tie-breaking.
lamport_clockint | None (≥0)Optional since 11.0.0. Lamport logical clock; owns ordering together with node_id when present. Required by the strict profile.
causation_idstr | NoneParent event id (ULID/UUID); None for roots.
project_uuiduuid.UUIDThe project this event belongs to.
project_slugstr | NoneHuman-readable project id.
correlation_idstrCorrelation id (ULID/UUID) tying related events together.
schema_versionstrOn-wire envelope schema version, default "3.0.0". The strict profile requires exactly 3.0.0.
data_tierint (0–4)Progressive data-sharing tier (0 = local … 4 = telemetry), default 0.

to_dict() / from_dict() move between the model and a plain JSON-ready mapping.

Identity and ordering

  • build_id is the only canonical build identity. It is build/checkout scoped, never team scoped; private-versus-team routing is host-product policy and not part of the envelope. See system context.
  • Unclocked envelopes (11.0.0). lamport_clock may be None for local ledgers. They order before clocked envelopes by (timestamp, event_id), as in ADR 0001’s total order, and are never concurrent with another envelope. The durable journal and TeamSpace ingress reject them.
  • Ordering is by (lamport_clock, node_id), not time, for clocked envelopes. Wall-clock timestamp can skew between nodes, so it never orders a stream. For the total order over CloudEvents-form rows, see ordering and reduction.

Schema version versus package version

schema_version is the on-wire compatibility signal and is held at 3.0.0 across package major versions. It is not the package version. The two move independently; see versioning & compatibility.

See also

Schemas