Refuse externally effecting/forged roster before any accepted ID is spent.
Source code in src/symfonic/memory/backends/postgres_accepted_admission.py
| def require_graph_only(runtime, domain) -> None:
"""Refuse externally effecting/forged roster before any accepted ID is spent."""
phases = runtime._phases
if (runtime.writes is not None or runtime.participants != (domain.graph,)
or set(phases) != {
"strengthen", "soul_corrections", "episodic_summary", "semantic_merge"
} or type(phases["strengthen"]) is not StrengthenPhase
or type(phases["soul_corrections"]) is not SoulCorrectionsPhase
or type(phases["episodic_summary"]) is not EpisodicSummaryPhase
or type(phases["semantic_merge"]) is not SemanticMergePhase):
raise ContractViolationError("private accepted cadence refused")
strengthen, soul = phases["strengthen"], phases["soul_corrections"]
episodic, merge = phases["episodic_summary"], phases["semantic_merge"]
graph, window = strengthen._graph, strengthen._window
if (type(graph) is not FencedGraph or type(graph._graph) is not GraphMemoryStore
or graph._graph._embedding_provider is not None
or type(graph._graph._backend) is not JournalledGraph
or graph._graph._backend._durable is not domain.graph
or soul._graph is not graph or merge._graph is not graph
or soul._window is not window or window._graph is not graph
or not window._exact_session_owner or not window._session_kind
or soul._fields or episodic._episodic is not None
or episodic._summarise is not None or merge._enabled
or merge._chat_model is not None or merge._embedding_provider is not None):
raise ContractViolationError("private accepted cadence refused")
|