pub struct ChangeSpineEnvelope {
pub actor_type: Option<String>,
pub acting_for: Option<String>,
pub schema_version: Option<String>,
pub tenant_id: Option<String>,
pub duration_ms: Option<i32>,
pub seq: Option<i64>,
}Expand description
Change-Spine envelope metadata delivered to subscription clients alongside the resolved entity data (#425).
Carries the audit / provenance context the Change-Spine records for every
change — who made it (actor_type), who a delegated agent acted for
(acting_for), the producer schema_version, the tenant_id, the mutation
duration_ms, and the durable seq. Serialized camelCase into the subscription
next payload’s extensions.changeSpine slot; None fields are omitted, so a
producer that stamped nothing yields an empty object (see Self::is_empty,
which callers use to skip emitting it entirely).
The full envelope stays server-side (change log, observers, audit). What a subscriber
receives is Self::for_subscriber’s view of it (ruling AI): facts about the delivered
event, and a principal only when that principal is the subscriber. seq never reaches a
subscriber (ruling AA 5: it is a server-wide position — each subscription carries its own
delivery position in sequence_number instead), nor does duration_ms.
Fields§
§actor_type: Option<String>Actor classification of the request that produced the change:
"human_user", "service_account", "ai_agent", or "system_job" (#390).
acting_for: Option<String>For a delegated-agent request (RFC 8693 act claim), the public-facing UUID
of the underlying human the agent acts for (#390). Another principal’s identity:
delivered only to that principal (ruling AI).
schema_version: Option<String>Schema version of the producer that wrote the change (#377).
tenant_id: Option<String>Public-facing tenant UUID stamp (a display copy of the event’s tenant_id;
server-side tenant filtering uses the event’s own field, not this).
duration_ms: Option<i32>Wall-clock duration of the originating mutation, in milliseconds. Never delivered to a subscriber (ruling AI): rows the subscriber may not read shape it.
seq: Option<i64>Monotonic Change-Spine sequence for durable ordering / dedup.
Implementations§
Source§impl ChangeSpineEnvelope
impl ChangeSpineEnvelope
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
True when no envelope field is set — callers skip emitting an empty object.
Sourcepub fn for_subscriber(
&self,
own_user: Option<Uuid>,
own_tenant: Option<&str>,
) -> Option<Self>
pub fn for_subscriber( &self, own_user: Option<Uuid>, own_tenant: Option<&str>, ) -> Option<Self>
What a subscriber is told of this envelope (ruling AI), or None when nothing is
left — the frame is then the plain next of an unstamped event.
Kept: actor_type and schema_version, which identify no one and read nothing the
subscriber cannot. acting_for only when it is own_user (compared as UUIDs: “my
agent did this”); otherwise it names another principal, which no schema gate governs.
tenant_id only when it is own_tenant. Never: duration_ms, which rows the
subscriber may not read shape (a cascade, a policy, a trigger), and seq, a
server-wide position (ruling AA 5).
Trait Implementations§
Source§impl Clone for ChangeSpineEnvelope
impl Clone for ChangeSpineEnvelope
Source§impl Debug for ChangeSpineEnvelope
impl Debug for ChangeSpineEnvelope
Source§impl Default for ChangeSpineEnvelope
impl Default for ChangeSpineEnvelope
Source§impl<'de> Deserialize<'de> for ChangeSpineEnvelope
impl<'de> Deserialize<'de> for ChangeSpineEnvelope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ChangeSpineEnvelope
Source§impl PartialEq for ChangeSpineEnvelope
impl PartialEq for ChangeSpineEnvelope
Source§impl Serialize for ChangeSpineEnvelope
impl Serialize for ChangeSpineEnvelope
impl StructuralPartialEq for ChangeSpineEnvelope
Auto Trait Implementations§
impl Freeze for ChangeSpineEnvelope
impl RefUnwindSafe for ChangeSpineEnvelope
impl Send for ChangeSpineEnvelope
impl Sync for ChangeSpineEnvelope
impl Unpin for ChangeSpineEnvelope
impl UnsafeUnpin for ChangeSpineEnvelope
impl UnwindSafe for ChangeSpineEnvelope
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.