Skip to content

Commit

Permalink
No longer gate using the streaming orchestrator via a feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
shepmaster committed Oct 20, 2023
1 parent 2b4ffe1 commit 6059123
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 56 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,6 @@ jobs:
killall -q ui || true
chmod +x ./server/ui && ./server/ui &
bundle exec rspec
- name: Run tests with feature flags
env:
PLAYGROUND_UI_ROOT: server/build/
PLAYGROUND_CORS_ENABLED: true
PLAYGROUND_GITHUB_TOKEN: "${{ secrets.PLAYGROUND_GITHUB_TOKEN }}"
PLAYGROUND_EXECUTE_VIA_WEBSOCKET_THRESHOLD: 1.0
run: |-
killall -q ui || true
chmod +x ./server/ui && ./server/ui &
bundle exec rspec
- name: Preserve screenshots
if: "${{ failure() }}"
uses: actions/upload-artifact@v3
Expand Down
11 changes: 0 additions & 11 deletions ci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,17 +357,6 @@ workflows:
chmod +x ./server/ui && ./server/ui &
bundle exec rspec
- name: "Run tests with feature flags"
env:
PLAYGROUND_UI_ROOT: server/build/
PLAYGROUND_CORS_ENABLED: true
PLAYGROUND_GITHUB_TOKEN: ${{ secrets.PLAYGROUND_GITHUB_TOKEN }}
PLAYGROUND_EXECUTE_VIA_WEBSOCKET_THRESHOLD: 1.0
run: |-
killall -q ui || true
chmod +x ./server/ui && ./server/ui &
bundle exec rspec
- name: "Preserve screenshots"
if: ${{ failure() }}
uses: actions/upload-artifact@v3
Expand Down
11 changes: 1 addition & 10 deletions ui/frontend/reducers/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { createWebsocketResponse } from '../websocketActions';
interface State {
forced: boolean;
showGemThreshold: number;
executeViaWebsocketThreshold: number;
}

const ENABLED = 1.0;
Expand All @@ -15,14 +14,12 @@ const DISABLED = -1.0;
const initialState: State = {
forced: false,
showGemThreshold: DISABLED,
executeViaWebsocketThreshold: DISABLED,
};

const { action: wsFeatureFlags, schema: wsFeatureFlagsSchema } = createWebsocketResponse(
'featureFlags',
z.object({
showGemThreshold: z.number().nullish(),
executeViaWebsocketThreshold: z.number().nullish(),
}),
);

Expand All @@ -33,12 +30,10 @@ const slice = createSlice({
forceEnableAll: (state) => {
state.forced = true;
state.showGemThreshold = ENABLED;
state.executeViaWebsocketThreshold = ENABLED;
},
forceDisableAll: (state) => {
state.forced = true;
state.showGemThreshold = DISABLED;
state.executeViaWebsocketThreshold = DISABLED;
},
},
extraReducers: (builder) => {
Expand All @@ -47,15 +42,11 @@ const slice = createSlice({
return;
}

const { showGemThreshold, executeViaWebsocketThreshold } = action.payload;
const { showGemThreshold } = action.payload;

if (showGemThreshold) {
state.showGemThreshold = showGemThreshold;
}

if (executeViaWebsocketThreshold) {
state.executeViaWebsocketThreshold = executeViaWebsocketThreshold;
}
});
},
});
Expand Down
9 changes: 2 additions & 7 deletions ui/frontend/selectors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,18 +353,13 @@ const websocket = (state: State) => state.websocket;
const clientFeatureFlagThreshold = createSelector(client, (c) => c.featureFlagThreshold);

const showGemThreshold = createSelector(featureFlags, ff => ff.showGemThreshold);
const executeViaWebsocketThreshold = createSelector(featureFlags, ff => ff.executeViaWebsocketThreshold);

const createFeatureFlagSelector = (ff: (state: State) => number) =>
createSelector(clientFeatureFlagThreshold, ff, (c, ff) => c <= ff);

export const showGemSelector = createFeatureFlagSelector(showGemThreshold);
const wsFeatureEnabled = createFeatureFlagSelector(executeViaWebsocketThreshold);
export const executeViaWebsocketSelector = createSelector(
websocket,
wsFeatureEnabled,
(ws, enabled) => ws.connected && enabled,
);

export const executeViaWebsocketSelector = createSelector(websocket, (ws) => ws.connected);

export type WebSocketStatus =
{ state: 'disconnected' } |
Expand Down
13 changes: 2 additions & 11 deletions ui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ fn main() {
}

#[derive(Copy, Clone)]
pub(crate) struct FeatureFlags {
execute_via_websocket_threshold: Option<f64>,
}
pub(crate) struct FeatureFlags {}

struct Config {
address: String,
Expand Down Expand Up @@ -99,14 +97,7 @@ impl Config {

let cors_enabled = env::var_os("PLAYGROUND_CORS_ENABLED").is_some();

let execute_via_websocket_threshold =
env::var("PLAYGROUND_EXECUTE_VIA_WEBSOCKET_THRESHOLD")
.ok()
.and_then(|v| v.parse().ok());

let feature_flags = FeatureFlags {
execute_via_websocket_threshold,
};
let feature_flags = FeatureFlags {};

Self {
address,
Expand Down
10 changes: 3 additions & 7 deletions ui/src/server_axum/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,11 @@ struct WSError {

#[derive(Debug, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct FeatureFlags {
execute_via_websocket_threshold: Option<f64>,
}
pub(crate) struct FeatureFlags {}

impl From<crate::FeatureFlags> for FeatureFlags {
fn from(value: crate::FeatureFlags) -> Self {
Self {
execute_via_websocket_threshold: value.execute_via_websocket_threshold,
}
fn from(_value: crate::FeatureFlags) -> Self {
Self {}
}
}

Expand Down

0 comments on commit 6059123

Please sign in to comment.