Configuration shifts — API reference¶
Every public symbol in skyfall_crl.regime, generated from the source.
Generated page — built from the source docstrings, so this file is blank when read on GitHub. Run
mkdocs serveto read it locally, or read the docstrings in the module itself.
Providers¶
base ¶
Who decides which configuration is active.
The environment asks one question -- what configuration are we in at this step -- and the answer can come from a schedule that was written in advance or, in principle, from something watching the world and inferring that it has changed. Both answer the same question, so both satisfy the same contract, and neither is privileged.
Providers register by name so a run can name one in configuration rather than importing it.
REGIME_PROVIDERS
module-attribute
¶
REGIME_PROVIDERS: dict[
str, Callable[..., RegimeProvider]
] = {
"constant": ConstantRegime,
"scheduled": ScheduledRegime,
}
RegimeProvider ¶
Bases: Protocol
Reports which configuration is active at a given step.
ConstantRegime ¶
ScheduledRegime ¶
Follows a schedule written in advance -- the default way to shift a world.
schedule may be a RegimeSchedule, the mapping one
is built from, or the path to a YAML file holding it. The last two exist because a run is
selected by configuration: {"provider": "scheduled", "params": {"schedule": ...}} builds
this class directly, and a document cannot name an object. Accepting only the built form made
that path silently produce a provider that raised on its first step.
register_provider ¶
Make a provider available by name, so a run can select it without importing it.
get_provider ¶
The provider factory registered under name.
Raises KeyError naming what is registered, so a typo in a config reports the
available options rather than a bare miss.
available_providers ¶
The names a config may select, sorted. Registering a provider adds to this.
Schedules¶
schedule ¶
What configuration a world is running under, and when it changes.
A world's configuration shifts while an agent works in it. A schedule says which configuration is active at each step and how one gives way to the next -- abruptly, on a loop, or by drifting gradually into it.
One detail carries more weight than it looks: a configuration can recur under a new name
(alias_of). Measuring whether an agent has forgotten something requires meeting the same
conditions twice and comparing, so a schedule with no recurrence gives a forgetting metric
nothing to work with.
A repeat keeps its own label and records what it repeats (Regime.origin), so a trace
shows which visit this is while the metrics can still tell what is being visited. Without
that second half a repeat would read as an unrelated configuration and forgetting would come
back unavailable for both.
KNOWN_AXES
module-attribute
¶
KNOWN_AXES: frozenset[str] = frozenset(
{
"ticket_arrival_rate",
"chaos_type_distribution",
"capacity_multiplier",
"priority_distribution",
"affected_service_distribution",
"deadline_tightness_multiplier",
"demand_surge_multiplier",
"workforce_capacity",
"job_duration_distribution",
"service_level_distribution",
}
)
Regime
dataclass
¶
One configuration: what it is called, how long it lasts, and how it behaves.
identity
property
¶
What configuration this is, whatever it is called here.
Two entries share an identity when one repeats the other. Forgetting is measured over identities rather than labels, because meeting the same conditions twice is the whole of what it asks about.
select ¶
The axes named here that this configuration actually sets.
exclude ¶
Every axis except the ones named.
Which axes an environment can be told about is the environment's business, not the schedule's, so the schedule offers the split and lets the adapter decide where it falls.
RegimeSchedule ¶
The configurations a run passes through, and when.
Parameters¶
regimes:
In order. Each needs a regime_id; duration_steps may be omitted on the last
one to mean "until the run ends". An entry with alias_of repeats another
configuration under a new name.
shift_mode:
abrupt switches at the boundary, cyclic loops back to the start, and
linear_drift eases into the next configuration over drift_window steps.
Axes and the chaos payload¶
chaos ¶
Turning a configuration into something a deployment can be told.
Only two of a configuration's axes mean anything to the deployment: how often incidents arrive, and which kinds. Everything else describes conditions this side reasons about.
Kept separate from the schedule so that what a configuration is and how it is pushed can change independently -- and so the payload can be checked without a world to push it to.
BACKEND_AXES
module-attribute
¶
KNOWN_CHAOS_TYPES
module-attribute
¶
KNOWN_CHAOS_TYPES = frozenset(
{
"missing_data",
"stale_data",
"format_change",
"rate_limit",
"dependency_failure",
"invalid_state",
"partial_data",
"duplicate_data",
"timing_issue",
"permission_denied",
"data_corruption",
}
)
backend_axes ¶
The axes of regime a deployment can be told about.
local_axes ¶
The axes a deployment has no notion of -- capacity, priorities, demand, and so on.
Reported rather than pushed, so a task view can act on them.
chaos_payload ¶
Describe a configuration in the form a deployment accepts.
A failure kind the deployment would not recognise is left out rather than allowed to fail the whole shift: losing one weight from a distribution is a far better outcome than a configuration change that silently never happened.