Preserve committed procedure review evidence across generic node updates.
guard_update
guard_update(node: Any, updates: dict[str, Any]) -> None
Validate the effective update while the backend holds its writer lock.
Source code in src/symfonic/memory/backends/procedural_seal.py
| def guard_update(node: Any, updates: dict[str, Any]) -> None:
"""Validate the effective update while the backend holds its writer lock."""
if node.layer != MemoryLayer.PROCEDURAL or not procedure_is_sealed_terminal(
node.properties
):
return
if updates.get("layer", node.layer) != node.layer:
raise NodeWriteConflict("reviewed procedure layer is immutable")
proposed = dict(node.properties)
for key, value in updates.items():
if key == "scope_path":
continue
if key == "properties":
if not isinstance(value, dict):
raise NodeWriteConflict("reviewed procedure requires property object")
proposed = dict(value)
elif not hasattr(node, key):
proposed[key] = value
if _seal(node.properties) != _seal(proposed):
raise NodeWriteConflict("generic update conflicts with committed procedure review")
|