Skip to main content

validate_writable_metadata_key

Function validate_writable_metadata_key 

Source
pub fn validate_writable_metadata_key(
    key: &str,
    schema: &TypeDefinition,
) -> Result<(), ValidationError>
Expand description

Reject any attempt to set a read-only metadata key. The single mutation engine (memstead-base) calls this from its update_entity path over the metadata map: the mem / id / type triple stays engine-authoritative, and the schema’s init_timestamp / auto_timestamp annotations are honoured on write — the engine owns those values on create (init_timestamp, set once) and on every update (auto_timestamp, re-stamped). Returns ValidationError::ReadOnlyField on rejection. The unset path has its own gate (validate_unsettable_metadata_key) because the reserved triple is unset-allowed there as the sanctioned repair.