pub struct LabConfig {Show 14 fields
pub seed: u64,
pub entropy_seed: u64,
pub worker_count: usize,
pub panic_on_obligation_leak: bool,
pub trace_capacity: usize,
pub futurelock_max_idle_steps: u64,
pub panic_on_futurelock: bool,
pub max_steps: Option<u64>,
pub chaos: Option<ChaosConfig>,
pub replay_recording: Option<RecorderConfig>,
pub auto_advance_time: bool,
pub enable_cancellation_oracle: bool,
pub panic_on_cancellation_violation: bool,
pub oracle_selection: Vec<String>,
}Expand description
Configuration for the lab runtime.
Fields§
§seed: u64Random seed for deterministic scheduling.
entropy_seed: u64Seed for deterministic entropy sources.
By default this matches seed, but can be overridden to decouple
scheduler decisions from entropy generation.
worker_count: usizeNumber of virtual workers to model in the lab scheduler.
This does not spawn threads; it controls deterministic multi-worker simulation. Values less than 1 are clamped to 1.
panic_on_obligation_leak: boolWhether to panic on obligation leaks.
trace_capacity: usizeTrace buffer capacity.
futurelock_max_idle_steps: u64Max lab steps a task may go unpolled while holding obligations.
0 disables the futurelock detector.
panic_on_futurelock: boolWhether to panic when a futurelock is detected.
max_steps: Option<u64>Maximum number of steps before forced termination.
chaos: Option<ChaosConfig>Chaos injection configuration.
When enabled, the runtime will inject faults at various points to stress-test the system’s resilience.
replay_recording: Option<RecorderConfig>Replay recording configuration.
When enabled, the runtime will record all non-determinism sources for later replay.
auto_advance_time: boolWhen true, the runtime auto-advances virtual time to the next timer deadline whenever all tasks are idle (no runnable tasks in scheduler).
This enables “instant timeout testing” — a 24-hour wall-clock scenario completes in <1 second of real time because sleep/timeout deadlines are jumped to instantly rather than waited for.
enable_cancellation_oracle: boolWhether to enable real-time cancellation protocol oracle verification.
When enabled, the runtime will continuously verify that the cancellation protocol is followed correctly during execution.
panic_on_cancellation_violation: boolWhether to panic when cancellation protocol violations are detected.
When false, violations are logged as warnings instead of panicking.
oracle_selection: Vec<String>Oracle names selected for report filtering and scenario-style lab runs.
Empty means ORACLE_ALL, preserving the historical “check every
suite-reported oracle” default.
Implementations§
Source§impl LabConfig
impl LabConfig
Sourcepub fn from_time() -> Self
👎Deprecated since 0.0.0: from_time is non-replayable — use LabConfig::new(seed) with an explicit seed for any test or production caller; if a wall-clock seed is genuinely required, call from_time_unstable() so the non-replayability is visible at the call site
pub fn from_time() -> Self
from_time is non-replayable — use LabConfig::new(seed) with an explicit seed for any test or production caller; if a wall-clock seed is genuinely required, call from_time_unstable() so the non-replayability is visible at the call site
Creates a lab configuration from the current wall clock.
br-asupersync-eij5e4: this constructor derives the PRNG seed
from SystemTime::now() and is therefore NOT replay-
deterministic — every call produces a different seed, every
LabRuntime built from it produces a different schedule, and
any test that asserts a deterministic outcome (oracle
violations, trace fingerprints, certificate hashes) will be
flaky in CI. The asupersync core invariant ‘lab replay is
byte-identical given the same seed’ is silently violated.
Prefer LabConfig::new with an explicit seed for
every scenario where replay determinism matters (which is
almost every CI test, every snapshot test, every crashpack
reproduction). The constructor is retained ONLY for
genuinely-throwaway local experimentation where the user is
holding the seed in their head; the
from_time_unstable alias makes
the non-replayability impossible to overlook at the call site.
Sourcepub fn from_time_unstable() -> Self
pub fn from_time_unstable() -> Self
br-asupersync-eij5e4: wall-clock-derived LabConfig with a
deliberately conspicuous name. Use this only when the test or
experiment genuinely cannot be replayed (e.g., a one-off
soak run), and prefer LabConfig::new with an explicit seed
anywhere determinism matters.
The _unstable suffix follows the asupersync convention for
APIs whose behaviour is intentionally non-deterministic, so
grep -r from_time_unstable enumerates every call site that
has knowingly opted into wall-clock seeding.
Sourcepub const fn panic_on_leak(self, value: bool) -> Self
pub const fn panic_on_leak(self, value: bool) -> Self
Sets whether to panic on obligation leaks.
Sourcepub const fn trace_capacity(self, capacity: usize) -> Self
pub const fn trace_capacity(self, capacity: usize) -> Self
Sets the trace buffer capacity.
Sourcepub const fn worker_count(self, count: usize) -> Self
pub const fn worker_count(self, count: usize) -> Self
Sets the number of virtual workers to model.
Values less than 1 are clamped to 1.
Sourcepub const fn entropy_seed(self, seed: u64) -> Self
pub const fn entropy_seed(self, seed: u64) -> Self
Sets the entropy seed used for capability-based randomness.
Sourcepub const fn futurelock_max_idle_steps(self, steps: u64) -> Self
pub const fn futurelock_max_idle_steps(self, steps: u64) -> Self
Sets the maximum idle steps before the futurelock detector triggers.
Sourcepub const fn panic_on_futurelock(self, value: bool) -> Self
pub const fn panic_on_futurelock(self, value: bool) -> Self
Sets whether to panic when a futurelock is detected.
Sourcepub const fn no_step_limit(self) -> Self
pub const fn no_step_limit(self) -> Self
Disables the step limit.
Sourcepub fn with_chaos(self, config: ChaosConfig) -> Self
pub fn with_chaos(self, config: ChaosConfig) -> Self
Enables chaos injection with the given configuration.
The chaos seed is honored as follows:
- If the caller set an explicit, non-zero seed on the
ChaosConfig(e.g. viaChaosConfig::neworChaosConfig::with_seed, such as from aCHAOS_SEEDreproduction), that seed is used verbatim so the run is byte-for-byte reproducible from the chaos seed alone. - Otherwise (the preset path —
ChaosConfig::light/ChaosConfig::heavycarry seed0), the chaos seed is derived deterministically from the runtime seed so chaos is still reproducible fromLabConfig::new(seed).
Sourcepub fn with_light_chaos(self) -> Self
pub fn with_light_chaos(self) -> Self
Enables light chaos (suitable for CI).
Sourcepub fn with_heavy_chaos(self) -> Self
pub fn with_heavy_chaos(self) -> Self
Enables heavy chaos (thorough testing).
Sourcepub fn with_replay_recording(self, config: RecorderConfig) -> Self
pub fn with_replay_recording(self, config: RecorderConfig) -> Self
Enables replay recording with the given configuration.
Sourcepub fn with_default_replay_recording(self) -> Self
pub fn with_default_replay_recording(self) -> Self
Enables replay recording with default configuration.
Sourcepub const fn with_auto_advance(self) -> Self
pub const fn with_auto_advance(self) -> Self
Enables automatic time advancement when all tasks are idle.
When enabled, run_with_auto_advance() will jump virtual time to the
next timer deadline whenever the scheduler has no runnable tasks,
enabling instant timeout testing.
Sourcepub fn has_replay_recording(&self) -> bool
pub fn has_replay_recording(&self) -> bool
Returns true if replay recording is enabled.
Sourcepub const fn with_cancellation_oracle(self, enable: bool) -> Self
pub const fn with_cancellation_oracle(self, enable: bool) -> Self
Enables or disables real-time cancellation protocol oracle verification.
Sourcepub const fn panic_on_cancellation_violation(self, value: bool) -> Self
pub const fn panic_on_cancellation_violation(self, value: bool) -> Self
Sets whether to panic on cancellation protocol violations.
When false, violations are logged as warnings instead of panicking.
Sourcepub const fn with_cancellation_oracle_warnings(self) -> Self
pub const fn with_cancellation_oracle_warnings(self) -> Self
Enables cancellation oracle in warning mode (logs violations but doesn’t panic).
Sourcepub const fn has_cancellation_oracle(&self) -> bool
pub const fn has_cancellation_oracle(&self) -> bool
Returns true if real-time cancellation protocol oracle verification is enabled.
Sourcepub fn with_oracles(self, names: &[&str]) -> Result<Self, OracleRegistryError>
pub fn with_oracles(self, names: &[&str]) -> Result<Self, OracleRegistryError>
Selects reportable lab oracles by registry name.
Passing an empty slice or ORACLE_ALL selects every
OracleSuite::report entry. Unknown names fail closed and return the
registry error with a valid-name list and suggestion.
Sourcepub fn selected_oracles(&self) -> Result<Vec<&'static str>, OracleRegistryError>
pub fn selected_oracles(&self) -> Result<Vec<&'static str>, OracleRegistryError>
Resolves the configured oracle selection to reportable registry names.