From 1f95613b11b4b222fd895679f6e7e7bb52222906 Mon Sep 17 00:00:00 2001 From: Michael Panchenko Date: Thu, 16 Apr 2026 13:44:04 +0200 Subject: [PATCH] JB tools: transform some incorrectly sent empty strings in params to None In Move and SafeDelete, the client might send an empty string instead of None --- CHANGELOG.md | 7 +++++-- src/serena/tools/jetbrains_tools.py | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71e56290..f3274c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Status of the `main` branch. Changes prior to the next official version change w - Fix: Check for ignored path ignored `.git` folder only at the top level, not in every subdirectory (`Project._is_ignored_relative_path`) #1350 - Fix: Duplicate comments in re-saved YAML configuration files #1285 +* JetBrains: + - `Move` and `SafeDelete` tools: transform empty string to None (counteracts client errors) + * Dependencies: - `pywebview`: Switch back to official release (new version 6.2) #1253 @@ -20,10 +23,10 @@ Status of the `main` branch. Changes prior to the next official version change w - Fix: When scanning for `.gitignore` files, the presence of files that could not be made relative to the project root would cause the scan to fail. #1317 -Dashboard: +* Dashboard: - Fix handling of read news, saving each read news entry separately #1338 -JetBrains: +* JetBrains: - Improve handling of `relative_path` parameter - Improve its documentation to avoid usage errors - Replace escaped characters in `relative_path` with their unescaped counterparts (< and >) diff --git a/src/serena/tools/jetbrains_tools.py b/src/serena/tools/jetbrains_tools.py index 9e217090..00d0adbd 100644 --- a/src/serena/tools/jetbrains_tools.py +++ b/src/serena/tools/jetbrains_tools.py @@ -159,6 +159,9 @@ class JetBrainsMoveTool(Tool, ToolMarkerSymbolicEdit, ToolMarkerOptional, ToolMa :param target_relative_path: the relative path of the target directory or file. :param target_parent_name_path: the name path of the target parent symbol. """ + name_path = name_path or None + target_relative_path = target_relative_path or None + target_parent_name_path = target_parent_name_path or None relative_path = self._sanitize_input_param(relative_path) with JetBrainsPluginClient.from_project(self.project) as client: response_dict = client.move( @@ -199,6 +202,7 @@ class JetBrainsSafeDeleteTool(Tool, ToolMarkerSymbolicEdit, ToolMarkerOptional, remove symbols that become unused after the deletion. Default is False. """ relative_path = self._sanitize_input_param(relative_path) + name_path = name_path or None with JetBrainsPluginClient.from_project(self.project) as client: response_dict = client.safe_delete( name_path=name_path,