Skip to main content

validate_cross_mem_edge

Function validate_cross_mem_edge 

Source
pub fn validate_cross_mem_edge(
    rel_type: &str,
    from_type: &str,
    to_type: Option<&str>,
    source_schema: &Schema,
    target_schema_ref: &SchemaRef,
) -> CrossMemRelCheck
Expand description

Validate a cross-mem edge whose source and target mems pin schemas with different names against the source schema’s outbound cross_mem_relationships: vocabulary.

Caller responsibility: only invoke when the source and target schema names differ — same-name mems (any version pair) fall through to the intra-mem path (validate_rel_type + validate_rel_shape); same-name is same domain.

The lookup goes through Schema::cross_mem_entry, which matches by target schema name only — eligibility is name-based, so the target mem’s pinned version never participates and a version bump on the target side cannot invalidate a declaration.

On a match, the cross-mem entry’s definitions list is the sole vocabulary for this edge: the source schema’s intra-mem relationships.definitions is NOT consulted in this regime (per AC #6 / #9). A rel-type present intra-mem but absent cross-mem surfaces here as INVALID_REL_TYPE; a shape violation surfaces here as INVALID_REL_SHAPE with the cross-mem entry’s shape (not the intra-mem entry’s, if both exist).