The strict profile
validate_strict_envelope is the opt-in, deterministic, fail-closed gate for the durable
journal and TeamSpace ingress. It is layered over the envelope and payload contracts and is
intentionally separate from validate_event: the default validator checks a payload against
its type, while the strict profile admits or rejects a whole envelope for the durable record.
Source: src/spec_kitty_events/strict.py.
Profile id: STRICT_PROFILE_ID = "journal/v1".
from spec_kitty_events.strict import validate_strict_envelope
errors = validate_strict_envelope(envelope) # a tuple of ValidationErrorif errors: reject(errors) # fail closed — do not admit the rowWhat it enforces
Given an envelope record, the profile checks (in order):
- the record is a mapping with a known
event_type; - every member of
STRICT_ENVELOPE_KEYSis present — an explicitnullcounts, so a defaulted field such asschema_versionordata_tiermust be written out; - no key outside
STRICT_ENVELOPE_KEYSappears at the envelope level; - no forbidden key appears anywhere, by a recursive walk:
FORBIDDEN_LEGACY_KEYSalways, plusFORBIDDEN_OBSERVATION_KEYSwhen the event is aHarnessObservationandFORBIDDEN_WORK_KEYSwhen it is aWorkObservation; - no forbidden legacy aggregate name (
FORBIDDEN_LEGACY_AGGREGATE_NAMES—feature,feature_catalog) inaggregate_id; schema_versionis present, a string, and exactly"3.0.0".
STRICT_ENVELOPE_KEYS is the full 14-key envelope set (every field on
the envelope, including the defaulted schema_version and data_tier).
Because an explicit null satisfies presence, a strict-profile envelope carries all 14 keys
even where a value is absent.
Which event types are journaled
STRICT_EVENT_TYPES is the frozenset of event types the journal profile admits. The package
also ships SUPPORT_MATRIX — a per-type, per-schema-version support table — and
support_matrix_digest(), a SHA-256 over its canonical serialization, so a consumer can pin
the exact matrix it validated against. Which families are durable (journaled) versus volatile
(relay-only) is covered in durability and the relay.
Why fail-closed, and where
The journal and ingress admit only canonical envelopes, so a malformed or legacy-shaped row is rejected rather than silently stored. This is distinct from local history, which the CLI reads permissively so users never lose their own data — see versioning & compatibility.