Source:
Local role: Guarded dictionary wrapper used in mutable fields of ModelObject.
Big-picture role: Prevents direct mutations when authority lock is active through World.
Inheritance:
dict[str, Any]
Parameters and fields:
initial: Mapping[str, Any] | Nonemutation_guard: MutationGuard
Methods:
set_mutation_guard(...)- guarded mutators:
__setitem__,__delitem__,clear,pop,popitem,setdefault,update __deepcopy__(...)
Example:
from ometeotl_core.model.base import GuardedJsonDict
d = GuardedJsonDict({"status": "active"})
d["status"] = "inactive" # allowed — no guard active
d["new_key"] = 42
# When a World enables authority mode, the mutation guard fires
# and d["key"] = value raises RuntimeError until authority mode is disabled.
See also:
