From c77992891c30578b11223752cdea4976ec616885 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 18:57:18 +0000 Subject: [PATCH 1/3] Initial plan From dbb015fccb9286048f33f2f6ca6f2957b48441a5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 19:03:14 +0000 Subject: [PATCH 2/3] Fix tracksAssignment/tracksExposure false values being silently ignored in doFetch Co-authored-by: zhukaihan <7332407+zhukaihan@users.noreply.github.com> Agent-Logs-Url: https://github.com/amplitude/experiment-node-server/sessions/2412ebe9-1de9-430e-9a90-ecca6ab958b2 --- packages/node/src/remote/client.ts | 8 ++++---- packages/node/test/remote/client.test.ts | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/node/src/remote/client.ts b/packages/node/src/remote/client.ts index b35794e..f0b7b89 100644 --- a/packages/node/src/remote/client.ts +++ b/packages/node/src/remote/client.ts @@ -118,14 +118,14 @@ export class RemoteEvaluationClient { flagKeys: options?.flagKeys, timeoutMillis: timeoutMillis, }; - if (options?.tracksAssignment) { - getVariantsOptions.trackingOption = options?.tracksAssignment + if (options?.tracksAssignment !== undefined && options?.tracksAssignment !== null) { + getVariantsOptions.trackingOption = options.tracksAssignment ? 'track' : 'no-track'; } - if (options?.tracksExposure) { + if (options?.tracksExposure !== undefined && options?.tracksExposure !== null) { (getVariantsOptions as any).exposureTrackingOption = - options?.tracksExposure ? 'track' : 'no-track'; + options.tracksExposure ? 'track' : 'no-track'; } const results = await this.evaluationApi.getVariants( userContext, diff --git a/packages/node/test/remote/client.test.ts b/packages/node/test/remote/client.test.ts index f541100..2e44c11 100644 --- a/packages/node/test/remote/client.test.ts +++ b/packages/node/test/remote/client.test.ts @@ -104,6 +104,26 @@ describe('ExperimentClient.fetch', () => { }), ); }); + + test('ExperimentClient.fetch, v2 tracksAssignment false and tracksExposure false', async () => { + const client = new RemoteEvaluationClient(API_KEY, {}); + const getVariantsSpy = jest.spyOn( + (client as any).evaluationApi, + 'getVariants', + ); + const variants = await client.fetchV2(testUser, { + tracksAssignment: false, + tracksExposure: false, + }); + expect(variants['sdk-ci-test'].key).toEqual('on'); + expect(getVariantsSpy).toHaveBeenCalledWith( + expect.objectContaining(testUser), + expect.objectContaining({ + trackingOption: 'no-track', + exposureTrackingOption: 'no-track', + }), + ); + }); }); describe('ExperimentClient.fetch, retry with different response codes', () => { From 3cd6a36057e707886bfc4969f3f82f1de0b45768 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Mon, 23 Mar 2026 12:21:54 -0700 Subject: [PATCH 3/3] lint: fix lint --- packages/node/src/remote/client.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/node/src/remote/client.ts b/packages/node/src/remote/client.ts index f0b7b89..f09c115 100644 --- a/packages/node/src/remote/client.ts +++ b/packages/node/src/remote/client.ts @@ -118,12 +118,18 @@ export class RemoteEvaluationClient { flagKeys: options?.flagKeys, timeoutMillis: timeoutMillis, }; - if (options?.tracksAssignment !== undefined && options?.tracksAssignment !== null) { + if ( + options?.tracksAssignment !== undefined && + options?.tracksAssignment !== null + ) { getVariantsOptions.trackingOption = options.tracksAssignment ? 'track' : 'no-track'; } - if (options?.tracksExposure !== undefined && options?.tracksExposure !== null) { + if ( + options?.tracksExposure !== undefined && + options?.tracksExposure !== null + ) { (getVariantsOptions as any).exposureTrackingOption = options.tracksExposure ? 'track' : 'no-track'; }