Skip to content

symfonic.core.learning.durability_gate

durability_gate

The consolidation durability gate, now owned by the memory capability.

The predicate moved to :mod:symfonic.capabilities.memory.durability because phase 10 is on the quick roster and the quick roster is composed by the kernel-native capability; a gate that existed in two places would be two gates, and the one that decided a row was transient would not be the one an adopter read the counter from.

Imported rather than reimplemented, so the legacy consolidator and the capability runtime refuse exactly the same rows. This module is the name the shipped phases and their tests already import.

DurabilityGate

DurabilityGate()

Mutable per-run rejection counter for the consolidation gate.

Source code in symfonic/capabilities/memory/durability.py
def __init__(self) -> None:
    self.rejected = 0

is_gated

is_gated(entry: Any, *, phase: str) -> bool

Return True when entry must be skipped by a promotion phase.

Increments :attr:rejected and emits a logger.info audit line on every rejection (Contract G).

Source code in symfonic/capabilities/memory/durability.py
def is_gated(self, entry: Any, *, phase: str) -> bool:
    """Return True when *entry* must be skipped by a promotion phase.

    Increments :attr:`rejected` and emits a ``logger.info`` audit line
    on every rejection (Contract G).
    """
    durability = entry_durability(entry)
    if durability in _GATED_VALUES:
        self.rejected += 1
        entry_id = getattr(entry, "id", None) or getattr(
            entry, "node_id", "?"
        )
        logger.info(
            "consolidation.transient_rejected phase=%s entry=%s "
            "durability=%s",
            phase, entry_id, durability,
        )
        return True
    return False

entry_durability

entry_durability(entry: Any) -> str

Read a durability marker from an episodic entry's metadata.

Episodic entries carry their properties under metadata (the orchestrator commit path copies node.properties -> MemoryEntry .metadata). Returns "durable" when no marker is present -- byte-identical to pre-v7.26.2 promotion behaviour.

Source code in symfonic/capabilities/memory/durability.py
def entry_durability(entry: Any) -> str:
    """Read a durability marker from an episodic entry's metadata.

    Episodic entries carry their properties under ``metadata`` (the
    orchestrator commit path copies ``node.properties`` -> ``MemoryEntry
    .metadata``).  Returns ``"durable"`` when no marker is present --
    byte-identical to pre-v7.26.2 promotion behaviour.
    """
    md = getattr(entry, "metadata", None) or {}
    raw = md.get("durability")
    if isinstance(raw, str) and raw in {"transient", "durable", "expired"}:
        return raw
    return "durable"