From cb5d6b90aec00c51e45978188565e2a23fd60149 Mon Sep 17 00:00:00 2001 From: Oleg Samarin Date: Sun, 10 May 2026 20:35:01 +0300 Subject: [PATCH] Fixed Bypass Permissions edit mode not suppressing the file diff dialog The edit mode was stored in EDIT_MODE_REGISTRY only when workingDirectory was already set. In startProcess(), setEditMode() is called before setWorkingDirectory(), so the registry entry was silently skipped and getEditModeForCwd() returned DEFAULT for every hook call. Fix: setWorkingDirectory() now writes the current editMode to the registry when workingDirectory is assigned and editMode is non-null. Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 2 ++ pom.xml | 2 +- .../model/ClaudeSessionModel.java | 3 +++ .../model/ClaudeSessionModelTest.java | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8d75a29..1bd2243d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +- Fixed Bypass Permissions edit mode not suppressing the file diff dialog: the edit mode was lost from the registry because it was set before the working directory was assigned at session start + # 0.22.35 (2026-05-07) - Fixed markdown preview not rendering nested list structure (multi-level indented lists now display with proper nesting) diff --git a/pom.xml b/pom.xml index 3bec908f..f3cf82b3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ io.github.nbclaudecodegui netbeans-claude-code-gui - 0.22.49-SNAPSHOT + 0.22.50-SNAPSHOT nbm Netbeans Plugin Claude Code GUI NetBeans plugin that provides a GUI for Claude Code CLI — run claude code sessions directly inside the IDE. diff --git a/src/main/java/io/github/nbclaudecodegui/model/ClaudeSessionModel.java b/src/main/java/io/github/nbclaudecodegui/model/ClaudeSessionModel.java index 74286598..c6cef53a 100644 --- a/src/main/java/io/github/nbclaudecodegui/model/ClaudeSessionModel.java +++ b/src/main/java/io/github/nbclaudecodegui/model/ClaudeSessionModel.java @@ -283,6 +283,9 @@ public void setEditMode(EditMode mode) { */ public void setWorkingDirectory(File dir) { workingDirectory = dir; + if (dir != null && editMode != null) { + EDIT_MODE_REGISTRY.put(dir.getAbsolutePath(), editMode); + } fireOnEdt(() -> listeners.forEach(l -> l.onWorkingDirectoryChanged(dir))); } diff --git a/src/test/java/io/github/nbclaudecodegui/model/ClaudeSessionModelTest.java b/src/test/java/io/github/nbclaudecodegui/model/ClaudeSessionModelTest.java index b6e3ed48..a7418083 100644 --- a/src/test/java/io/github/nbclaudecodegui/model/ClaudeSessionModelTest.java +++ b/src/test/java/io/github/nbclaudecodegui/model/ClaudeSessionModelTest.java @@ -119,6 +119,23 @@ void setEditModeNullRemovesRegistryEntry() { // setWorkingDirectory // ------------------------------------------------------------------------- + @Test + void setWorkingDirectoryAfterEditModeSyncsRegistry() { + // Reproduces the bug: editMode set before workingDirectory (as in startProcess) + // → registry must still be populated once workingDirectory is set + model.setEditMode(EditMode.BYPASS_PERMISSIONS); + assertNull(model.getWorkingDirectory()); + assertTrue(ClaudeSessionModel.EDIT_MODE_REGISTRY.isEmpty(), + "Registry must be empty while workingDirectory is null"); + + File dir = new File("/tmp/bypass-test"); + model.setWorkingDirectory(dir); + + assertEquals(EditMode.BYPASS_PERMISSIONS, + ClaudeSessionModel.EDIT_MODE_REGISTRY.get(dir.getAbsolutePath()), + "Registry must reflect editMode set before workingDirectory was assigned"); + } + @Test void setWorkingDirectoryFiresListener() { AtomicReference captured = new AtomicReference<>();