From cdbbc9991f5cd75129244f070c533e62c5cefd76 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Wed, 27 Aug 2025 12:18:48 -0400 Subject: [PATCH 1/3] fix: allow clearing self-targeting identity with empty string --- src/mcp/tools/selfTargetingTools.ts | 6 +++++- src/mcp/types.ts | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mcp/tools/selfTargetingTools.ts b/src/mcp/tools/selfTargetingTools.ts index 03490da90..6e21c56ee 100644 --- a/src/mcp/tools/selfTargetingTools.ts +++ b/src/mcp/tools/selfTargetingTools.ts @@ -54,7 +54,11 @@ export async function updateSelfTargetingIdentityHandler( return await handleZodiosValidationErrors( () => updateUserProfile(authToken, projectKey, { - dvcUserId: args.dvc_user_id, + dvcUserId: + typeof args.dvc_user_id === 'string' && + args.dvc_user_id.trim() === '' + ? null + : args.dvc_user_id, }), 'updateUserProfile', ) diff --git a/src/mcp/types.ts b/src/mcp/types.ts index f670aca54..23c95fda4 100644 --- a/src/mcp/types.ts +++ b/src/mcp/types.ts @@ -402,7 +402,6 @@ export const UpdateFeatureStatusArgsSchema = z.object({ export const UpdateSelfTargetingIdentityArgsSchema = z.object({ dvc_user_id: z .string() - .nullable() .describe( 'DevCycle User ID for self-targeting (use null or empty string to clear)', ), From 4dd1df8c00e8dd6c4e56e687fb349e9c89975750 Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Wed, 27 Aug 2025 14:30:02 -0400 Subject: [PATCH 2/3] test: require ts-node in mocha to compile typescript tests --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 548ac820d..9875fbdee 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,8 @@ "posttest": "yarn lint", "prepack": "yarn build && oclif readme --multi", "pretest": "yarn format:check", - "test": "mocha test/*.ts \"src/**/*.test.ts\" && yarn workspace @devcycle/mcp-worker test", - "test:ci": "mocha --forbid-only test/*.ts \"src/**/*.test.ts\" && yarn workspace @devcycle/mcp-worker test", + "test": "mocha -r ts-node/register test/*.ts \"src/**/*.test.ts\" && yarn workspace @devcycle/mcp-worker test", + "test:ci": "mocha --forbid-only -r ts-node/register test/*.ts \"src/**/*.test.ts\" && yarn workspace @devcycle/mcp-worker test", "test:update-snapshots": "UPDATE_SNAPSHOT=1 yarn test", "version": "oclif readme --multi && git add README.md" }, From 929b5298e6d0ca8cc3add4e0a86a49be3fb0ea5c Mon Sep 17 00:00:00 2001 From: Jonathan Norris Date: Wed, 27 Aug 2025 17:09:27 -0400 Subject: [PATCH 3/3] test: remove TS parameter property in test and ensure ts-node compile --- src/mcp/utils/api.test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mcp/utils/api.test.ts b/src/mcp/utils/api.test.ts index 1b3431801..d853b1c95 100644 --- a/src/mcp/utils/api.test.ts +++ b/src/mcp/utils/api.test.ts @@ -34,12 +34,11 @@ describe('DevCycleApiClient', () => { // Create a proper mock Zodios error with data property class ZodiosValidationError extends Error { - constructor( - message: string, - public data: any, - ) { + public data: unknown + constructor(message: string, data: unknown) { super(message) this.name = 'ZodiosValidationError' + this.data = data } }