Skip to content

symfonic.capabilities.memory.operator_admission

operator_admission

The admin service's explicit writes present a run's erase admission (CORE-199).

Split from erase_admission. Owner decision (CORE-199 review F2): MemoryAdminService stage, publish and discard reuse the running turn's captured admission; a caller with none -- outside any run, or in a run that captured nothing on the store's pool -- fails closed. A contextless caller is never handed a fresh observation, which would let code that stripped its context write what a stale turn read, into the erased scope itself.

operator_admission async

operator_admission(store: Any, scope: Any) -> AsyncIterator[None]

The admin service's write presents the running turn's admission.

The caller may be a tool holding what the turn read, so it is held to the turn's capture -- and to every run it descends from. Outside any run, or in a run that captured nothing on this store's pool, it refuses: there is no admission to present, and a fresh observation would let a context-free caller write what a stale turn read. Stores without a PostgreSQL fence need no admission.

Source code in src/symfonic/capabilities/memory/operator_admission.py
@asynccontextmanager
async def operator_admission(store: Any, scope: Any) -> AsyncIterator[None]:
    """The admin service's write presents the running turn's admission.

    The caller may be a tool holding what the turn read, so it is held to the
    turn's capture -- and to every run it descends from. Outside any run, or
    in a run that captured nothing on this store's pool, it refuses: there is
    no admission to present, and a fresh observation would let a context-free
    caller write what a stale turn read. Stores without a PostgreSQL fence
    need no admission.
    """
    pool = memory_pool(store)
    if pool is None or getattr(scope, "identity_version", 0) != 1:
        yield
        return
    from symfonic.capabilities.memory.turn_generation import ambient_fences

    fences = ambient_fences()
    if not carries(pool, fences):
        raise MemoryContractError(NO_RUN_ADMISSION)
    with admitted(_mint_admission(fences)):
        yield

operator_call async

operator_call(store: Any, scope: Any, method: str, argument: Any) -> Any

One admin-service mutation under the running turn's :func:operator_admission.

Source code in src/symfonic/capabilities/memory/operator_admission.py
async def operator_call(store: Any, scope: Any, method: str, argument: Any) -> Any:
    """One admin-service mutation under the running turn's :func:`operator_admission`."""
    async with operator_admission(store, scope):
        return await getattr(store, method)(argument)