Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -379,3 +379,16 @@ include = ["."]
# Paths/patterns to exclude from the snapshot.
# (default: target/, .git/, .worktrees/, *.db, *.log)
exclude = ["target/", ".git/", ".worktrees/", "*.db", "*.log"]

# Ghost performance leaderboard and A/B testing.
# Run `sparks leaderboard show` to view rankings, or `sparks leaderboard compare ghost-a ghost-b`.
[leaderboard]
enabled = true
# Ghost name to A/B test against the default ghost. Omit or leave empty to disable A/B routing.
# ab_test_ghost = "experimental-coder"
# Fraction of requests routed to the challenger ghost (0.0 = never, 1.0 = always).
ab_test_fraction = 0.1
# Minimum recorded samples before a promotion recommendation is surfaced.
min_samples_for_recommendation = 50
# Success-rate improvement (as a fraction) required to trigger a promotion recommendation.
promotion_threshold = 0.10
40 changes: 40 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ pub struct Config {
pub sonarqube: SonarqubeConfig,
#[serde(default)]
pub snapshot: SnapshotConfig,
#[serde(default)]
pub leaderboard: LeaderboardConfig,
#[serde(skip)]
inline_secret_labels: Vec<String>,
}
Expand Down Expand Up @@ -1505,6 +1507,43 @@ impl ManagerConfig {
}
}

// ── Leaderboard config ────────────────────────────────────────────────

#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct LeaderboardConfig {
/// Enable leaderboard tracking (default: true)
#[serde(default = "default_lb_enabled")]
pub enabled: bool,
/// Ghost name to A/B test against the default ghost (None = disabled)
pub ab_test_ghost: Option<String>,
/// Fraction of requests routed to the challenger ghost (0.0-1.0, default: 0.1)
#[serde(default = "default_ab_fraction")]
pub ab_test_fraction: f64,
/// Minimum samples before auto-promotion recommendation (default: 50)
#[serde(default = "default_lb_min_samples")]
pub min_samples_for_recommendation: u64,
/// Success rate improvement threshold for auto-promotion (default: 0.10 = 10%)
#[serde(default = "default_lb_threshold")]
pub promotion_threshold: f64,
}

fn default_lb_enabled() -> bool { true }
fn default_ab_fraction() -> f64 { 0.1 }
fn default_lb_min_samples() -> u64 { 50 }
fn default_lb_threshold() -> f64 { 0.10 }

impl Default for LeaderboardConfig {
fn default() -> Self {
Self {
enabled: default_lb_enabled(),
ab_test_ghost: None,
ab_test_fraction: default_ab_fraction(),
min_samples_for_recommendation: default_lb_min_samples(),
promotion_threshold: default_lb_threshold(),
}
}
}

impl Default for Config {
fn default() -> Self {
Self {
Expand Down Expand Up @@ -1538,6 +1577,7 @@ impl Default for Config {
alerts: AlertsConfig::default(),
sonarqube: SonarqubeConfig::default(),
snapshot: SnapshotConfig::default(),
leaderboard: LeaderboardConfig::default(),
inline_secret_labels: Vec::new(),
}
}
Expand Down
Loading
Loading