Skip to content

symfonic.capabilities.memory.native_deep_receipt_commit

native_deep_receipt_commit

Exact raw graph journal commit under a native DEEP receipt transaction.

The generic commit selector intentionally rejects a raw graph paired with a receipt domain. This helper admits only the one verified native DEEP graph.

commit_native_deep_risk async

commit_native_deep_risk(journal: CycleJournal, graph: PostgresGraphBackend, domain: PostgresReceiptDomain, leases: PostgresReceiptLeases, fence: object, operation: MemoryOperation) -> int

Commit guarded patches and receipt under one locked lease row.

Source code in src/symfonic/capabilities/memory/native_deep_receipt_commit.py
async def commit_native_deep_risk(
    journal: CycleJournal,
    graph: PostgresGraphBackend,
    domain: PostgresReceiptDomain,
    leases: PostgresReceiptLeases,
    fence: object,
    operation: MemoryOperation,
) -> int:
    """Commit guarded patches and receipt under one locked lease row."""
    require_operation(operation, MemoryOperationVerb.COMMIT_CYCLE, operation.scope)
    if (
        type(journal) is not CycleJournal
        or type(graph) is not PostgresGraphBackend
        or type(domain) is not PostgresReceiptDomain
        or type(leases) is not PostgresReceiptLeases
        or domain.pool is not graph.pool
        or leases.transaction_domain is not domain
        or journal.stores() not in ((), (graph,))
    ):
        raise MemoryContractError("native DEEP receipt participants must share one exact graph")
    operations = journal.seal()
    _require_tenant_subtree_operations(journal, graph, operation, operations)
    async with domain.operation_transaction(operation), journalled(None):
        await fence.check_locked("applying native DEEP risk patches")
        return await journal.apply()