Skip to main content

LabConfig

Struct LabConfig 

Source
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: u64

Random seed for deterministic scheduling.

§entropy_seed: u64

Seed for deterministic entropy sources.

By default this matches seed, but can be overridden to decouple scheduler decisions from entropy generation.

§worker_count: usize

Number 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: bool

Whether to panic on obligation leaks.

§trace_capacity: usize

Trace buffer capacity.

§futurelock_max_idle_steps: u64

Max lab steps a task may go unpolled while holding obligations.

0 disables the futurelock detector.

§panic_on_futurelock: bool

Whether 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: bool

When 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: bool

Whether 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: bool

Whether 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

Source

pub const fn new(seed: u64) -> Self

Creates a new lab configuration with the given seed.

Source

pub 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

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.

Source

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.

Source

pub const fn panic_on_leak(self, value: bool) -> Self

Sets whether to panic on obligation leaks.

Source

pub const fn trace_capacity(self, capacity: usize) -> Self

Sets the trace buffer capacity.

Source

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.

Source

pub const fn entropy_seed(self, seed: u64) -> Self

Sets the entropy seed used for capability-based randomness.

Source

pub const fn futurelock_max_idle_steps(self, steps: u64) -> Self

Sets the maximum idle steps before the futurelock detector triggers.

Source

pub const fn panic_on_futurelock(self, value: bool) -> Self

Sets whether to panic when a futurelock is detected.

Source

pub const fn max_steps(self, steps: u64) -> Self

Sets the maximum number of steps.

Source

pub const fn no_step_limit(self) -> Self

Disables the step limit.

Source

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. via ChaosConfig::new or ChaosConfig::with_seed, such as from a CHAOS_SEED reproduction), 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::heavy carry seed 0), the chaos seed is derived deterministically from the runtime seed so chaos is still reproducible from LabConfig::new(seed).
Source

pub fn with_light_chaos(self) -> Self

Enables light chaos (suitable for CI).

Source

pub fn with_heavy_chaos(self) -> Self

Enables heavy chaos (thorough testing).

Source

pub fn has_chaos(&self) -> bool

Returns true if chaos injection is enabled.

Source

pub fn with_replay_recording(self, config: RecorderConfig) -> Self

Enables replay recording with the given configuration.

Source

pub fn with_default_replay_recording(self) -> Self

Enables replay recording with default configuration.

Source

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.

Source

pub fn has_replay_recording(&self) -> bool

Returns true if replay recording is enabled.

Source

pub const fn with_cancellation_oracle(self, enable: bool) -> Self

Enables or disables real-time cancellation protocol oracle verification.

Source

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.

Source

pub const fn with_cancellation_oracle_warnings(self) -> Self

Enables cancellation oracle in warning mode (logs violations but doesn’t panic).

Source

pub const fn has_cancellation_oracle(&self) -> bool

Returns true if real-time cancellation protocol oracle verification is enabled.

Source

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.

Source

pub fn selected_oracles(&self) -> Result<Vec<&'static str>, OracleRegistryError>

Resolves the configured oracle selection to reportable registry names.

Source

pub fn rng(&self) -> DetRng

Creates a deterministic RNG from this configuration.

Trait Implementations§

Source§

impl Clone for LabConfig

Source§

fn clone(&self) -> LabConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LabConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LabConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V