From 36e712c1241952a791b6bb9a77fed4e84e290bd4 Mon Sep 17 00:00:00 2001 From: JF Date: Sun, 30 Aug 2026 18:47:56 -0400 Subject: [PATCH 1/4] fix: keep JavaScript globals out of locals (#595) --- changelog.d/595.fixed.md | 3 ++ docs/tool-reference.md | 2 +- .../src/interfaces/adapter-policy-js.ts | 27 +++++++--------- .../shared/src/interfaces/adapter-policy.ts | 6 ++-- src/server/tool-schemas.ts | 2 +- src/session/session-manager-data.ts | 8 +++++ .../unit/session/session-manager-dap.test.ts | 32 +++++++++++++++++++ tests/unit/shared/adapter-policy-js.test.ts | 13 ++++++++ 8 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 changelog.d/595.fixed.md diff --git a/changelog.d/595.fixed.md b/changelog.d/595.fixed.md new file mode 100644 index 00000000..cbe7b9e3 --- /dev/null +++ b/changelog.d/595.fixed.md @@ -0,0 +1,3 @@ +`get_local_variables` no longer returns JavaScript Global bindings as locals +when a frame exposes no Local or block scope. It returns an empty list with an +`anchorNote` directing callers to `get_scopes` and `get_variables` instead. diff --git a/docs/tool-reference.md b/docs/tool-reference.md index 8d165bfc..b282269d 100644 --- a/docs/tool-reference.md +++ b/docs/tool-reference.md @@ -788,7 +788,7 @@ If the originally stopped thread has no frames, this tool uses the same user-fra **Language-Specific Behavior:** - **Python**: Looks for "Locals" scope, filters out `__builtins__`, special variables, and internal debugger variables -- **JavaScript**: Merges every block scope on the frame — js-debug names them `Block`, `Catch Block`, `With Block` (or the legacy `Block: