Skip to main content

metadata_distinguishes_absent_from_empty

Function metadata_distinguishes_absent_from_empty 

pub async fn metadata_distinguishes_absent_from_empty<F: Fixture>(
    open: impl AsyncFn() -> F,
) -> RuleOutcome
Expand description

Absent metadata and present-but-empty metadata are two different values.

VT-1, and the half of it a round-trip rule over one event cannot reach. metadata: None means the writer attached none; Some(&[]) means the writer attached a zero-length blob — a codec that emits nothing for an empty struct produces the second, and a consumer branching on metadata.is_some() reads the two differently.

The wrong implementation is a nullable BLOB column plus a driver that maps a zero-length value to NULL, or an Option<Vec<u8>> normalised with filter(|m| !m.is_empty()) on the way in. Both collapse the pair; MetadataConflatingStore is the second, and DropsMetadataStore — which forgets the column entirely — fails this rule too, one column further along the same road.

The two events are found by type rather than by index. This rule owns the metadata distinction and read_defaults_to_ascending_order owns order; a store that returned them the other way round would otherwise fail this rule for a reason that is not this rule’s.