:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(flags): add "Archive selected" bulk action to the flag list (#79056)
Phill99e172f667df
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 53c1e4dfe94a..94fd5ae4f388 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -5999,9 +5999,9 @@ snapshots:scenes-app-feature-flags--feature-flag-not-found--light:hash: v1.k794b7964.9760899dc54ed1457b2f2790151da4dced7ce03ba2db211fc8987584331225f7.NwLOFpddIBI2MKFCF_nA7ICbR7JCJISgydgqg4pdPWgscenes-app-feature-flags--feature-flags-list--dark:- hash: v1.k794b7964.2f5af54558a024f1d656ce05ef18fa9f90f6355f192183eb071046cf0c2afaff.JTL2zWJrw55ycrqJk7bBHxt7Rpoxe47CBBB-9AePA3w+ hash: v1.k794b7964.2a8bf55f3852eed60e170e59d7c7dc92a1f4e5f16f84607c1629425e9d7d72dd.0pOqy8BtWrsh0SQEzAIUKpmbh4uZdg-omqzrwkuN494scenes-app-feature-flags--feature-flags-list--light:- hash: v1.k794b7964.35cbcea4243c5cdfd91879a784ff770bedef0fe850d4c0e9a8b8828cdd0c5a69.fbegKdysB5dwyTStypXSHos-FCtO_d4o85DO09OtJow+ hash: v1.k794b7964.18d16a7559246445191198e9aa84e26c74f955bef153b9bdc1c8764478e24800.1_zbdiVOfqIetvE9g5QyjDcOA0JS7yQUsey5JNyoTAMscenes-app-feature-flags--new-feature-flag--dark:hash: v1.k794b7964.c6ee9f73b8271c94a660d0545b0af273caa32694fef865203b08ae631c124e04.GpPjk_XVkt55IibjtehycEHD8-wRjSXz86y0ym0-IQsscenes-app-feature-flags--new-feature-flag--light:diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.tsindex 84e0e28058ad..a2d7c710ec11 100644--- a/frontend/src/lib/utils/eventUsageLogic.ts+++ b/frontend/src/lib/utils/eventUsageLogic.ts@@ -1362,6 +1362,15 @@ export interface eventUsageLogicActions {reportFeatureFlagScheduleSuccess: () => {value: true}+ reportFeatureFlagsBulkArchived: (+ archivedCount: number,+ pendingApprovalCount: number,+ failedCount: number+ ) => {+ archivedCount: number+ failedCount: number+ pendingApprovalCount: number+ }reportFlagsCodeExampleInteraction: (optionType: string) => {optionType: string}@@ -2658,6 +2667,11 @@ export const eventUsageLogic = kea<eventUsageLogicType>([projectCount,failedCount,}),+ reportFeatureFlagsBulkArchived: (archivedCount: number, pendingApprovalCount: number, failedCount: number) => ({+ archivedCount,+ pendingApprovalCount,+ failedCount,+ }),reportFeatureFlagScheduleSuccess: true,reportFeatureFlagScheduleFailure: (error) => ({ error }),reportInviteMembersButtonClicked: true,@@ -3880,6 +3894,13 @@ export const eventUsageLogic = kea<eventUsageLogicType>([failed_count: failedCount,})},+ reportFeatureFlagsBulkArchived: ({ archivedCount, pendingApprovalCount, failedCount }) => {+ posthog.capture('feature flags bulk archived', {+ archived_count: archivedCount,+ pending_approval_count: pendingApprovalCount,+ failed_count: failedCount,+ })+ },reportFeatureFlagScheduleSuccess: () => {posthog.capture('feature flag scheduled')},diff --git a/frontend/src/scenes/feature-flags/FeatureFlags.tsx b/frontend/src/scenes/feature-flags/FeatureFlags.tsxindex 74be190a7b35..ceb098b03b54 100644--- a/frontend/src/scenes/feature-flags/FeatureFlags.tsx+++ b/frontend/src/scenes/feature-flags/FeatureFlags.tsx@@ -2,7 +2,7 @@ import { useActions, useValues } from 'kea'import { combineUrl, router } from 'kea-router'import { useEffect, useRef, useState } from 'react'-import { IconLock, IconPlusSmall, IconTrash } from '@posthog/icons'+import { IconArchive, IconLock, IconPlusSmall, IconTrash } from '@posthog/icons'import { LemonButton, LemonDialog, LemonTag, lemonToast } from '@posthog/lemon-ui'import api from 'lib/api'@@ -60,11 +60,11 @@ import {import { ApprovalsPromoBanner } from './ApprovalsPromoBanner'import { BulkCopyFlagsModal, BulkCopyToProjectsButton } from './BulkCopyFlagsModal'import { BulkDeleteResultsModal } from './BulkDeleteResultsModal'-import { openFeatureFlagArchiveDialog } from './featureFlagArchiveDialog'+import { openBulkArchiveFlagsDialog, openFeatureFlagArchiveDialog } from './featureFlagArchiveDialog'import { openFeatureFlagDeleteDialog } from './featureFlagDeleteDialog'import { FeatureFlagFiltersSection } from './FeatureFlagFilters'import { FLAGS_PER_PAGE, FeatureFlagsTab, featureFlagsLogic, flagMatchesType } from './featureFlagsLogic'-import { flagSelectionLogic } from './flagSelectionLogic'+import { BULK_ARCHIVE_MAX_FLAGS, flagSelectionLogic } from './flagSelectionLogic'import { OverlayForNewFeatureFlagMenu } from './NewFeatureFlagMenu'import ProjectsGrid from './projects-grid/ProjectsGrid'@@ -372,8 +372,8 @@ export function OverviewTab({const { currentProjectId } = useValues(projectLogic)const { currentOrganization } = useValues(organizationLogic)const { paramsFromFilters } = useValues(featureFlagsLogic({}))- const { bulkDeleteResponseLoading } = useValues(flagSelectionLogic)- const { bulkDeleteFlags, openBulkCopyModal } = useActions(flagSelectionLogic)+ const { bulkDeleteResponseLoading, bulkArchiveRunning, bulkArchiveProgress } = useValues(flagSelectionLogic)+ const { bulkDeleteFlags, bulkArchiveFlags, openBulkCopyModal } = useActions(flagSelectionLogic)const [matchingFlagIds, setMatchingFlagIds] = useState<readonly number[] | null>(null)const [matchingFlagIdsLoading, setMatchingFlagIdsLoading] = useState(false)@@ -576,6 +576,17 @@ export function OverviewTab({<BulkDeleteResultsModal /><BulkCopyFlagsModal />+ {/*+ * Outside the selection toolbar, which unmounts as soon as the selection is cleared.+ * The region stays mounted and only its text changes, so screen readers announce each+ * update as a mutation — a region that appears already populated is not announced.+ */}+ <div className="text-muted text-sm" role="status" aria-live="polite">+ {bulkArchiveRunning && bulkArchiveProgress+ ? `Archiving flags… ${bulkArchiveProgress.done} of ${bulkArchiveProgress.total}`+ : null}+ </div>+<LemonTabledataSource={displayedFlags}columns={columns}@@ -674,6 +685,30 @@ export function OverviewTab({setMatchingFlagIds(null)}}/>+ {/* Nothing to archive when the list is already filtered to archived flags */}+ {filters.archived !== 'true' && (+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconArchive />}+ data-attr="bulk-archive-flags-button"+ loading={bulkArchiveRunning}+ disabledReason={+ ctx.selectedCount > BULK_ARCHIVE_MAX_FLAGS+ ? `Archiving supports up to ${BULK_ARCHIVE_MAX_FLAGS} flags at once`+ : undefined+ }+ onClick={() => {+ openBulkArchiveFlagsDialog(ctx.selectedCount, () => {+ bulkArchiveFlags([...ctx.selectedKeys])+ ctx.clearSelection()+ setMatchingFlagIds(null)+ })+ }}+ >+ Archive selected+ </LemonButton>+ )}<LemonButtontype="primary"status="danger"diff --git a/frontend/src/scenes/feature-flags/featureFlagArchiveDialog.tsx b/frontend/src/scenes/feature-flags/featureFlagArchiveDialog.tsxindex cd4938f589c2..cab57a4f6a5f 100644--- a/frontend/src/scenes/feature-flags/featureFlagArchiveDialog.tsx+++ b/frontend/src/scenes/feature-flags/featureFlagArchiveDialog.tsx@@ -2,6 +2,8 @@ import posthog from 'posthog-js'import { LemonDialog } from '@posthog/lemon-ui'+import { pluralize } from 'lib/utils/strings'+import { FeatureFlagType } from '~/types'export type FeatureFlagArchivedSource = 'archive-dialog' | 'disable-confirmation'@@ -37,3 +39,26 @@ export function openFeatureFlagArchiveDialog(},})}++/**+ * Opens the archive confirmation dialog for the flags selected in the list. The copy can't name a+ * single flag's state, so it warns about enabled flags in general.+ */+export function openBulkArchiveFlagsDialog(flagCount: number, onArchive: () => void): void {+ LemonDialog.open({+ title: `Archive ${pluralize(flagCount, 'flag')}?`,+ description:+ 'Any of these flags that are still enabled will be disabled and rolled back from users matching their release conditions. Flags that need approval to disable will create a change request instead of archiving. Archived flags are hidden from the flag list, but linked experiments and surveys keep their data. You can unarchive them at any time.',+ primaryButton: {+ children: 'Archive',+ type: 'primary',+ onClick: onArchive,+ size: 'small',+ },+ secondaryButton: {+ children: 'Cancel',+ type: 'tertiary',+ size: 'small',+ },+ })+}diff --git a/frontend/src/scenes/feature-flags/flagSelectionLogic.bulkArchive.test.ts b/frontend/src/scenes/feature-flags/flagSelectionLogic.bulkArchive.test.tsnew file mode 100644index 000000000000..431bb5dc5121--- /dev/null+++ b/frontend/src/scenes/feature-flags/flagSelectionLogic.bulkArchive.test.ts@@ -0,0 +1,105 @@+import { expectLogic } from 'kea-test-utils'++import { dispatchChangeRequestCreated } from 'scenes/approvals/utils'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'++import { BULK_ARCHIVE_MAX_FLAGS, flagSelectionLogic } from './flagSelectionLogic'++jest.mock('scenes/approvals/utils', () => ({+ ...jest.requireActual('scenes/approvals/utils'),+ dispatchChangeRequestCreated: jest.fn(),+}))++describe('flagSelectionLogic bulk archive', () => {+ let logic: ReturnType<typeof flagSelectionLogic.build>+ let archiveRequests: { id: number; body: Record<string, any> }[]++ function useArchiveMocks(archiveHandler: (id: number) => [number, any] = () => [200, {}]): void {+ archiveRequests = []+ useMocks({+ get: {+ '/api/projects/:team/feature_flags/': { count: 0, results: [] },+ },+ patch: {+ '/api/projects/:team/feature_flags/:id/': async ({ request, params }) => {+ const id = Number(params.id)+ archiveRequests.push({ id, body: (await request.json()) as Record<string, any> })+ return archiveHandler(id)+ },+ },+ })+ }++ beforeEach(() => {+ jest.clearAllMocks()+ initKeaTests()+ })++ afterEach(() => logic?.unmount())++ it('disables every selected flag as it archives it, then reloads the list', async () => {+ useArchiveMocks()+ logic = flagSelectionLogic()+ logic.mount()++ logic.actions.bulkArchiveFlags([1, 2])+ await expectLogic(logic).toDispatchActions(['bulkArchiveFlagsFinished', 'loadFeatureFlags'])++ // `active: false` matters: the API rejects an archived flag that is still enabled+ expect(archiveRequests).toEqual([+ { id: 1, body: { archived: true, active: false } },+ { id: 2, body: { archived: true, active: false } },+ ])+ expect(logic.values.bulkArchiveResult).toEqual({ archivedIds: [1, 2], failed: [] })+ expect(logic.values.bulkArchiveProgress).toEqual({ done: 2, total: 2 })+ expect(logic.values.bulkArchiveRunning).toBe(false)+ })++ it('keeps archiving the remaining flags when one needs approval and another fails', async () => {+ useArchiveMocks((id) => {+ if (id === 1) {+ return [409, { change_request_id: 'cr-1' }]+ }+ if (id === 2) {+ return [500, { detail: 'Server error' }]+ }+ return [200, {}]+ })+ logic = flagSelectionLogic()+ logic.mount()++ logic.actions.bulkArchiveFlags([1, 2, 3])+ await expectLogic(logic).toFinishAllListeners()++ expect(archiveRequests.map(({ id }) => id)).toEqual([1, 2, 3])+ expect(logic.values.bulkArchiveResult?.archivedIds).toEqual([3])+ expect(logic.values.bulkArchiveResult?.failed).toEqual([+ { id: 1, errorMessage: expect.any(String), approvalPending: true },+ { id: 2, errorMessage: 'Server error', approvalPending: false },+ ])+ // Only the approval-pending flag announces a change request; the 500 failure must not+ expect(dispatchChangeRequestCreated).toHaveBeenCalledTimes(1)+ expect(dispatchChangeRequestCreated).toHaveBeenCalledWith({ resourceType: 'feature_flag', resourceId: 1 })+ // Failed flags still advance the progress counter, and the run ends+ expect(logic.values.bulkArchiveProgress).toEqual({ done: 3, total: 3 })+ expect(logic.values.bulkArchiveRunning).toBe(false)+ })++ it.each([+ ['an empty selection', []],+ ['a selection above the cap', Array.from({ length: BULK_ARCHIVE_MAX_FLAGS + 1 }, (_, i) => i + 1)],+ ])('refuses to run for %s without issuing any archive requests', async (_label, ids) => {+ useArchiveMocks()+ logic = flagSelectionLogic()+ logic.mount()++ logic.actions.bulkArchiveFlags(ids)+ await expectLogic(logic).toFinishAllListeners()++ expect(archiveRequests).toHaveLength(0)+ expect(logic.values.bulkArchiveResult).toBeNull()+ expect(logic.values.bulkArchiveRunning).toBe(false)+ })+})diff --git a/frontend/src/scenes/feature-flags/flagSelectionLogic.ts b/frontend/src/scenes/feature-flags/flagSelectionLogic.tsindex 9b2d67b96adb..2d5b57b4108b 100644--- a/frontend/src/scenes/feature-flags/flagSelectionLogic.ts+++ b/frontend/src/scenes/feature-flags/flagSelectionLogic.ts@@ -8,13 +8,16 @@ import api from 'lib/api'import { ApiError } from 'lib/api-error'import { eventUsageLogic } from 'lib/utils/eventUsageLogic'import { pluralize } from 'lib/utils/strings'+import { dispatchChangeRequestCreated } from 'scenes/approvals/utils'import { organizationLogic } from 'scenes/organizationLogic'import { projectLogic } from 'scenes/projectLogic'+import { featureFlagsPartialUpdate } from 'products/feature_flags/frontend/generated/api'import type { CopyFlagsResponseApi } from 'products/feature_flags/frontend/generated/api.schemas'import type { OrganizationType } from '../../types'import { featureFlagsLogic } from './featureFlagsLogic'+import { isFlagApprovalRequiredError } from './updateFlagActiveInProject'export type FlagRolloutState = 'fully_rolled_out' | 'not_rolled_out' | 'partial'@@ -30,6 +33,24 @@ export interface BulkDeleteResult {errors: Array<{ id: number; key?: string; reason: string }>}+export interface BulkArchiveFailure {+ id: number+ errorMessage: string+ /** The flag wasn't archived because the change needs approval — a change request was created. */+ approvalPending: boolean+}++export interface BulkArchiveResult {+ archivedIds: number[]+ failed: BulkArchiveFailure[]+}++/**+ * Bulk archive issues one request per flag, so it's capped the same way bulk copy is rather than+ * letting a "select all matching" run fan out to thousands of sequential requests.+ */+export const BULK_ARCHIVE_MAX_FLAGS = 100+export const BULK_COPY_MAX_FLAGS = 100// Mirrors MAX_COPY_FLAGS_TARGET_PROJECTS in// products/feature_flags/backend/api/organization_feature_flag.py, which rejects more. Keep in sync.@@ -99,6 +120,26 @@ function summarizeBulkCopy(return { level: 'error', message: 'No flags were copied' }}+function summarizeBulkArchive(+ archivedCount: number,+ failed: BulkArchiveFailure[]+): { level: 'success' | 'warning' | 'error'; message: string } {+ const pendingApprovalCount = failed.filter((failure) => failure.approvalPending).length+ const hardFailureCount = failed.length - pendingApprovalCount+ if (failed.length === 0) {+ return { level: 'success', message: `Archived ${pluralize(archivedCount, 'flag')}` }+ }+ if (archivedCount > 0 || pendingApprovalCount > 0) {+ const parts = [+ archivedCount > 0 ? `Archived ${pluralize(archivedCount, 'flag')}` : null,+ pendingApprovalCount > 0 ? `${pluralize(pendingApprovalCount, 'flag')} pending approval` : null,+ hardFailureCount > 0 ? `${pluralize(hardFailureCount, 'flag')} failed` : null,+ ].filter((part): part is string => part !== null)+ return { level: 'warning', message: parts.join(', ') }+ }+ return { level: 'error', message: 'No flags were archived' }+}+function errorMessageFrom(error: unknown): string {if (typeof error === 'string') {return error@@ -191,6 +232,12 @@ export interface flagSelectionLogicValues {} // featureFlagsLogiccurrentOrganization: OrganizationType | null // organizationLogiccurrentProjectId: number | null // projectLogic+ bulkArchiveProgress: {+ done: number+ total: number+ } | null+ bulkArchiveResult: BulkArchiveResult | null+ bulkArchiveRunning: booleanbulkCopyDisableCopiedFlag: booleanbulkCopyFlagCount: numberbulkCopyHardFailures: BulkCopyFailure[]@@ -234,7 +281,22 @@ export interface flagSelectionLogicActions {flagCount: numberprojectCount: number} // eventUsageLogic+ reportFeatureFlagsBulkArchived: (+ archivedCount: number,+ pendingApprovalCount: number,+ failedCount: number+ ) => {+ archivedCount: number+ failedCount: number+ pendingApprovalCount: number+ } // eventUsageLogicloadFeatureFlags: (_?: void | undefined) => void // featureFlagsLogic+ bulkArchiveFlags: (ids: number[]) => {+ ids: number[]+ }+ bulkArchiveFlagsFinished: (result: BulkArchiveResult | null) => {+ result: BulkArchiveResult | null+ }bulkCopyFlags: () => {value: true}@@ -274,6 +336,13 @@ export interface flagSelectionLogicActions {openBulkCopyModal: (params: BulkCopyParams) => {params: BulkCopyParams}+ setBulkArchiveProgress: (+ done: number,+ total: number+ ) => {+ done: number+ total: number+ }setBulkCopyDisableCopiedFlag: (disableCopiedFlag: boolean) => {disableCopiedFlag: boolean}@@ -339,7 +408,12 @@ export const flagSelectionLogic = kea<flagSelectionLogicType>([organizationLogic,['currentOrganization'],],- actions: [featureFlagsLogic({}), ['loadFeatureFlags'], eventUsageLogic, ['reportFeatureFlagBulkCopy']],+ actions: [+ featureFlagsLogic({}),+ ['loadFeatureFlags'],+ eventUsageLogic,+ ['reportFeatureFlagBulkCopy', 'reportFeatureFlagsBulkArchived'],+ ],})),actions({@@ -354,6 +428,9 @@ export const flagSelectionLogic = kea<flagSelectionLogicType>([setBulkCopyProgress: (done: number, total: number) => ({ done, total }),bulkCopyFlags: true,bulkCopyFlagsFinished: (result: BulkCopyResult | null) => ({ result }),+ setBulkArchiveProgress: (done: number, total: number) => ({ done, total }),+ bulkArchiveFlags: (ids: number[]) => ({ ids }),+ bulkArchiveFlagsFinished: (result: BulkArchiveResult | null) => ({ result }),}),reducers({@@ -422,6 +499,27 @@ export const flagSelectionLogic = kea<flagSelectionLogicType>([bulkCopyFlagsFinished: (_, { result }) => result,},],+ bulkArchiveRunning: [+ false,+ {+ bulkArchiveFlags: () => true,+ bulkArchiveFlagsFinished: () => false,+ },+ ],+ bulkArchiveProgress: [+ null as { done: number; total: number } | null,+ {+ bulkArchiveFlags: () => null,+ setBulkArchiveProgress: (_, { done, total }) => ({ done, total }),+ },+ ],+ bulkArchiveResult: [+ null as BulkArchiveResult | null,+ {+ bulkArchiveFlags: () => null,+ bulkArchiveFlagsFinished: (_, { result }) => result,+ },+ ],}),loaders(({ values }) => ({@@ -486,6 +584,51 @@ export const flagSelectionLogic = kea<flagSelectionLogicType>([actions.loadFeatureFlags()}},+ bulkArchiveFlags: async ({ ids }) => {+ const projectId = values.currentProjectId+ if (!projectId || ids.length === 0) {+ actions.bulkArchiveFlagsFinished(null)+ return+ }+ if (ids.length > BULK_ARCHIVE_MAX_FLAGS) {+ lemonToast.error(`Bulk archive supports up to ${BULK_ARCHIVE_MAX_FLAGS} flags at once.`)+ actions.bulkArchiveFlagsFinished(null)+ return+ }++ const archivedIds: number[] = []+ const failed: BulkArchiveFailure[] = []++ actions.setBulkArchiveProgress(0, ids.length)+ // One request per flag through the regular update endpoint, on purpose: archiving disables+ // the flag, so each one has to pass the approval gate the same way a single archive does.+ // Sequential keeps the write load and the rollback ordering the same as archiving by hand.+ for (const [index, id] of ids.entries()) {+ try {+ await featureFlagsPartialUpdate(String(projectId), id, { archived: true, active: false })+ archivedIds.push(id)+ } catch (error) {+ const approvalPending = isFlagApprovalRequiredError(error)+ if (approvalPending) {+ dispatchChangeRequestCreated({ resourceType: 'feature_flag', resourceId: id })+ }+ failed.push({ id, errorMessage: errorMessageFrom(error), approvalPending })+ }+ actions.setBulkArchiveProgress(index + 1, ids.length)+ }++ actions.bulkArchiveFlagsFinished({ archivedIds, failed })+ actions.loadFeatureFlags()+ const pendingApprovalCount = failed.filter((failure) => failure.approvalPending).length+ actions.reportFeatureFlagsBulkArchived(+ archivedIds.length,+ pendingApprovalCount,+ failed.length - pendingApprovalCount+ )++ const { level, message } = summarizeBulkArchive(archivedIds.length, failed)+ lemonToast[level](message)+ },bulkCopyFlags: async () => {const params = values.bulkCopyParamsconst sourceProjectId = values.bulkCopySourceProjectId@@ -566,7 +709,7 @@ export const flagSelectionLogic = kea<flagSelectionLogicType>([})),beforeUnload(({ values }) => ({- enabled: () => values.bulkDeleteResponseLoading || values.bulkCopyRunning,+ enabled: () => values.bulkDeleteResponseLoading || values.bulkCopyRunning || values.bulkArchiveRunning,message: 'A bulk flag operation is in progress. Leaving may interrupt it.',})),])diff --git a/frontend/src/scenes/feature-flags/updateFlagActiveInProject.ts b/frontend/src/scenes/feature-flags/updateFlagActiveInProject.tsindex a56eee60de58..19c619c7a2d4 100644--- a/frontend/src/scenes/feature-flags/updateFlagActiveInProject.ts+++ b/frontend/src/scenes/feature-flags/updateFlagActiveInProject.ts@@ -41,12 +41,21 @@ export function confirmFlagActiveToggleInProject({})}+/**+ * Whether a flag update failed because it needs approval, meaning the change was recorded as a+ * change request instead of being applied. Split out from the toast handling below so bulk callers+ * can count these without showing a toast per flag.+ */+export function isFlagApprovalRequiredError(e: any): boolean {+ return e?.status === 409 && !!e?.data?.change_request_id+}+/*** Handle an approval-required 409 from a flag update: show the approval toast and announce* the created change request. Returns whether the error was an approval-required response.*/export function handleFlagApprovalRequired(e: any, flagId: number, actionDescription: string): boolean {- if (e?.status === 409 && e?.data?.change_request_id) {+ if (isFlagApprovalRequiredError(e)) {showApprovalRequiredToast(e.data.change_request_id, actionDescription)dispatchChangeRequestCreated({ resourceType: 'feature_flag', resourceId: flagId })return true