Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions .github/workflows/build-native-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Build Native Modules
#
# build -> compile on an OLD-glibc container (manylinux_2_28, glibc 2.28
# floor) so the .node load on older-but-supported distros.
# validate -> on a normal runner, load each .node under real Electron 42 and
# validate -> on a normal runner, load each .node under the real target Electron and
# run the encrypted-DB smoke test (ABI + round-trip + wrong-key).
# publish -> only on a manual dispatch with publish=true: attach the four
# .node + checksums + provenance to the release named by release_tag
Expand All @@ -20,10 +20,15 @@ on:
workflow_dispatch:
inputs:
electron_version:
description: "Electron version to target (ABI must be 146)"
description: "Electron version to target"
required: false
type: string
default: "42.3.0"
default: "44.7.2"
electron_abi:
description: "NODE_MODULE_VERSION of that Electron (44 -> 149)"
required: false
type: string
default: "149"
release_tag:
description: "Release tag to publish assets to (e.g. native-v1)"
required: false
Expand All @@ -46,7 +51,8 @@ permissions:

env:
NODE_VERSION: "22.22.0"
ELECTRON_VERSION: ${{ inputs.electron_version || '42.3.0' }}
ELECTRON_VERSION: ${{ inputs.electron_version || '44.7.2' }}
ELECTRON_ABI: ${{ inputs.electron_abi || '149' }}

jobs:
#=============================================================================
Expand Down Expand Up @@ -107,7 +113,7 @@ jobs:
if-no-files-found: error

#=============================================================================
# validate -- load under real Electron 42 + encrypted-DB smoke, on a full
# validate -- load under the real target Electron + encrypted-DB smoke, on a full
# runner (the old-glibc container can't reliably start Electron).
#=============================================================================
validate:
Expand Down Expand Up @@ -150,7 +156,7 @@ jobs:
run: |
chmod +x scripts/native-modules/smoke-test.sh
scripts/native-modules/smoke-test.sh \
native-out "$PWD/electron-dist/electron" 146
native-out "$PWD/electron-dist/electron" "$ELECTRON_ABI"

#=============================================================================
# publish -- attach the four .node + checksums + provenance to release_tag.
Expand Down Expand Up @@ -197,6 +203,6 @@ jobs:
body: |
Prebuilt Linux native sqlite addons for Wispr Flow, rebuilt from
public npm + the in-repo V8 14.8 patch against Electron
${{ env.ELECTRON_VERSION }} (ABI 146). Built on glibc 2.28
${{ env.ELECTRON_VERSION }} (ABI ${{ env.ELECTRON_ABI }}). Built on glibc 2.28
(manylinux_2_28). Consumed via scripts/setup/fetch-native-bin.sh,
pinned in native-modules-version.txt. Verify against SHA256SUMS.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ Clean-room Linux rebuild of the two native sqlite addons Wispr Flow ships only a
- `better-sqlite3-multiple-ciphers` — the encrypted SQLCipher DB engine
- `sqlite3` — plain sqlite

On Linux they must be rebuilt against Electron 42's V8 14.8 / Node 24 ABI (146).
`better-sqlite3-multiple-ciphers` does **not** compile against V8 14.8 unpatched;
On Linux they must be rebuilt against the target Electron's V8 / Node ABI
(Electron 44.7.2: V8 15.2 / Node 24, ABI 149).
`better-sqlite3-multiple-ciphers` does **not** compile against V8 14.8 or newer unpatched;
the clean-room patch in [`scripts/patches/`](scripts/patches/) is applied to a
pristine public-npm checkout. **No Wispr Flow code is involved** — these are
rebuilt entirely from public npm + the in-repo V8 patch, mirroring the
Expand All @@ -25,8 +26,8 @@ rebuilt entirely from public npm + the in-repo V8 patch, mirroring the
|---|---|
| `scripts/rebuild-native-modules.sh` | The single source of rebuild truth (deterministic, lockfile-pinned). |
| `scripts/native-modules/` | Pinned `package.json` / `package-lock.json` + the Electron smoke test. |
| `scripts/patches/v8-14.8-better-sqlite3-multiple-ciphers.patch` | The V8 14.8 ABI patch. |
| `.github/workflows/build-native-modules.yml` | build (old glibc) → validate (real Electron 42) → publish to a `native-v*` release. |
| `scripts/patches/v8-14.8-better-sqlite3-multiple-ciphers.patch` | The V8 ABI patch (written for 14.8, still applies on 15.2). |
| `.github/workflows/build-native-modules.yml` | build (old glibc) → validate (real Electron 44) → publish to a `native-v*` release. |

## Releases

Expand All @@ -39,7 +40,7 @@ SHA256SUMS (over all .node)
```

Built on **glibc 2.28** (`manylinux_2_28`) so the addons load on older-but-still-
supported distros, and validated by loading each `.node` under real Electron 42
supported distros, and validated by loading each `.node` under real Electron 44
plus an encrypted-DB round-trip + wrong-key smoke test.

## Consumed by
Expand Down
12 changes: 6 additions & 6 deletions scripts/native-modules/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions scripts/native-modules/smoke-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Runs the addons through their ACTUAL JS wrappers under Electron (RUN_AS_NODE,
# so no display is needed) and asserts:
# 1. NODE_MODULE_VERSION matches the expected Electron ABI (default 146).
# 1. NODE_MODULE_VERSION matches the expected Electron ABI (default 149).
# 2. better-sqlite3-multiple-ciphers opens an encrypted SQLCipher DB, round-
# trips a row, and REJECTS a wrong key (the encrypted data path -- the V8
# patch's getters all run here).
Expand All @@ -19,7 +19,7 @@
# Usage: smoke-test.sh <node_dir> <electron_bin> [electron_abi]
# node_dir dir holding better_sqlite3.node + node_sqlite3.node
# electron_bin path to an Electron binary (the target version)
# electron_abi expected NODE_MODULE_VERSION (default: 146)
# electron_abi expected NODE_MODULE_VERSION (default: 149)
#
# Requires: node, npm, the Electron binary. Exit 0 on pass.
#===============================================================================
Expand All @@ -34,7 +34,7 @@ die() { printf 'smoke-test: %s\n' "$*" >&2; exit 1; }

node_dir="$(cd "$1" 2>/dev/null && pwd)" || die "node_dir not found: $1"
electron_bin="$2"
electron_abi="${3:-146}"
electron_abi="${3:-149}"

[[ -x $electron_bin ]] || die "electron binary not executable: $electron_bin"
[[ -f "$node_dir/better_sqlite3.node" ]] \
Expand Down
17 changes: 10 additions & 7 deletions scripts/rebuild-native-modules.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/usr/bin/env bash
#===============================================================================
# rebuild-native-modules.sh -- rebuild Wispr Flow's native sqlite addons for the
# Linux Electron 42 ABI, deterministically, from public npm + the in-repo V8
# target Linux Electron ABI, deterministically, from public npm + the in-repo V8
# patch. NO Wispr Flow code is involved.
#
# The shipped app carries WINDOWS PE .node for:
# better-sqlite3-multiple-ciphers (encrypted SQLCipher DB engine)
# sqlite3 (plain sqlite)
# On Linux they must be rebuilt against Electron's V8 14.8 / Node 24 ABI (146).
# better-sqlite3-multiple-ciphers does NOT compile against V8 14.8 unpatched;
# On Linux they must be rebuilt against the target Electron's V8 / Node ABI
# (Electron 44: V8 15.2 / Node 24, ABI 149).
# better-sqlite3-multiple-ciphers does NOT compile against V8 14.8+ unpatched;
# the clean-room patch in scripts/patches/ is applied to a pristine checkout.
#
# This is the single source of rebuild truth, shared by:
Expand All @@ -26,7 +27,8 @@
# <arch> x86_64 | aarch64 | amd64 | arm64 | x64
# out_dir where the verified .node + checksums + lock are written
# Env:
# ELECTRON_VERSION electron to target (default: 42.3.0)
# ELECTRON_VERSION electron to target (default: 44.7.2)
# ELECTRON_ABI its NODE_MODULE_VERSION (default: 149)
# ELECTRON_BIN electron binary for the runtime ABI assertion (optional
# but STRONGLY recommended; without it the ABI check is
# skipped and a wrong-ABI build could slip through)
Expand All @@ -41,10 +43,11 @@ set -uo pipefail
readonly BSC_VERSION='12.5.0' # better-sqlite3-multiple-ciphers
readonly SQLITE_VERSION='5.1.7' # sqlite3
readonly REBUILD_VERSION='4.0.4' # @electron/rebuild
readonly ELECTRON_ABI='146' # NODE_MODULE_VERSION (Electron 42/V8 14.8)

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
electron_version="${ELECTRON_VERSION:-42.3.0}"
electron_version="${ELECTRON_VERSION:-44.7.2}"
# NODE_MODULE_VERSION of that Electron (44 -> 149, 42 -> 146)
readonly ELECTRON_ABI="${ELECTRON_ABI:-149}"
patch_file="$script_dir/patches/v8-14.8-better-sqlite3-multiple-ciphers.patch"
pinned_dir="$script_dir/native-modules"

Expand Down Expand Up @@ -142,7 +145,7 @@ verify_smoke() {
if [[ -z ${ELECTRON_BIN:-} ]]; then
log 'WARNING: ELECTRON_BIN unset -- skipping the ABI + encrypted-DB smoke'
log ' test. A wrong-ABI build (e.g. compiled against system Node headers)'
log ' will NOT be caught here. Set ELECTRON_BIN to the staged Electron 42.'
log ' will NOT be caught here. Set ELECTRON_BIN to the staged Electron.'
return 0
fi
bash "$pinned_dir/smoke-test.sh" "$out_dir" "$ELECTRON_BIN" "$ELECTRON_ABI" \
Expand Down