Skip to content

symfonic.capabilities.memory.selected_records

selected_records

Immutable selected-row ownership; authenticated by the journal envelope.

PublishedRecallRef dataclass

PublishedRecallRef(record_id: str, owner: MemoryScope, generation: str)

Exact stored publication identity, still short of prompt delivery.

published_recall_ref

published_recall_ref(record_id: str, actual_owner: MemoryScope, properties: Mapping[str, Any], *, tenant_id: str) -> PublishedRecallRef | None

Require stored identity to agree with the row scope and tenant key.

Source code in src/symfonic/capabilities/memory/selected_records.py
def published_recall_ref(
    record_id: str, actual_owner: MemoryScope, properties: Mapping[str, Any],
    *, tenant_id: str,
) -> PublishedRecallRef | None:
    """Require stored identity to agree with the row scope and tenant key."""
    named = OWNER_KEY in properties or GENERATION_KEY in properties
    if not named:
        return None
    if (OWNER_KEY not in properties or GENERATION_KEY not in properties
            or type(properties[OWNER_KEY]) is not dict):
        _refuse()
    declared = _owner(properties[OWNER_KEY])
    if declared != actual_owner or declared.tenant != tenant_id:
        _refuse()
    return PublishedRecallRef(record_id, declared, properties[GENERATION_KEY])