Skip to content

Commit 4a75007

Browse files
committed
WIP
1 parent 1a32e51 commit 4a75007

File tree

5 files changed

+12
-8
lines changed

5 files changed

+12
-8
lines changed

packages/compass-collection/src/stores/collection-tab.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { experimentationServiceLocator } from '@mongodb-js/compass-telemetr
1010
import type { connectionInfoRefLocator } from '@mongodb-js/compass-connections/provider';
1111
import { createNoopLogger } from '@mongodb-js/compass-logging/provider';
1212
import { ReadOnlyPreferenceAccess } from 'compass-preferences-model/provider';
13+
import { TestName } from '../../../compass-telemetry/src/growth-experiments';
1314

1415
const defaultMetadata = {
1516
namespace: 'test.foo',
@@ -143,9 +144,9 @@ describe('Collection Tab Content store', function () {
143144

144145
await waitFor(() => {
145146
expect(assignExperiment).to.have.been.calledOnceWith(
146-
'mock-data-generator',
147+
TestName.mockDataGenerator,
147148
{
148-
team: 'data-explorer',
149+
team: 'Atlas Growth',
149150
}
150151
);
151152
});

packages/compass-collection/src/stores/collection-tab.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
isAIFeatureEnabled,
1717
type PreferencesAccess,
1818
} from 'compass-preferences-model/provider';
19+
import { TestName } from '../../../compass-telemetry/src/growth-experiments';
1920

2021
export type CollectionTabOptions = {
2122
/**
@@ -116,14 +117,14 @@ export function activatePlugin(
116117
isAIFeatureEnabled(preferences.getPreferences()) // Ensures org-level AI features setting is enabled
117118
) {
118119
void experimentationServices
119-
.assignExperiment('mock-data-generator', {
120+
.assignExperiment(TestName.mockDataGenerator, {
120121
team: 'Atlas Growth',
121122
})
122123
.catch((error) => {
123124
logger.debug('Mock Data Generator experiment assignment failed', {
124-
experiment: 'MOCK_DATA_GENERATOR',
125+
experiment: TestName.mockDataGenerator,
125126
namespace: namespace,
126-
error: error.message,
127+
error: error instanceof Error ? error.message : String(error),
127128
});
128129
});
129130
}

packages/compass-telemetry/src/experimentation-provider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import React, { createContext, useContext, useRef } from 'react';
22
import type { types } from '@mongodb-js/mdb-experiment-js';
33
import type { typesReact } from '@mongodb-js/mdb-experiment-js/react';
4+
import type { TestName } from './growth-experiments';
45

56
type UseAssignmentHook = (
6-
experimentName: string,
7+
experimentName: TestName,
78
trackIsInSample: boolean,
89
options?: typesReact.UseAssignmentOptions<types.TypeData>
910
) => typesReact.UseAssignmentResponse<types.TypeData>;
1011

1112
type AssignExperimentFn = (
12-
experimentName: string,
13+
experimentName: TestName,
1314
options?: types.AssignOptions<string>
1415
) => Promise<types.AsyncStatus | null>;
1516

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export enum TestName {
22
earlyJourneyIndexesGuidance = 'EARLY_JOURNEY_INDEXES_GUIDANCE_20250328',
3+
mockDataGenerator = 'MOCK_DATA_GENERATOR_20251001',
34
}

packages/compass-telemetry/src/provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function useTelemetry(): TrackFunction {
5353
export const experimentationServiceLocator = createServiceLocator(
5454
function useExperimentationServices(): {
5555
assignExperiment: (
56-
experimentName: string,
56+
experimentName: TestName,
5757
options?: types.AssignOptions<string>
5858
) => Promise<types.AsyncStatus | null>;
5959
} {

0 commit comments

Comments
 (0)