babylon.kernel.system_base
SystemBase — abstract base class for simulation Systems (ADR-003).
Lifts the shared scaffolding that the 22 System implementations duplicate: - name declaration (ClassVar) - the GraphProtocol narrowing guard (raw nx graphs rejected per Amendment L) - the read-node-attribute pattern with required=True diagnostics - the publish-via-event-bus shorthand
The companion System Protocol in
babylon.kernel.system_protocol is preserved for structural typing
(tests, mocks). PEP 544 explicitly supports this dual-export pattern.
Per ADR-003 (Bundle 2 / Spec 059) and research.md D1 (22 Systems, not 23).
Functions
|
Seed-deterministic RNG for stochastic System rolls (III.7). |
Classes
Abstract base for all simulation Systems. |
- babylon.kernel.system_base.resolve_rng(services, tick)[source]
Seed-deterministic RNG for stochastic System rolls (III.7).
Prefers
services.rngwhen a harness injects one; otherwise a freshrandom.Random(0xBA1AC1A + tick)— the spec-070 fallback previously duplicated byfaction_influenceandreactionary.- Parameters:
services (
ServicesProtocol) – Service container (checked for an injectedrng).tick (
int) – Current simulation tick, mixed into the fallback seed.
- Return type:
- Returns:
A
random.Randomwhose stream is a pure function oftick(fallback path) or the injected harness RNG.
- class babylon.kernel.system_base.SystemBase[source]
Bases:
ABCAbstract base for all simulation Systems.
Subclasses MUST set the
nameClassVar and implementstep().- Helpers:
_wrap_graph()— assert the graph satisfies GraphProtocol._read()— read a node attribute, raisingKeyErrorwhenrequired=Trueand the attribute is absent (surfaces schema bugs at the read site, per CLAUDE.md “Common Gotchas”)._publish()— publish an event via the service container’s bus.
- abstractmethod step(graph, services, context)[source]
Apply system logic to the world graph (in-place mutation).
The signature matches
babylon.kernel.system_protocol.Systemexactly. The engine (and all test fixtures) pass aBabylonGraph, which satisfiesGraphProtocol.- Return type:
None
- Parameters:
graph (GraphProtocol)
services (ServicesProtocol)
context (ContextType)