From eb4206865e302f3963b6922731048ef6ef5260dd Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:37:59 -0700 Subject: [PATCH 1/4] feat: Add support for server-side prerequisite details. --- .../common/src/api/data/LDEvaluationDetail.ts | 10 + .../__tests__/LDClient.evaluation.test.ts | 69 +++++++ .../evaluation/Evaluator.prerequisite.test.ts | 189 ++++++++++++++++++ .../sdk-server/src/FlagsStateBuilder.ts | 5 + .../shared/sdk-server/src/LDClientImpl.ts | 2 + .../sdk-server/src/evaluation/Evaluator.ts | 26 +-- 6 files changed, 283 insertions(+), 18 deletions(-) create mode 100644 packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts diff --git a/packages/shared/common/src/api/data/LDEvaluationDetail.ts b/packages/shared/common/src/api/data/LDEvaluationDetail.ts index 84f08d5d4..6cc6f22a1 100644 --- a/packages/shared/common/src/api/data/LDEvaluationDetail.ts +++ b/packages/shared/common/src/api/data/LDEvaluationDetail.ts @@ -28,6 +28,11 @@ export interface LDEvaluationDetail { * An object describing the main factor that influenced the flag evaluation value. */ reason: LDEvaluationReason; + + /** + * An ordered list of prerequisite flag keys evaluated while determining the flags value. + */ + prerequisites?: string[]; } export interface LDEvaluationDetailTyped { @@ -47,4 +52,9 @@ export interface LDEvaluationDetailTyped { * An object describing the main factor that influenced the flag evaluation value. */ reason: LDEvaluationReason; + + /** + * An ordered list of prerequisite flag keys evaluated while determining the flags value. + */ + prerequisites?: string[]; } diff --git a/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts b/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts index 2ef0d660d..fd8ef1322 100644 --- a/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts +++ b/packages/shared/sdk-server/__tests__/LDClient.evaluation.test.ts @@ -270,6 +270,75 @@ describe('given an LDClient with test data', () => { expect(res.reason.kind).toEqual('ERROR'); expect(res.reason.errorKind).toEqual('WRONG_TYPE'); }); + + it('includes prerequisite information for flags with prerequisites', async () => { + await td.update(td.flag('is-prereq').valueForAll(true)); + await td.usePreconfiguredFlag({ + key: 'has-prereq-depth-1', + on: true, + prerequisites: [ + { + key: 'is-prereq', + variation: 0, + }, + ], + fallthrough: { + variation: 0, + }, + offVariation: 1, + variations: [true, false], + clientSideAvailability: { + usingMobileKey: true, + usingEnvironmentId: true, + }, + clientSide: true, + version: 4, + }); + + const res = await client.variationDetail('has-prereq-depth-1', defaultUser, false); + expect(res.value).toEqual(true); + expect(res.reason.kind).toEqual('FALLTHROUGH'); + expect(res.prerequisites).toEqual(['is-prereq']); + }); + + it.each([ + ['boolVariationDetail', true, false], + ['numberVariationDetail', 42, 3.14], + ['stringVariationDetail', 'value', 'default'], + ['jsonVariationDetail', { value: 'value' }, { value: 'default' }], + ])( + 'includes prerequisite information for typed evals', + async (method: string, value: any, def: any) => { + await td.update(td.flag('is-prereq').valueForAll(true)); + await td.usePreconfiguredFlag({ + key: 'has-prereq-depth-1', + on: true, + prerequisites: [ + { + key: 'is-prereq', + variation: 0, + }, + ], + fallthrough: { + variation: 0, + }, + offVariation: 1, + variations: [value, def], + clientSideAvailability: { + usingMobileKey: true, + usingEnvironmentId: true, + }, + clientSide: true, + version: 4, + }); + + // @ts-ignore Typescript cannot infer the matching method types. + const res = await client[method]('has-prereq-depth-1', defaultUser, def); + expect(res.value).toEqual(value); + expect(res.reason.kind).toEqual('FALLTHROUGH'); + expect(res.prerequisites).toEqual(['is-prereq']); + }, + ); }); describe('given an offline client', () => { diff --git a/packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts b/packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts new file mode 100644 index 000000000..fa73d342f --- /dev/null +++ b/packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts @@ -0,0 +1,189 @@ +import { createBasicPlatform } from '@launchdarkly/private-js-mocks'; + +import { Context, deserializePoll } from '../../src'; +import { BigSegmentStoreMembership } from '../../src/api/interfaces'; +import { Flag } from '../../src/evaluation/data/Flag'; +import { Segment } from '../../src/evaluation/data/Segment'; +import Evaluator from '../../src/evaluation/Evaluator'; +import { Queries } from '../../src/evaluation/Queries'; +import EventFactory from '../../src/events/EventFactory'; +import { FlagsAndSegments } from '../../src/store/serialization'; + +describe('given a flag payload with prerequisites', () => { + let evaluator: Evaluator; + const basePayload = { + segments: {}, + flags: { + 'has-prereq-depth-1': { + key: 'has-prereq-depth-1', + on: true, + prerequisites: [ + { + key: 'is-prereq', + variation: 0, + }, + ], + fallthrough: { + variation: 0, + }, + offVariation: 1, + variations: [true, false], + clientSideAvailability: { + usingMobileKey: true, + usingEnvironmentId: true, + }, + clientSide: true, + version: 4, + }, + 'has-prereq-depth-2': { + key: 'has-prereq-depth-2', + on: true, + prerequisites: [ + { + key: 'has-prereq-depth-1', + variation: 0, + }, + ], + fallthrough: { + variation: 0, + }, + offVariation: 1, + variations: [true, false], + clientSideAvailability: { + usingMobileKey: true, + usingEnvironmentId: true, + }, + clientSide: true, + version: 3, + }, + 'has-prereq-depth-3': { + key: 'has-prereq-depth-3', + on: true, + prerequisites: [ + { + key: 'has-prereq-depth-1', + variation: 0, + }, + { + key: 'has-prereq-depth-2', + variation: 0, + }, + { + key: 'is-prereq', + variation: 0, + }, + ], + fallthrough: { + variation: 0, + }, + offVariation: 1, + variations: [true, false], + clientSideAvailability: { + usingMobileKey: true, + usingEnvironmentId: true, + }, + clientSide: true, + version: 3, + }, + 'is-prereq': { + key: 'is-prereq', + on: true, + fallthrough: { + variation: 0, + }, + offVariation: 1, + variations: [true, false], + clientSideAvailability: { + usingMobileKey: true, + usingEnvironmentId: true, + }, + clientSide: true, + version: 3, + }, + }, + }; + + let testPayload: FlagsAndSegments; + + class TestQueries implements Queries { + constructor(private readonly data: FlagsAndSegments) {} + + getFlag(key: string, cb: (flag: Flag | undefined) => void): void { + const res = this.data.flags[key]; + cb(res); + } + + getSegment(key: string, cb: (segment: Segment | undefined) => void): void { + const res = this.data.segments[key]; + cb(res); + } + + getBigSegmentsMembership( + _userKey: string, + ): Promise<[BigSegmentStoreMembership | null, string] | undefined> { + throw new Error('Method not implemented.'); + } + } + + beforeEach(() => { + testPayload = deserializePoll(JSON.stringify(basePayload))!; + evaluator = new Evaluator(createBasicPlatform(), new TestQueries(testPayload!)); + }); + + it('can track prerequisites for a basic prereq', async () => { + const res = await evaluator.evaluate( + testPayload?.flags['has-prereq-depth-1']!, + Context.fromLDContext({ kind: 'user', key: 'bob' }), + new EventFactory(true), + ); + + expect(res.detail.reason.kind).toEqual('FALLTHROUGH'); + + expect(res.detail.prerequisites).toEqual(['is-prereq']); + }); + + it('can track prerequisites for a prereq of a prereq', async () => { + const res = await evaluator.evaluate( + testPayload?.flags['has-prereq-depth-2']!, + Context.fromLDContext({ kind: 'user', key: 'bob' }), + new EventFactory(true), + ); + + expect(res.detail.reason.kind).toEqual('FALLTHROUGH'); + + expect(res.detail.prerequisites).toEqual(['is-prereq', 'has-prereq-depth-1']); + }); + + it('can track prerequisites for a flag with multiple prereqs with and without additional prereqs', async () => { + const res = await evaluator.evaluate( + testPayload?.flags['has-prereq-depth-3']!, + Context.fromLDContext({ kind: 'user', key: 'bob' }), + new EventFactory(true), + ); + + expect(res.detail.reason.kind).toEqual('FALLTHROUGH'); + + expect(res.detail.prerequisites).toEqual([ + 'is-prereq', + 'has-prereq-depth-1', + 'is-prereq', + 'has-prereq-depth-1', + 'has-prereq-depth-2', + 'is-prereq', + ]); + }); + + it('has can handle a prerequisite failure', async () => { + testPayload.flags['is-prereq'].on = false; + const res = await evaluator.evaluate( + testPayload?.flags['has-prereq-depth-3']!, + Context.fromLDContext({ kind: 'user', key: 'bob' }), + new EventFactory(true), + ); + + expect(res.detail.reason.kind).toEqual('PREREQUISITE_FAILED'); + expect(res.detail.reason.prerequisiteKey).toEqual('has-prereq-depth-1'); + + expect(res.detail.prerequisites).toEqual(['is-prereq', 'has-prereq-depth-1']); + }); +}); diff --git a/packages/shared/sdk-server/src/FlagsStateBuilder.ts b/packages/shared/sdk-server/src/FlagsStateBuilder.ts index 86bbc23bb..9c16dfdd1 100644 --- a/packages/shared/sdk-server/src/FlagsStateBuilder.ts +++ b/packages/shared/sdk-server/src/FlagsStateBuilder.ts @@ -10,6 +10,7 @@ interface FlagMeta { trackEvents?: boolean; trackReason?: boolean; debugEventsUntilDate?: number; + prerequisites?: string[]; } export default class FlagsStateBuilder { @@ -30,6 +31,7 @@ export default class FlagsStateBuilder { trackEvents: boolean, trackReason: boolean, detailsOnlyIfTracked: boolean, + prerequisites?: string[], ) { this.flagValues[flag.key] = value; const meta: FlagMeta = {}; @@ -56,6 +58,9 @@ export default class FlagsStateBuilder { if (flag.debugEventsUntilDate !== undefined) { meta.debugEventsUntilDate = flag.debugEventsUntilDate; } + if (prerequisites && prerequisites.length) { + meta.prerequisites = prerequisites; + } this.flagMetadata[flag.key] = meta; } diff --git a/packages/shared/sdk-server/src/LDClientImpl.ts b/packages/shared/sdk-server/src/LDClientImpl.ts index 34d6f02a5..b17aee047 100644 --- a/packages/shared/sdk-server/src/LDClientImpl.ts +++ b/packages/shared/sdk-server/src/LDClientImpl.ts @@ -392,6 +392,7 @@ export default class LDClientImpl implements LDClient { value: res.detail.value as TResult, reason: res.detail.reason, variationIndex: res.detail.variationIndex, + prerequisites: res.detail.prerequisites, }; resolve(typedRes); }, @@ -655,6 +656,7 @@ export default class LDClientImpl implements LDClient { flag.trackEvents || requireExperimentData, requireExperimentData, detailsOnlyIfTracked, + res.detail.prerequisites, ); iterCb(true); }); diff --git a/packages/shared/sdk-server/src/evaluation/Evaluator.ts b/packages/shared/sdk-server/src/evaluation/Evaluator.ts index ef95b9eee..d83cd05cd 100644 --- a/packages/shared/sdk-server/src/evaluation/Evaluator.ts +++ b/packages/shared/sdk-server/src/evaluation/Evaluator.ts @@ -68,6 +68,7 @@ function computeUpdatedBigSegmentsStatus( interface EvalState { events?: internal.InputEvalEvent[]; + prerequisites?: string[]; bigSegmentsStatus?: BigSegmentStoreStatusString; @@ -116,24 +117,7 @@ export default class Evaluator { async evaluate(flag: Flag, context: Context, eventFactory?: EventFactory): Promise { return new Promise((resolve) => { - const state: EvalState = {}; - this.evaluateInternal( - flag, - context, - state, - [], - (res) => { - if (state.bigSegmentsStatus) { - res.detail.reason = { - ...res.detail.reason, - bigSegmentsStatus: state.bigSegmentsStatus, - }; - } - res.events = state.events; - resolve(res); - }, - eventFactory, - ); + this.evaluateCb(flag, context, resolve, eventFactory); }); } @@ -156,6 +140,9 @@ export default class Evaluator { bigSegmentsStatus: state.bigSegmentsStatus, }; } + if (state.prerequisites) { + res.detail.prerequisites = state.prerequisites; + } res.events = state.events; cb(res); }, @@ -273,7 +260,10 @@ export default class Evaluator { (res) => { // eslint-disable-next-line no-param-reassign state.events ??= []; + // eslint-disable-next-line no-param-reassign + state.prerequisites ??= []; + state.prerequisites.push(prereqFlag.key); if (eventFactory) { state.events.push( eventFactory.evalEventServer(prereqFlag, context, res.detail, null, flag), From 95a656d3447a9f6480660fbb6014cf7c28521a17 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:30:15 -0700 Subject: [PATCH 2/4] Add client-side feature event and allFlags test. --- .../__tests__/LDClientImpl.events.test.ts | 41 ++++++++++++++ .../__tests__/evaluation/mockResponse.json | 19 +++++++ .../shared/sdk-client/src/LDClientImpl.ts | 20 ++++++- .../src/evaluation/evaluationDetail.ts | 2 + packages/shared/sdk-client/src/types/index.ts | 1 + .../__tests__/LDClient.allFlags.test.ts | 54 +++++++++++++++++++ 6 files changed, 135 insertions(+), 2 deletions(-) diff --git a/packages/shared/sdk-client/__tests__/LDClientImpl.events.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.events.test.ts index 093fcaef3..0cde02357 100644 --- a/packages/shared/sdk-client/__tests__/LDClientImpl.events.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.events.test.ts @@ -199,4 +199,45 @@ describe('sdk-client object', () => { expect.stringMatching(/was called with a non-numeric/), ); }); + + it('sends events for prerequisite flags', async () => { + await ldc.identify({ kind: 'user', key: 'bob' }); + ldc.variation('has-prereq-depth-1', false); + ldc.flush(); + + // Prerequisite evaluation event should be emitted before the evaluation event for the flag + // being evaluated. + expect(mockedSendEvent).toHaveBeenNthCalledWith( + 2, + expect.objectContaining({ + context: expect.anything(), + creationDate: expect.any(Number), + default: undefined, + key: 'is-prereq', + kind: 'feature', + samplingRatio: 1, + trackEvents: true, + value: true, + variation: 0, + version: 1, + withReasons: false, + }), + ); + expect(mockedSendEvent).toHaveBeenNthCalledWith( + 3, + expect.objectContaining({ + context: expect.anything(), + creationDate: expect.any(Number), + default: false, + key: 'has-prereq-depth-1', + kind: 'feature', + samplingRatio: 1, + trackEvents: true, + value: true, + variation: 0, + version: 4, + withReasons: false, + }), + ); + }); }); diff --git a/packages/shared/sdk-client/__tests__/evaluation/mockResponse.json b/packages/shared/sdk-client/__tests__/evaluation/mockResponse.json index d8f8eb5ea..10c3b4882 100644 --- a/packages/shared/sdk-client/__tests__/evaluation/mockResponse.json +++ b/packages/shared/sdk-client/__tests__/evaluation/mockResponse.json @@ -54,5 +54,24 @@ "value": true, "variation": 0, "trackEvents": false + }, + "is-prereq": { + "value": true, + "variation": 0, + "reason": { + "kind": "FALLTHROUGH" + }, + "version": 1, + "trackEvents": true + }, + "has-prereq-depth-1": { + "value": true, + "variation": 0, + "prerequisites": ["is-prereq"], + "reason": { + "kind": "FALLTHROUGH" + }, + "version": 4, + "trackEvents": true } } diff --git a/packages/shared/sdk-client/src/LDClientImpl.ts b/packages/shared/sdk-client/src/LDClientImpl.ts index 8ce553859..2461529bc 100644 --- a/packages/shared/sdk-client/src/LDClientImpl.ts +++ b/packages/shared/sdk-client/src/LDClientImpl.ts @@ -535,7 +535,7 @@ export default class LDClientImpl implements LDClient { return createErrorEvaluationDetail(ErrorKinds.FlagNotFound, defaultValue); } - const { reason, value, variation } = foundItem.flag; + const { reason, value, variation, prerequisites } = foundItem.flag; if (typeChecker) { const [matched, type] = typeChecker(value); @@ -558,11 +558,27 @@ export default class LDClientImpl implements LDClient { } } - const successDetail = createSuccessEvaluationDetail(value, variation, reason); + const successDetail = createSuccessEvaluationDetail(value, variation, reason, prerequisites); if (value === undefined || value === null) { this.logger.debug('Result value is null. Providing default value.'); successDetail.value = defaultValue; } + + successDetail.prerequisites?.forEach((prereqKey) => { + const prereqFlag = this.flagManager.get(prereqKey); + if (prereqFlag) { + this.eventProcessor?.sendEvent( + eventFactory.evalEventClient( + prereqKey, + prereqFlag.flag.value, + undefined, + prereqFlag.flag, + evalContext, + prereqFlag.flag.reason, + ), + ); + } + }); this.eventProcessor?.sendEvent( eventFactory.evalEventClient( flagKey, diff --git a/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts b/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts index f0e8d741c..cb94cae82 100644 --- a/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts +++ b/packages/shared/sdk-client/src/evaluation/evaluationDetail.ts @@ -17,10 +17,12 @@ export function createSuccessEvaluationDetail( value: LDFlagValue, variationIndex?: number, reason?: LDEvaluationReason, + prerequisites?: string[], ): LDEvaluationDetail { return { value, variationIndex: variationIndex ?? null, reason: reason ?? null, + prerequisites, }; } diff --git a/packages/shared/sdk-client/src/types/index.ts b/packages/shared/sdk-client/src/types/index.ts index 18b24736d..947c72832 100644 --- a/packages/shared/sdk-client/src/types/index.ts +++ b/packages/shared/sdk-client/src/types/index.ts @@ -10,6 +10,7 @@ export interface Flag { reason?: LDEvaluationReason; debugEventsUntilDate?: number; deleted?: boolean; + prerequisites?: string[]; } export interface PatchFlag extends Flag { diff --git a/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts b/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts index 9903eb51d..2280cba57 100644 --- a/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts +++ b/packages/shared/sdk-server/__tests__/LDClient.allFlags.test.ts @@ -269,6 +269,60 @@ describe('given an LDClient with test data', () => { done(); }); }); + + it('includes prerequisites in flag meta', async () => { + await td.update(td.flag('is-prereq').valueForAll(true)); + await td.usePreconfiguredFlag({ + key: 'has-prereq-depth-1', + on: true, + prerequisites: [ + { + key: 'is-prereq', + variation: 0, + }, + ], + fallthrough: { + variation: 0, + }, + offVariation: 1, + variations: [true, false], + clientSideAvailability: { + usingMobileKey: true, + usingEnvironmentId: true, + }, + clientSide: true, + version: 4, + }); + + const state = await client.allFlagsState(defaultUser, { + withReasons: true, + detailsOnlyForTrackedFlags: false, + }); + expect(state.valid).toEqual(true); + expect(state.allValues()).toEqual({ 'is-prereq': true, 'has-prereq-depth-1': true }); + expect(state.toJSON()).toEqual({ + 'is-prereq': true, + 'has-prereq-depth-1': true, + $flagsState: { + 'is-prereq': { + variation: 0, + reason: { + kind: 'FALLTHROUGH', + }, + version: 1, + }, + 'has-prereq-depth-1': { + variation: 0, + prerequisites: ['is-prereq'], + reason: { + kind: 'FALLTHROUGH', + }, + version: 4, + }, + }, + $valid: true, + }); + }); }); describe('given an offline client', () => { From 20af513c7b4e55fdd596a8f84a3151dbf136dc35 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 25 Sep 2024 14:37:59 -0700 Subject: [PATCH 3/4] Fix client-side tests. --- .../sdk-client/__tests__/LDClientImpl.storage.test.ts | 10 ++++++++++ .../shared/sdk-client/__tests__/LDClientImpl.test.ts | 2 ++ .../sdk-client/__tests__/LDClientImpl.timeout.test.ts | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/packages/shared/sdk-client/__tests__/LDClientImpl.storage.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.storage.test.ts index 976dd2092..45e476d26 100644 --- a/packages/shared/sdk-client/__tests__/LDClientImpl.storage.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.storage.test.ts @@ -104,6 +104,8 @@ describe('sdk-client storage', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', @@ -154,6 +156,8 @@ describe('sdk-client storage', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', @@ -214,6 +218,8 @@ describe('sdk-client storage', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', @@ -385,6 +391,8 @@ describe('sdk-client storage', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', @@ -516,6 +524,8 @@ describe('sdk-client storage', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', diff --git a/packages/shared/sdk-client/__tests__/LDClientImpl.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.test.ts index 4e732d114..e8b5833e3 100644 --- a/packages/shared/sdk-client/__tests__/LDClientImpl.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.test.ts @@ -86,6 +86,8 @@ describe('sdk-client object', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', diff --git a/packages/shared/sdk-client/__tests__/LDClientImpl.timeout.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.timeout.test.ts index bfe2a5df7..90d668cb7 100644 --- a/packages/shared/sdk-client/__tests__/LDClientImpl.timeout.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.timeout.test.ts @@ -85,6 +85,8 @@ describe('sdk-client identify timeout', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', @@ -108,6 +110,8 @@ describe('sdk-client identify timeout', () => { 'easter-i-tunes-special': false, 'easter-specials': 'no specials', fdsafdsafdsafdsa: true, + 'has-prereq-depth-1': true, + 'is-prereq': true, 'log-level': 'warn', 'moonshot-demo': true, test1: 's1', From da7ce51ccf8b7247eb58e378a5d2365595634ca4 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Thu, 3 Oct 2024 10:08:34 -0700 Subject: [PATCH 4/4] Test dep update. --- .../__tests__/evaluation/Evaluator.prerequisite.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts b/packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts index fa73d342f..f86e6bfed 100644 --- a/packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts +++ b/packages/shared/sdk-server/__tests__/evaluation/Evaluator.prerequisite.test.ts @@ -1,5 +1,3 @@ -import { createBasicPlatform } from '@launchdarkly/private-js-mocks'; - import { Context, deserializePoll } from '../../src'; import { BigSegmentStoreMembership } from '../../src/api/interfaces'; import { Flag } from '../../src/evaluation/data/Flag'; @@ -8,6 +6,7 @@ import Evaluator from '../../src/evaluation/Evaluator'; import { Queries } from '../../src/evaluation/Queries'; import EventFactory from '../../src/events/EventFactory'; import { FlagsAndSegments } from '../../src/store/serialization'; +import { createBasicPlatform } from '../createBasicPlatform'; describe('given a flag payload with prerequisites', () => { let evaluator: Evaluator;