lightspeed/ops/contention_harness

Deterministic durable-store contention profiling harness for M37.

Types

Tunable contention budget for one scenario.

pub type Budget {
  Budget(
    scenario: Scenario,
    max_lease_window_p95_ms: Int,
    max_checkpoint_window_events: Int,
    max_replay_window_ms: Int,
    max_queue_depth: Int,
    max_retry_attempts: Int,
  )
}

Constructors

  • Budget(
      scenario: Scenario,
      max_lease_window_p95_ms: Int,
      max_checkpoint_window_events: Int,
      max_replay_window_ms: Int,
      max_queue_depth: Int,
      max_retry_attempts: Int,
    )

One contention-budget evaluation result.

pub type BudgetResult {
  BudgetResult(scenario: Scenario, passed: Bool, reason: String)
}

Constructors

  • BudgetResult(scenario: Scenario, passed: Bool, reason: String)

Durable-store contention profile metrics.

pub type Metrics {
  Metrics(
    ownership_conflicts: Int,
    split_brain_rejections: Int,
    stale_owner_rejections: Int,
    invalid_token_rejections: Int,
    takeover_successes: Int,
    lease_window_p95_ms: Int,
    lease_queue_peak: Int,
    takeover_queue_peak: Int,
    retry_attempts: Int,
    checkpoint_window_events: Int,
    replay_window_ms: Int,
  )
}

Constructors

  • Metrics(
      ownership_conflicts: Int,
      split_brain_rejections: Int,
      stale_owner_rejections: Int,
      invalid_token_rejections: Int,
      takeover_successes: Int,
      lease_window_p95_ms: Int,
      lease_queue_peak: Int,
      takeover_queue_peak: Int,
      retry_attempts: Int,
      checkpoint_window_events: Int,
      replay_window_ms: Int,
    )

Full M37 report.

pub type Report {
  Report(
    outcomes: List(ScenarioOutcome),
    budget_results: List(BudgetResult),
    failed_scenarios: Int,
    nondeterministic_failures: Int,
    invariant_failures: Int,
    failed_budgets: Int,
  )
}

Constructors

  • Report(
      outcomes: List(ScenarioOutcome),
      budget_results: List(BudgetResult),
      failed_scenarios: Int,
      nondeterministic_failures: Int,
      invariant_failures: Int,
      failed_budgets: Int,
    )

M37 contention-profiling scenarios.

pub type Scenario {
  OwnershipFencingContention
  LeaseRenewalContention
  TakeoverQueueRetryPressure
  CheckpointReplayWindows
}

Constructors

  • OwnershipFencingContention
  • LeaseRenewalContention
  • TakeoverQueueRetryPressure
  • CheckpointReplayWindows

One contention scenario outcome.

pub type ScenarioOutcome {
  ScenarioOutcome(
    scenario: Scenario,
    passed: Bool,
    deterministic: Bool,
    invariants_met: Bool,
    signature: String,
    profile: Metrics,
  )
}

Constructors

  • ScenarioOutcome(
      scenario: Scenario,
      passed: Bool,
      deterministic: Bool,
      invariants_met: Bool,
      signature: String,
      profile: Metrics,
    )

Values

pub fn budget_failures(results: List(BudgetResult)) -> Int

Count failing budget checks.

pub fn budget_results(report: Report) -> List(BudgetResult)

Report budget-results accessor.

pub const budget_version: Int
pub fn budget_version_label() -> String

M37 budget profile version label.

pub fn default_budget() -> List(Budget)

Default deterministic M37 contention budgets.

pub fn deterministic(outcome: ScenarioOutcome) -> Bool

Scenario determinism accessor.

pub fn evaluate_budget(
  outcomes: List(ScenarioOutcome),
  budgets: List(Budget),
) -> List(BudgetResult)

Evaluate one outcome list against one budget profile.

pub fn failed_budgets(report: Report) -> Int

Failed budget count.

pub fn failed_scenarios(report: Report) -> Int

Failed scenario count.

pub fn invariant_failures(report: Report) -> Int

Invariant failure count.

pub fn invariants_met(outcome: ScenarioOutcome) -> Bool

Scenario invariant accessor.

pub fn metrics_signature(metrics: Metrics) -> String

Stable metrics signature.

pub fn nondeterministic_failures(report: Report) -> Int

Nondeterministic scenario count.

pub fn outcomes(report: Report) -> List(ScenarioOutcome)

Report outcomes accessor.

pub fn pass_fail_label(outcome: ScenarioOutcome) -> String

Stable pass/fail label.

pub fn profile_metrics(outcome: ScenarioOutcome) -> Metrics

Scenario profile accessor.

pub fn report_signature(report: Report) -> String

Stable report signature.

pub fn run_matrix() -> Report

Run all M37 scenarios and evaluate default contention budgets.

pub fn run_scenario(scenario: Scenario) -> ScenarioOutcome

Run one M37 scenario twice and require deterministic parity.

pub fn scenario(outcome: ScenarioOutcome) -> Scenario

Scenario accessor.

pub fn scenario_label(scenario: Scenario) -> String

Scenario label.

pub fn signature(outcome: ScenarioOutcome) -> String

Scenario signature accessor.

pub fn snapshot_report_markdown() -> String

Deterministic markdown report for M37 fixture scripts.

pub fn snapshot_signature() -> String

Deterministic snapshot signature for M37 drift gates.

pub const snapshot_version: Int
Search Document