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: BaseModel

A named compound predicate — conjunction of conditions.

All conditions must be true (AND logic) for the predicate to fire.

Parameters:
model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
conditions: list[PredicateCondition]
class babylon.engine.systems.edge_transition.EdgeModeTransition(**data)[source]

Bases: BaseModel

A 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:
model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

from_mode: EdgeMode
to_mode: EdgeMode
predicate: CompoundPredicate
priority: int
description: str
class babylon.engine.systems.edge_transition.EdgeTransitionSystem[source]

Bases: SystemBase

Evaluate 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.

name: ClassVar[str] = 'edge_transition'
creates_value: ClassVar[bool] = False
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: BaseModel

A 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].

field: str
metric: str
operator: str
threshold: float
scope: str