Skip to content

Commit 9fc1341

Browse files
ref(replay): gate ai summary behind gen-ai-features flag (#95469)
1 parent 9d99953 commit 9fc1341

File tree

4 files changed

+54
-23
lines changed

4 files changed

+54
-23
lines changed

static/app/utils/replays/hooks/useActiveReplayTab.spec.tsx

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,29 @@ describe('useActiveReplayTab', () => {
1717
setWindowLocation('http://localhost/');
1818
});
1919

20-
describe('without replay-ai-summaries feature flag', () => {
21-
it('should use Breadcrumbs as a default', () => {
20+
describe('without both replay-ai-summaries and gen-ai-features feature flags', () => {
21+
it('should use Breadcrumbs as a default when only gen-ai-features is enabled', () => {
2222
const {result} = renderHook(useActiveReplayTab, {
2323
initialProps: {},
2424
wrapper: ({children}) => (
25-
<OrganizationContext value={OrganizationFixture({features: []})}>
25+
<OrganizationContext
26+
value={OrganizationFixture({features: ['gen-ai-features']})}
27+
>
28+
{children}
29+
</OrganizationContext>
30+
),
31+
});
32+
33+
expect(result.current.getActiveTab()).toBe(TabKey.BREADCRUMBS);
34+
});
35+
36+
it('should use Breadcrumbs as a default when only replay-ai-summaries is enabled', () => {
37+
const {result} = renderHook(useActiveReplayTab, {
38+
initialProps: {},
39+
wrapper: ({children}) => (
40+
<OrganizationContext
41+
value={OrganizationFixture({features: ['replay-ai-summaries']})}
42+
>
2643
{children}
2744
</OrganizationContext>
2845
),
@@ -90,7 +107,9 @@ describe('useActiveReplayTab', () => {
90107
initialProps: {},
91108
wrapper: ({children}) => (
92109
<OrganizationContext
93-
value={OrganizationFixture({features: ['replay-ai-summaries']})}
110+
value={OrganizationFixture({
111+
features: ['replay-ai-summaries', 'gen-ai-features'],
112+
})}
94113
>
95114
{children}
96115
</OrganizationContext>
@@ -107,7 +126,9 @@ describe('useActiveReplayTab', () => {
107126
initialProps: {},
108127
wrapper: ({children}) => (
109128
<OrganizationContext
110-
value={OrganizationFixture({features: ['replay-ai-summaries']})}
129+
value={OrganizationFixture({
130+
features: ['replay-ai-summaries', 'gen-ai-features'],
131+
})}
111132
>
112133
{children}
113134
</OrganizationContext>
@@ -122,7 +143,9 @@ describe('useActiveReplayTab', () => {
122143
initialProps: {},
123144
wrapper: ({children}) => (
124145
<OrganizationContext
125-
value={OrganizationFixture({features: ['replay-ai-summaries']})}
146+
value={OrganizationFixture({
147+
features: ['replay-ai-summaries', 'gen-ai-features'],
148+
})}
126149
>
127150
{children}
128151
</OrganizationContext>

static/app/utils/replays/hooks/useActiveReplayTab.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ function useActiveReplayTab({isVideoReplay = false}: {isVideoReplay?: boolean})
3636
const organization = useOrganization();
3737

3838
// Use AI as default tab if user has the replay-ai-summaries feature flag, otherwise use breadcrumbs
39-
const defaultTab = organization.features.includes('replay-ai-summaries')
40-
? TabKey.AI
41-
: TabKey.BREADCRUMBS;
39+
const defaultTab =
40+
organization.features.includes('replay-ai-summaries') &&
41+
organization.features.includes('gen-ai-features')
42+
? TabKey.AI
43+
: TabKey.BREADCRUMBS;
4244

4345
const {getParamValue, setParamValue} = useUrlParams('t_main', defaultTab);
4446

static/app/views/replays/detail/ai/ai.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ function AiContent() {
4747
enabled: Boolean(
4848
replayRecord?.id &&
4949
project?.slug &&
50-
organization.features.includes('replay-ai-summaries')
50+
organization.features.includes('replay-ai-summaries') &&
51+
organization.features.includes('gen-ai-features')
5152
),
5253
retry: false,
5354
});
@@ -78,7 +79,10 @@ function AiContent() {
7879
) : null;
7980
};
8081

81-
if (!organization.features.includes('replay-ai-summaries')) {
82+
if (
83+
!organization.features.includes('replay-ai-summaries') ||
84+
!organization.features.includes('gen-ai-features')
85+
) {
8286
return (
8387
<SummaryContainer>
8488
<Alert type="info">

static/app/views/replays/detail/layout/focusTabs.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,20 @@ function getReplayTabs({
2222
}): Record<TabKey, ReactNode> {
2323
// For video replays, we hide the memory tab (not applicable for mobile)
2424
return {
25-
[TabKey.AI]: organization.features.includes('replay-ai-summaries') ? (
26-
<Flex align="center" gap={space(0.75)}>
27-
{t('Summary')}
28-
<Tooltip
29-
title={t(
30-
'This feature is experimental! Try it out and let us know what you think. No promises!'
31-
)}
32-
>
33-
<IconLab isSolid />
34-
</Tooltip>
35-
</Flex>
36-
) : null,
25+
[TabKey.AI]:
26+
organization.features.includes('replay-ai-summaries') &&
27+
organization.features.includes('gen-ai-features') ? (
28+
<Flex align="center" gap={space(0.75)}>
29+
{t('Summary')}
30+
<Tooltip
31+
title={t(
32+
'This feature is experimental! Try it out and let us know what you think. No promises!'
33+
)}
34+
>
35+
<IconLab isSolid />
36+
</Tooltip>
37+
</Flex>
38+
) : null,
3739
[TabKey.BREADCRUMBS]: t('Breadcrumbs'),
3840
[TabKey.CONSOLE]: t('Console'),
3941
[TabKey.NETWORK]: t('Network'),

0 commit comments

Comments
 (0)