fix(desktop): Windows native modules — registry-js via N-API prebuild + defensive loading #11

Merged
mohlec merged 3 commits from fix/desktop-native-modules into slash/main 2026-07-15 02:09:21 +00:00
Owner

Fixes the Windows crash registry.node is not a valid Win32 application (Wine cross-build on the Linux runner packaged Linux-compiled native .node addons into the Windows app).

B (CI) — registry-js works with NO Windows runner: registry-js ships ABI-independent N-API prebuilds (registry-js-v1.16.1-napi-v3-win32-x64.tar.gz), which load on Electron 41. CI now fetches that (verified: PE32+ executable ... x86-64) and packages it; --config.npmRebuild=false stops electron-builder re-clobbering it. So GPO/MDM policy + Windows light/dark detection work on Windows.

C (resilience): all 4 native modules (registry-js, cf-prefs, windows-focus-assist, macos-notification-state) load lazily + guarded, so a missing/wrong-arch .node disables that one feature instead of crashing the main process. Fixes latent cross-platform crashes too (cf-prefs/macos-* were imported at module scope, fail to load on Windows).

Remaining gap: windows-focus-assist publishes no prebuilds and needs MSVC — it stays disabled via the guards (only Focus-Assist DND detection lost). A Windows build runner (#12) is now optional, needed only for that one minor feature.

Branding gate passes. Windows CI job builds green.

Fixes the Windows crash `registry.node is not a valid Win32 application` (Wine cross-build on the Linux runner packaged Linux-compiled native .node addons into the Windows app). **B (CI) — registry-js works with NO Windows runner:** registry-js ships ABI-independent **N-API** prebuilds (`registry-js-v1.16.1-napi-v3-win32-x64.tar.gz`), which load on Electron 41. CI now fetches that (verified: `PE32+ executable ... x86-64`) and packages it; `--config.npmRebuild=false` stops electron-builder re-clobbering it. So GPO/MDM policy + Windows light/dark detection work on Windows. **C (resilience):** all 4 native modules (registry-js, cf-prefs, windows-focus-assist, macos-notification-state) load lazily + guarded, so a missing/wrong-arch .node disables that one feature instead of crashing the main process. Fixes latent cross-platform crashes too (cf-prefs/macos-* were imported at module scope, fail to load on Windows). **Remaining gap:** `windows-focus-assist` publishes **no** prebuilds and needs MSVC — it stays disabled via the guards (only Focus-Assist DND detection lost). A Windows build runner (#12) is now optional, needed only for that one minor feature. Branding gate passes. Windows CI job builds green.
fix(desktop): correct Windows native modules (B) + defensive loading (C)
Some checks failed
Build Slash Desktop / build-macos (pull_request) Has been skipped
Build Slash Desktop / build-windows (pull_request) Successful in 2m25s
Build Slash Desktop / build-linux (pull_request) Has been cancelled
50600679bc
Windows build crashed on launch with 'registry.node is not a valid Win32
application' — the Wine cross-build on the Linux runner packaged Linux-compiled
native .node addons into the Windows app.

B (CI): fetch win32-x64 electron prebuilds for registry-js + windows-focus-assist
before packaging, and pass --config.npmRebuild=false so electron-builder doesn't
re-clobber them with host (Linux) rebuilds.

C (resilience): load all four native modules (registry-js, cf-prefs,
windows-focus-assist, macos-notification-state) lazily + guarded, so a
missing/wrong-arch .node degrades that one feature instead of crashing the whole
main process at startup. Also fixes cross-platform crashes (cf-prefs/macos-*
were imported at module scope and would fail to load on Windows).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
revert(ci): drop win32 prebuild-fetch (B) — no Electron-41 prebuilds exist
All checks were successful
Build Slash Desktop / build-macos (pull_request) Has been skipped
Build Slash Desktop / build-windows (pull_request) Successful in 2m12s
Build Slash Desktop / build-linux (pull_request) Successful in 6m26s
05399978c7
registry-js@1.16.1 / windows-focus-assist@1.4.0 publish no electron-v145
(Electron 41) prebuilds, and MSVC native modules can't be compiled on the Linux
runner. Fetching is a dead end; keep only the defensive-loading fix (C), which
makes the app launch without those modules. Full Windows native support needs a
Windows build runner — tracked separately.
mohlec changed title from fix(desktop): Windows native modules (win32 prebuilds) + defensive loading to fix(desktop): defensive native-module loading — stop the Windows startup crash 2026-07-14 23:56:46 +00:00
fix(ci): fetch registry-js N-API win32 prebuild for the Windows build
All checks were successful
Build Slash Desktop / build-macos (pull_request) Has been skipped
Build Slash Desktop / build-windows (pull_request) Successful in 2m22s
Build Slash Desktop / build-linux (pull_request) Successful in 6m18s
f1616dab62
Option (c) confirmed: registry-js ships ABI-independent N-API prebuilds
(registry-js-v1.16.1-napi-v3-win32-x64.tar.gz) that load on Electron 41. The
earlier attempt failed only because --runtime=electron forced the (nonexistent)
electron-vABI tag; letting prebuild-install use the napi prebuild yields a real
Windows PE binary (verified: 'PE32+ executable ... x86-64').

So registry-js (GPO/MDM policy + Windows light/dark detection) now works on
Windows with NO Windows runner. --config.npmRebuild=false keeps electron-builder
from re-clobbering it with a host rebuild. Combined with the defensive guards (C),
windows-focus-assist (no prebuilds; needs MSVC) simply stays disabled -> only
Focus-Assist DND is lost until a Windows runner (#12) is ever added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mohlec changed title from fix(desktop): defensive native-module loading — stop the Windows startup crash to fix(desktop): Windows native modules — registry-js via N-API prebuild + defensive loading 2026-07-15 01:57:06 +00:00
mohlec merged commit e9ec2c6b27 into slash/main 2026-07-15 02:09:21 +00:00
mohlec deleted branch fix/desktop-native-modules 2026-07-15 02:09:22 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
slash/slash-desktop!11
No description provided.