Skip to content

symfonic.capabilities.memory.read_admission

read_admission

Exact scope admission for an explicitly narrowed memory read.

ReadAdmission dataclass

ReadAdmission(allowed_scope_paths: tuple[str, ...])

Canonical exact owner paths for an explicitly narrowed read.

distance

distance(record: MemoryScope, query: MemoryScope) -> int

Return a score distance, or -1 for an unadmitted owner.

Source code in src/symfonic/capabilities/memory/read_admission.py
def distance(self, record: MemoryScope, query: MemoryScope) -> int:
    """Return a score distance, or -1 for an unadmitted owner."""
    if (
        record.path not in self.allowed_scope_paths
        or not _within_query_authority(record, query)
    ):
        return -1
    inherited = record.distance(query)
    return inherited if inherited >= 0 else 1

validate_for

validate_for(scope: MemoryScope) -> None

An explicit sibling may not widen the query to another principal.

Source code in src/symfonic/capabilities/memory/read_admission.py
def validate_for(self, scope: MemoryScope) -> None:
    """An explicit sibling may not widen the query to another principal."""
    if any(not _within_query_authority(scope_from_path(path), scope)
           for path in self.allowed_scope_paths):
        raise MemoryContractError(
            "read admission must name a visible ancestor or same-principal session"
        )