Skip to content

symfonic.capabilities.memory.phases.deep_native

deep_native

One bounded native DEEP risk-tag phase under an exact tenant owner.

This is an opt-in phase, not the generated admin/worker DEEP roster. Only PostgreSQL admits this phase: its native subtree query has a bounded database plan; the in-memory backend can scan the whole tenant before LIMIT. Candidate selection is a bounded native subtree read. Every write uses a durable exact-owner version and a journaled property delta.

NativeTagRiskPhase

NativeTagRiskPhase(graph: JournalledGraph, owner: DeepTenantOwner)

Tag up to 200 native subtree rows without changing their owners.

Source code in src/symfonic/capabilities/memory/phases/deep_native.py
def __init__(self, graph: JournalledGraph, owner: DeepTenantOwner) -> None:
    if type(owner) is not DeepTenantOwner:
        raise MemoryContractError("native DEEP requires a verified tenant owner")
    if type(graph) is not JournalledGraph:
        raise MemoryContractError("native DEEP requires an exact journalled graph")
    durable_type = type(graph.durable)
    if durable_type.__module__ != "symfonic.memory.backends.postgres_graph":
        raise MemoryContractError(
            "native DEEP requires an exact PostgresGraphBackend with bounded native reads"
        )
    from symfonic.memory.backends.postgres_graph import PostgresGraphBackend

    if durable_type is not PostgresGraphBackend:
        raise MemoryContractError(
            "native DEEP requires an exact PostgresGraphBackend with bounded native reads"
        )
    if not all(
        callable(getattr(graph, name, None)) for name in ("read_owned_node", "patch_owned_node")
    ):
        raise MemoryContractError("native DEEP requires guarded owned-node ports")
    self._graph = graph
    self._owner = owner