From 3e12c2b5b6e00ae2ac282e069558ffef36885188 Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Thu, 23 Nov 2023 10:10:37 +0200 Subject: [PATCH] Chore: remove disableEnvsOnRevive flag (#5391) Closes # [1-1646](https://linear.app/unleash/issue/1-1646/clean-disableenvsonrevive-flag-for-release) --------- Signed-off-by: andreas-unleash --- .../archive/ArchiveTable/ArchiveTable.test.tsx | 11 ++++------- .../ArchivedFeatureReviveConfirm.tsx | 14 ++++---------- frontend/src/interfaces/uiConfig.ts | 1 - .../__snapshots__/create-config.test.ts.snap | 1 - .../feature-toggle/feature-toggle-service.ts | 17 ++++++----------- .../tests/archive-feature-toggles.e2e.test.ts | 1 - .../tests/last-seen-service.e2e.test.ts | 1 - src/lib/types/experimental.ts | 5 ----- src/server-dev.ts | 2 -- .../e2e/api/admin/feature-archive.e2e.test.ts | 1 - 10 files changed, 14 insertions(+), 40 deletions(-) diff --git a/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx b/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx index ff3da0844a..b4e3eb362e 100644 --- a/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx +++ b/frontend/src/component/archive/ArchiveTable/ArchiveTable.test.tsx @@ -54,7 +54,7 @@ const Component = () => { const server = testServerSetup(); -const setupApi = (disableEnvsOnRevive = false) => { +const setupApi = () => { testServerRoute( server, '/api/admin/projects/default/revive', @@ -65,9 +65,6 @@ const setupApi = (disableEnvsOnRevive = false) => { testServerRoute(server, '/api/admin/ui-config', { environment: 'Open Source', - flags: { - disableEnvsOnRevive, - }, }); }; @@ -79,7 +76,7 @@ test('should load the table', async () => { }); test('should show confirm dialog when reviving toggle', async () => { - setupApi(false); + setupApi(); render( <> @@ -104,7 +101,7 @@ test('should show confirm dialog when reviving toggle', async () => { }); test('should show confirm dialog when batch reviving toggle', async () => { - setupApi(false); + setupApi(); render( <> @@ -135,7 +132,7 @@ test('should show confirm dialog when batch reviving toggle', async () => { }); test('should show info box when disableAllEnvsOnRevive flag is on', async () => { - setupApi(true); + setupApi(); render( <> diff --git a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx index b292fb522e..4d4e525b3e 100644 --- a/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx +++ b/frontend/src/component/archive/ArchiveTable/ArchivedFeatureActionCell/ArchivedFeatureReviveConfirm/ArchivedFeatureReviveConfirm.tsx @@ -28,7 +28,6 @@ export const ArchivedFeatureReviveConfirm = ({ }: IArchivedFeatureReviveConfirmProps) => { const { setToastData, setToastApiError } = useToast(); const { reviveFeatures } = useProjectApi(); - const disableAllEnvsOnRevive = useUiFlag('disableEnvsOnRevive'); const onReviveFeatureToggle = async () => { try { @@ -70,15 +69,10 @@ export const ArchivedFeatureReviveConfirm = ({ onClick={onReviveFeatureToggle} onClose={clearModal} > - - Revived feature toggles will be automatically disabled - in all environments - - } - /> + + Revived feature toggles will be automatically disabled in all + environments + 1} diff --git a/frontend/src/interfaces/uiConfig.ts b/frontend/src/interfaces/uiConfig.ts index 5193a4d764..24e07a82a3 100644 --- a/frontend/src/interfaces/uiConfig.ts +++ b/frontend/src/interfaces/uiConfig.ts @@ -65,7 +65,6 @@ export type UiFlags = { privateProjects?: boolean; dependentFeatures?: boolean; banners?: boolean; - disableEnvsOnRevive?: boolean; playgroundImprovements?: boolean; scheduledConfigurationChanges?: boolean; featureSearchAPI?: boolean; diff --git a/src/lib/__snapshots__/create-config.test.ts.snap b/src/lib/__snapshots__/create-config.test.ts.snap index 4e01c543cc..7a0d59fd80 100644 --- a/src/lib/__snapshots__/create-config.test.ts.snap +++ b/src/lib/__snapshots__/create-config.test.ts.snap @@ -78,7 +78,6 @@ exports[`should create default config 1`] = ` "dependentFeatures": false, "detectSegmentUsageInChangeRequests": false, "disableBulkToggle": false, - "disableEnvsOnRevive": false, "disableMetrics": false, "disableNotifications": false, "embedProxy": true, diff --git a/src/lib/features/feature-toggle/feature-toggle-service.ts b/src/lib/features/feature-toggle/feature-toggle-service.ts index 4bc977e6e8..b2fa4c3be5 100644 --- a/src/lib/features/feature-toggle/feature-toggle-service.ts +++ b/src/lib/features/feature-toggle/feature-toggle-service.ts @@ -1953,11 +1953,9 @@ class FeatureToggleService { ); await this.featureToggleStore.batchRevive(eligibleFeatureNames); - if (this.flagResolver.isEnabled('disableEnvsOnRevive')) { - await this.featureToggleStore.disableAllEnvironmentsForFeatures( - eligibleFeatureNames, - ); - } + await this.featureToggleStore.disableAllEnvironmentsForFeatures( + eligibleFeatureNames, + ); await this.eventService.storeEvents( eligibleFeatures.map( @@ -1974,12 +1972,9 @@ class FeatureToggleService { // TODO: add project id. async reviveFeature(featureName: string, createdBy: string): Promise { const toggle = await this.featureToggleStore.revive(featureName); - - if (this.flagResolver.isEnabled('disableEnvsOnRevive')) { - await this.featureToggleStore.disableAllEnvironmentsForFeatures([ - featureName, - ]); - } + await this.featureToggleStore.disableAllEnvironmentsForFeatures([ + featureName, + ]); await this.eventService.storeEvent( new FeatureRevivedEvent({ createdBy, diff --git a/src/lib/features/feature-toggle/tests/archive-feature-toggles.e2e.test.ts b/src/lib/features/feature-toggle/tests/archive-feature-toggles.e2e.test.ts index 4449ac02eb..4b3c0d15fd 100644 --- a/src/lib/features/feature-toggle/tests/archive-feature-toggles.e2e.test.ts +++ b/src/lib/features/feature-toggle/tests/archive-feature-toggles.e2e.test.ts @@ -16,7 +16,6 @@ beforeAll(async () => { experimental: { flags: { strictSchemaValidation: true, - disableEnvsOnRevive: true, }, }, }, diff --git a/src/lib/services/client-metrics/last-seen/tests/last-seen-service.e2e.test.ts b/src/lib/services/client-metrics/last-seen/tests/last-seen-service.e2e.test.ts index ea99f96500..6594a86fab 100644 --- a/src/lib/services/client-metrics/last-seen/tests/last-seen-service.e2e.test.ts +++ b/src/lib/services/client-metrics/last-seen/tests/last-seen-service.e2e.test.ts @@ -16,7 +16,6 @@ beforeAll(async () => { experimental: { flags: { strictSchemaValidation: true, - disableEnvsOnRevive: true, useLastSeenRefactor: true, }, }, diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index a73b37b844..e179dcae18 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -28,7 +28,6 @@ export type IFlagKey = | 'disableMetrics' | 'useLastSeenRefactor' | 'banners' - | 'disableEnvsOnRevive' | 'playgroundImprovements' | 'featureSearchAPI' | 'featureSearchFrontend' @@ -129,10 +128,6 @@ const flags: IFlags = { process.env.UNLEASH_EXPERIMENTAL_USE_LAST_SEEN_REFACTOR, false, ), - disableEnvsOnRevive: parseEnvVarBoolean( - process.env.UNLEASH_EXPERIMENTAL_DISABLE_ENVS_ON_REVIVE, - false, - ), playgroundImprovements: parseEnvVarBoolean( process.env.UNLEASH_EXPERIMENTAL_PLAYGROUND_IMPROVEMENTS, false, diff --git a/src/server-dev.ts b/src/server-dev.ts index 9d6f743ad9..dd502c8586 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -41,8 +41,6 @@ process.nextTick(async () => { privateProjects: true, dependentFeatures: true, useLastSeenRefactor: true, - disableEnvsOnRevive: true, - playgroundImprovements: true, featureSearchAPI: true, featureSearchFrontend: false, }, diff --git a/src/test/e2e/api/admin/feature-archive.e2e.test.ts b/src/test/e2e/api/admin/feature-archive.e2e.test.ts index a29bb5670e..cd96cc5927 100644 --- a/src/test/e2e/api/admin/feature-archive.e2e.test.ts +++ b/src/test/e2e/api/admin/feature-archive.e2e.test.ts @@ -18,7 +18,6 @@ beforeAll(async () => { flags: { strictSchemaValidation: true, dependentFeatures: true, - disableEnvsOnRevive: true, }, }, },