babylon.engine.systems.edge_transition
Edge transition system package — Spec 059 US5 / ADR-006.4.
Replaces the historical 856-LOC engine/systems/edge_transition.py single
file with a package whose __init__.py re-exports the public surface
unchanged. The original implementation lives at _legacy.py while the
content split into predicates.py (the 3 Pydantic predicate models) +
system.py (the System class) per data-model.md §2.5 is deferred to a
follow-up — preserving byte-equality and import equivalence trumps SC-002’s
LOC budget for this commit.
EdgeTransitionSystem inherits from SystemBase (Spec 059 US3 / ADR-003) — the hard ordering documented in research.md D5 holds: ADR-003 is committed (15a6bda6 + de1d8b4b + 17c65460) before this US5/T072 lands.
Import equivalence (FR-003 / contracts/import-equivalence.md C7): every
existing from babylon.engine.systems.edge_transition import X resolves
unchanged via this re-export.
- class babylon.engine.systems.edge_transition.CompoundPredicate(**data)[source]
Bases:
BaseModelA named compound predicate — conjunction of conditions.
All conditions must be true (AND logic) for the predicate to fire.
- Parameters:
name (str)
conditions (list[PredicateCondition])
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- conditions: list[PredicateCondition]
- class babylon.engine.systems.edge_transition.EdgeModeTransition(**data)[source]
Bases:
BaseModelA permissible edge mode transition.
Defines a directed arc in the state machine from from_mode to to_mode, gated by a compound predicate, with priority for tie-breaking.
- Parameters:
from_mode (EdgeMode)
to_mode (EdgeMode)
predicate (CompoundPredicate)
priority (int)
description (str)
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- predicate: CompoundPredicate
- class babylon.engine.systems.edge_transition.EdgeTransitionSystem[source]
Bases:
SystemBaseEvaluate compound predicates and fire edge mode transitions.
Execution Order: 21 (after FieldDerivativeSystem)
For each edge with an edge_mode, evaluates eligible transitions from the current mode. If a predicate fires, transitions to the new mode. Priority ordering resolves multiple eligible transitions.
- step(graph, services, context)[source]
Evaluate predicates and fire edge mode transitions.
- Parameters:
graph (GraphProtocol) – Mutable graph (NetworkX or GraphProtocol).
services (ServicesProtocol) – ServicesProtocol with field_registry.
context (ContextType) – TickContext or dict with tick and persistent_data.
- Return type:
None
- class babylon.engine.systems.edge_transition.PredicateCondition(**data)[source]
Bases:
BaseModelA single condition in a compound predicate.
- Parameters:
field (str) – Contradiction field name (e.g., “exploitation”).
metric (str) – Which metric to evaluate (“value”, “df_dt”, “d2f_dt2”, “laplacian”).
operator (str) – Comparison operator (“gt”, “lt”, “gte”, “lte”).
threshold (float) – Threshold value for comparison.
scope (str) – Which node to evaluate at (“source”, “target”).
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].