pub struct LabConfig {Show 13 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,
}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.
Implementations§
Source§impl LabConfig
impl LabConfig
Sourcepub fn from_time() -> LabConfig
👎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() -> LabConfig
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(seed)] 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() -> LabConfig
pub fn from_time_unstable() -> LabConfig
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(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) -> LabConfig
pub const fn panic_on_leak(self, value: bool) -> LabConfig
Sets whether to panic on obligation leaks.
Sourcepub const fn trace_capacity(self, capacity: usize) -> LabConfig
pub const fn trace_capacity(self, capacity: usize) -> LabConfig
Sets the trace buffer capacity.
Sourcepub const fn worker_count(self, count: usize) -> LabConfig
pub const fn worker_count(self, count: usize) -> LabConfig
Sets the number of virtual workers to model.
Values less than 1 are clamped to 1.
Sourcepub const fn entropy_seed(self, seed: u64) -> LabConfig
pub const fn entropy_seed(self, seed: u64) -> LabConfig
Sets the entropy seed used for capability-based randomness.
Sourcepub const fn futurelock_max_idle_steps(self, steps: u64) -> LabConfig
pub const fn futurelock_max_idle_steps(self, steps: u64) -> LabConfig
Sets the maximum idle steps before the futurelock detector triggers.
Sourcepub const fn panic_on_futurelock(self, value: bool) -> LabConfig
pub const fn panic_on_futurelock(self, value: bool) -> LabConfig
Sets whether to panic when a futurelock is detected.
Sourcepub const fn no_step_limit(self) -> LabConfig
pub const fn no_step_limit(self) -> LabConfig
Disables the step limit.
Sourcepub fn with_chaos(self, config: ChaosConfig) -> LabConfig
pub fn with_chaos(self, config: ChaosConfig) -> LabConfig
Enables chaos injection with the given configuration.
The chaos seed will be derived from the main seed for determinism.
Sourcepub fn with_light_chaos(self) -> LabConfig
pub fn with_light_chaos(self) -> LabConfig
Enables light chaos (suitable for CI).
Sourcepub fn with_heavy_chaos(self) -> LabConfig
pub fn with_heavy_chaos(self) -> LabConfig
Enables heavy chaos (thorough testing).
Sourcepub fn with_replay_recording(self, config: RecorderConfig) -> LabConfig
pub fn with_replay_recording(self, config: RecorderConfig) -> LabConfig
Enables replay recording with the given configuration.
Sourcepub fn with_default_replay_recording(self) -> LabConfig
pub fn with_default_replay_recording(self) -> LabConfig
Enables replay recording with default configuration.
Sourcepub const fn with_auto_advance(self) -> LabConfig
pub const fn with_auto_advance(self) -> LabConfig
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) -> LabConfig
pub const fn with_cancellation_oracle(self, enable: bool) -> LabConfig
Enables or disables real-time cancellation protocol oracle verification.
Sourcepub const fn panic_on_cancellation_violation(self, value: bool) -> LabConfig
pub const fn panic_on_cancellation_violation(self, value: bool) -> LabConfig
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) -> LabConfig
pub const fn with_cancellation_oracle_warnings(self) -> LabConfig
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.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for LabConfig
impl !UnwindSafe for LabConfig
impl Freeze for LabConfig
impl Send for LabConfig
impl Sync for LabConfig
impl Unpin for LabConfig
impl UnsafeUnpin for LabConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more