fix(desktop): let get-windows staging degrade on all win32 arches when binding is missing - #89646
Closed
Vegvisirz wants to merge 1 commit into
Closed
fix(desktop): let get-windows staging degrade on all win32 arches when binding is missing#89646Vegvisirz wants to merge 1 commit into
Vegvisirz wants to merge 1 commit into
Conversation
…n binding is missing
stage-native-deps.mjs had two throw points for get-windows on win32-x64:
1. stageGetWindows() line 574: canDegrade only allowed linux + win32-arm64,
so a missing package on win32-x64 threw instead of degrading.
2. stageGetWindowsInto() line 517: a missing binding on non-arm64 threw.
Both contradict the runtime layer (window-below.ts:133), which already
fail-softs import('get-windows').catch(() => null) on every platform, and
the STAGED_WINDOWS_JS stub, whose getAddon() returns no-op objects when no
binding is present. The throws forced npm ci to install get-windows
successfully — but its node-pre-gyp install script can fail on any Windows
host (no prebuilt for the exact Electron ABI, allowScripts blocking, etc.),
making the Desktop GUI build fail on a clean install.
Fix: widen canDegrade to all win32 (linux || win32), and change the
binding-missing throw to a warn + degrade. macOS stays fail-closed
(Swift helper binary is mandatory). This aligns staging with the runtime
layer's existing fail-soft design.
Collaborator
|
Closing — win32-x64 staging is fail-closed on purpose so a missing get-windows binding cannot ship silently (see The recovery for that throw is #88233: run the package's node-pre-gyp installer, then fail if the Windows binding is still missing. Degrading all win32 arches would skip that fetch and disable window enumeration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
stage-native-deps.mjshas two throw points forget-windowson win32-x64 that contradict the runtime layer's fail-soft design:stageGetWindows()line 574:canDegradeonly allowslinuxandwin32-arm64. A missing package onwin32-x64throws instead of degrading.stageGetWindowsInto()line 517: A missing binding on non-arm64 throws.Both contradict:
window-below.ts:133:import('get-windows').catch(() => null)— fail-soft on every platformSTAGED_WINDOWS_JS(line 366-407):getAddon()returns no-op stubs (getActiveWindow() {}/getOpenWindows() {}) when no binding is presentreadWindowBelow(): returnsenumerationFailureNote()when enumeration returns nullThe runtime is designed to degrade gracefully. The staging throws are inconsistent with this design and force
npm cito successfully installget-windows— but itsnode-pre-gypinstall script can fail on any Windows host (no prebuilt for the exact Electron ABI,allowScriptsblocking, etc.), making the Desktop GUI build fail on a clean install.Fix
canDegradefromplatform === 'linux' || (platform === 'win32' && arch === 'arm64')toplatform === 'linux' || platform === 'win32'— all win32 arches can degrade when the package is missing.console.warn+ degrade — same fail-soft behavior as arm64 already has.macOS stays fail-closed (Swift helper binary is mandatory and cannot be stubbed).
Verification
On a Windows x64 host where
npm ciskipsget-windows(e.g.allowScriptsblocking):