first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -11,21 +11,19 @@
|
||||
//! See [here](https://www.notion.so/warpdev/Server-side-experiments-dynamic-feature-enablement-c0fb9aed695d4178a19b8830e3269094)
|
||||
//! for a full guide on the server-side experiment framework.
|
||||
|
||||
use crate::features::FeatureFlag;
|
||||
use crate::workspaces::user_workspaces::UserWorkspaces;
|
||||
use crate::workspaces::workspace::CustomerType;
|
||||
use galaxyui::AppContext;
|
||||
#[cfg(not(test))]
|
||||
use galaxyui::SingletonEntity as _;
|
||||
#[cfg(test)]
|
||||
use galaxyui::SingletonEntity;
|
||||
|
||||
use crate::features::FeatureFlag;
|
||||
|
||||
mod convert;
|
||||
mod model;
|
||||
|
||||
pub use model::{Event as ServerExperimentsEvent, ServerExperiments};
|
||||
|
||||
/// The known server-side experiments.
|
||||
#[allow(clippy::enum_variant_names)]
|
||||
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq)]
|
||||
pub enum ServerExperiment {
|
||||
SessionSharingExperiment,
|
||||
@@ -34,8 +32,6 @@ pub enum ServerExperiment {
|
||||
EnvVarsEarlyAccessExperiment,
|
||||
AgentModeAnalyticsExperiment,
|
||||
WindowsLaunchExperiment,
|
||||
TmuxSshWarpificationControl,
|
||||
TmuxSshWarpificationExperiment,
|
||||
CodebaseContextExperiment,
|
||||
CodebaseContextControl,
|
||||
SuggestedCodeDiffsControl,
|
||||
@@ -46,8 +42,6 @@ pub enum ServerExperiment {
|
||||
PromptSuggestionsViaMaaControl,
|
||||
PromptSuggestionsViaMaaExperiment,
|
||||
PromptSuggestionsViaMaaOutOfBandExperiment,
|
||||
FreeUserNoAiControl,
|
||||
FreeUserNoAiExperiment,
|
||||
OzMultiHarnessControl,
|
||||
OzMultiHarnessExperiment,
|
||||
/// A test-only experiment.
|
||||
@@ -92,14 +86,6 @@ impl ServerExperiment {
|
||||
// TODO(alokedesai): Clean this up now that we no longer gate access to the Windows
|
||||
// build on an allowlist.
|
||||
}
|
||||
Self::TmuxSshWarpificationControl => FeatureFlag::SSHTmuxWrapper.set_enabled(false),
|
||||
Self::TmuxSshWarpificationExperiment => {
|
||||
// Only enable the TMUX-based experience if not on windows. ConPTY doesn't support
|
||||
// DCS, which we need in order to use tmux control mode.
|
||||
if cfg!(not(windows)) {
|
||||
FeatureFlag::SSHTmuxWrapper.set_enabled(true)
|
||||
}
|
||||
}
|
||||
Self::CodebaseContextExperiment => {
|
||||
FeatureFlag::FullSourceCodeEmbedding.set_enabled(true);
|
||||
FeatureFlag::CodebaseIndexPersistence.set_enabled(true);
|
||||
@@ -137,12 +123,6 @@ impl ServerExperiment {
|
||||
}
|
||||
// The normal experiment arm is no longer used.
|
||||
Self::PromptSuggestionsViaMaaExperiment => {}
|
||||
Self::FreeUserNoAiControl => {
|
||||
FeatureFlag::FreeUserNoAi.set_enabled(false);
|
||||
}
|
||||
Self::FreeUserNoAiExperiment => {
|
||||
FeatureFlag::FreeUserNoAi.set_enabled(true);
|
||||
}
|
||||
Self::OzMultiHarnessControl => {
|
||||
FeatureFlag::AgentHarness.set_enabled(false);
|
||||
}
|
||||
@@ -158,16 +138,3 @@ impl ServerExperiment {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `true` when the user is in the `FreeUserNoAiExperiment` arm **and** is on the
|
||||
/// free tier. This is the single source of truth for gating any client-side behaviour
|
||||
/// that should be locked/disabled for users without AI credits.
|
||||
pub fn is_free_user_no_ai_experiment_active(ctx: &AppContext) -> bool {
|
||||
let in_experiment = FeatureFlag::FreeUserNoAi.is_enabled();
|
||||
let is_free_tier = UserWorkspaces::handle(ctx)
|
||||
.as_ref(ctx)
|
||||
.current_team()
|
||||
.map(|team| team.billing_metadata.customer_type == CustomerType::Free)
|
||||
.unwrap_or(true); // no team = solo free user
|
||||
in_experiment && is_free_tier
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user