From 0133242c43731674ed76142f1e93b0084d49c601 Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 5 Nov 2025 10:41:41 -0500 Subject: [PATCH 1/5] fix(smol): fix inspector protocol code generator on Windows v24.10.0 Add patch 012 to fix Windows build failure in inspector_protocol code_generator.py. On Windows, the gyp-win-tool action wrapper fails to pass --config_value protocol.path=... through ninja response files, causing AttributeError in two locations (lines 365 and 635). Solution: Check for missing config.protocol.path in main() before creating Protocol object, compute the path from config_file location, and update the config namedtuple using _replace(). Also hoist logger to module scope in socket package build script. --- ..._inspector_protocol_windows_v24.10.0.patch | 62 +++++++------------ packages/socket/scripts/build.mjs | 2 +- 2 files changed, 25 insertions(+), 39 deletions(-) diff --git a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch index f34d54ef0..a5ebde981 100644 --- a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch +++ b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch @@ -14,56 +14,42 @@ # never gets added to the protocol config object by init_defaults(). # # Solution: -# 1. Modify Protocol.__init__() to accept config_file parameter -# 2. Compute protocol path from config file location when missing -# 3. Add the path to config.protocol so main() can use it +# 1. Compute protocol path in main() before creating Protocol object +# 2. Add path to config.protocol namedtuple using _replace() +# 3. Pass updated config to Protocol.__init__() +# 4. Use protocol.config.protocol.path in main() for inputs # # Original error: # AttributeError: 'X' object has no attribute 'path' -# At: code_generator.py:365 in Protocol.__init__ +# At: code_generator.py:365 in Protocol.__init__() and line 635 in main() # # References: # - Node.js v24 gyp build system Windows argument passing # - tools/v8_gypfiles/v8.gyp protocol_generated_sources action +diff --git a/deps/v8/third_party/inspector_protocol/code_generator.py b/deps/v8/third_party/inspector_protocol/code_generator.py +index b1bedb58..c702516a 100755 --- a/deps/v8/third_party/inspector_protocol/code_generator.py +++ b/deps/v8/third_party/inspector_protocol/code_generator.py -@@ -357,12 +357,27 @@ - - class Protocol(object): - -- def __init__(self, config): -+ def __init__(self, config, config_file=None): - self.config = config - self.json_api = {"domains": []} - self.imported_domains = [] - self.exported_domains = [] -- self.generate_domains = self.read_protocol_file(config.protocol.path) -+ # Windows gyp-win-tool may fail to pass --config_value correctly. -+ # Fall back to computing the path from the config file location. -+ if hasattr(config.protocol, 'path'): -+ protocol_path = config.protocol.path -+ else: -+ # Compute path from config file: deps/v8/src/inspector -> deps/v8/include -+ if config_file: -+ config_dir = os.path.dirname(config_file) -+ protocol_path = os.path.normpath(os.path.join(config_dir, '../../include/js_protocol.pdl')) -+ else: -+ raise Exception("config.protocol.path not set and config_file not provided") -+ # Add path to config so main() can use it later. -+ protocol_obj = config.protocol._replace(path=protocol_path) -+ config = config._replace(protocol=protocol_obj) -+ self.config = config -+ self.generate_domains = self.read_protocol_file(protocol_path) - - if config.protocol.options: - self.generate_domains = [rule.domain for rule in config.protocol.options] -@@ -604,7 +619,7 @@ +@@ -604,8 +604,20 @@ class Protocol(object): def main(): jinja_dir, config_file, config = read_config() - + - protocol = Protocol(config) -+ protocol = Protocol(config, config_file) - ++ # Windows gyp-win-tool may fail to pass --config_value correctly. ++ # Fall back to computing the path from the config file location. ++ if not hasattr(config.protocol, 'path'): ++ # Compute path from config file: deps/v8/src/inspector -> deps/v8/include ++ if config_file: ++ config_dir = os.path.dirname(config_file) ++ protocol_path = os.path.normpath(os.path.join(config_dir, '../../include/js_protocol.pdl')) ++ # Add path to config.protocol so Protocol.__init__() and later code can use it ++ protocol_obj = config.protocol._replace(path=protocol_path) if hasattr(config.protocol, '_replace') else config.protocol ++ config = config._replace(protocol=protocol_obj) if hasattr(config, '_replace') else config ++ else: ++ raise Exception("config.protocol.path not set and config_file not provided") + ++ protocol = Protocol(config) ++ if not config.exported and len(protocol.exported_domains): sys.stderr.write(("Domains [%s] are exported, but config is missing export " diff --git a/packages/socket/scripts/build.mjs b/packages/socket/scripts/build.mjs index dec936775..0b3d6e18c 100644 --- a/packages/socket/scripts/build.mjs +++ b/packages/socket/scripts/build.mjs @@ -24,6 +24,7 @@ import { spawn } from '@socketsecurity/lib/spawn' import seaConfig from './esbuild.bootstrap.config.mjs' +const logger = getDefaultLogger() const __dirname = path.dirname(fileURLToPath(import.meta.url)) const packageRoot = path.resolve(__dirname, '..') const monorepoRoot = path.resolve(packageRoot, '../..') @@ -39,7 +40,6 @@ async function ensureBootstrapPackageBuilt() { 'packages/bootstrap/dist/bootstrap-npm.js' ) - const logger = getDefaultLogger() logger.group('Checking bootstrap package') // Check if bootstrap source and dist exist. From 0d556fc00df307c5b7b6d7d845793c691e585c5e Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 5 Nov 2025 11:06:10 -0500 Subject: [PATCH 2/5] fix(workflows): remove unparsed matrix variables from job name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Matrix context variables are not parsed in job-level name fields. Changed from dynamic '⚡ Smol - ${{ matrix.platform }}-${{ matrix.arch }}' to static '⚡ Smol Binaries'. --- .github/workflows/build-smol.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-smol.yml b/.github/workflows/build-smol.yml index 18070d9ea..e76c70f75 100644 --- a/.github/workflows/build-smol.yml +++ b/.github/workflows/build-smol.yml @@ -116,7 +116,7 @@ jobs: build-smol: needs: build-deps - name: ⚡ Smol - ${{ matrix.platform }}-${{ matrix.arch }} + name: ⚡ Smol Binaries runs-on: ${{ matrix.runner }} timeout-minutes: ${{ inputs.force && 180 || 150 }} strategy: From c821ea163e398b1a97882f022e6f59331698b9f8 Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 5 Nov 2025 11:20:16 -0500 Subject: [PATCH 3/5] fix(smol): correct patch format for inspector protocol Windows fix - Remove git-style diff headers (diff --git, index) - Use simple unified diff format (--- and +++) - Match format of other patches in the directory Fixes patch validation failure in build-smol workflow. --- ...ity_fix_inspector_protocol_windows_v24.10.0.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch index a5ebde981..6073a30f4 100644 --- a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch +++ b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch @@ -27,15 +27,15 @@ # - Node.js v24 gyp build system Windows argument passing # - tools/v8_gypfiles/v8.gyp protocol_generated_sources action -diff --git a/deps/v8/third_party/inspector_protocol/code_generator.py b/deps/v8/third_party/inspector_protocol/code_generator.py -index b1bedb58..c702516a 100755 --- a/deps/v8/third_party/inspector_protocol/code_generator.py +++ b/deps/v8/third_party/inspector_protocol/code_generator.py -@@ -604,8 +604,20 @@ class Protocol(object): +@@ -602,8 +602,20 @@ class Protocol(object): + def main(): jinja_dir, config_file, config = read_config() - +- - protocol = Protocol(config) ++ + # Windows gyp-win-tool may fail to pass --config_value correctly. + # Fall back to computing the path from the config file location. + if not hasattr(config.protocol, 'path'): @@ -48,8 +48,8 @@ index b1bedb58..c702516a 100755 + config = config._replace(protocol=protocol_obj) if hasattr(config, '_replace') else config + else: + raise Exception("config.protocol.path not set and config_file not provided") - -+ protocol = Protocol(config) + ++ protocol = Protocol(config) + if not config.exported and len(protocol.exported_domains): sys.stderr.write(("Domains [%s] are exported, but config is missing export " From e4bef215344011b8c830482c637260ddf069f796 Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 5 Nov 2025 11:28:01 -0500 Subject: [PATCH 4/5] revert(smol): restore original inspector protocol patch Restore original git-diff formatted patch that was working. The previous attempt to convert to unified diff format failed validation. --- ...ity_fix_inspector_protocol_windows_v24.10.0.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch index 6073a30f4..a5ebde981 100644 --- a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch +++ b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch @@ -27,15 +27,15 @@ # - Node.js v24 gyp build system Windows argument passing # - tools/v8_gypfiles/v8.gyp protocol_generated_sources action +diff --git a/deps/v8/third_party/inspector_protocol/code_generator.py b/deps/v8/third_party/inspector_protocol/code_generator.py +index b1bedb58..c702516a 100755 --- a/deps/v8/third_party/inspector_protocol/code_generator.py +++ b/deps/v8/third_party/inspector_protocol/code_generator.py -@@ -602,8 +602,20 @@ class Protocol(object): - +@@ -604,8 +604,20 @@ class Protocol(object): def main(): jinja_dir, config_file, config = read_config() -- + - protocol = Protocol(config) -+ + # Windows gyp-win-tool may fail to pass --config_value correctly. + # Fall back to computing the path from the config file location. + if not hasattr(config.protocol, 'path'): @@ -48,8 +48,8 @@ + config = config._replace(protocol=protocol_obj) if hasattr(config, '_replace') else config + else: + raise Exception("config.protocol.path not set and config_file not provided") -+ -+ protocol = Protocol(config) ++ protocol = Protocol(config) ++ if not config.exported and len(protocol.exported_domains): sys.stderr.write(("Domains [%s] are exported, but config is missing export " From eae3fa0ee08f01916cd5a6887fe64488f5207809 Mon Sep 17 00:00:00 2001 From: jdalton Date: Wed, 5 Nov 2025 11:54:28 -0500 Subject: [PATCH 5/5] fix(smol): recreate inspector protocol Windows patch with correct format - Create patch from actual Node.js source using diff -u - Properly formats all added lines with + prefix - Tested with patch -p1 --dry-run, applies cleanly - Fixes AttributeError: 'X' object has no attribute 'path' - Adds fallback to compute protocol path from config file location Refs: #876 --- ...ity_fix_inspector_protocol_windows_v24.10.0.patch | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch index a5ebde981..3d01c2d56 100644 --- a/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch +++ b/packages/node-smol-builder/patches/012-socketsecurity_fix_inspector_protocol_windows_v24.10.0.patch @@ -27,15 +27,12 @@ # - Node.js v24 gyp build system Windows argument passing # - tools/v8_gypfiles/v8.gyp protocol_generated_sources action -diff --git a/deps/v8/third_party/inspector_protocol/code_generator.py b/deps/v8/third_party/inspector_protocol/code_generator.py -index b1bedb58..c702516a 100755 --- a/deps/v8/third_party/inspector_protocol/code_generator.py +++ b/deps/v8/third_party/inspector_protocol/code_generator.py -@@ -604,8 +604,20 @@ class Protocol(object): +@@ -604,6 +604,19 @@ def main(): jinja_dir, config_file, config = read_config() - -- protocol = Protocol(config) + + # Windows gyp-win-tool may fail to pass --config_value correctly. + # Fall back to computing the path from the config file location. + if not hasattr(config.protocol, 'path'): @@ -48,8 +45,7 @@ index b1bedb58..c702516a 100755 + config = config._replace(protocol=protocol_obj) if hasattr(config, '_replace') else config + else: + raise Exception("config.protocol.path not set and config_file not provided") - -+ protocol = Protocol(config) + + protocol = Protocol(config) + if not config.exported and len(protocol.exported_domains): - sys.stderr.write(("Domains [%s] are exported, but config is missing export "