fix(desktop): upgrade better-sqlite3 to 13 so the Electron 43 installer builds and opens its database

better-sqlite3 12.8.0 has no prebuild for Electron 43 (ABI 148) and does not compile against
its V8 API, so the v1.18.0 installer build stopped in fix-native-abi and was never published.
13.2.0 ships Node-API prebuilds in the package; one binary runs on Node and Electron.

- fix-native-abi.mjs: nothing to swap when the packaged module is a Node-API prebuild.
- verify-native-abi.mjs: require the target prebuild, fail on a shadowing build/Release binary,
  and open a database through the packaged module.
- electron-builder: leave out the linux prebuilds we do not ship.

Verified: desktop 2,933 tests on Node 24, and WAL/transaction/FTS5 queries in an Electron
43.8.10 main process.
This commit is contained in:
Yun Chan 2026-11-20 15:30:08 +09:00
parent a117bc0d09
commit fb5f76f57f
9 changed files with 88 additions and 255 deletions

View file

@ -227,7 +227,7 @@ Full detail: [`09-supabase-backend.md`](./09-supabase-backend.md).
## 8. `scripts/` groups
- **CI (`scripts/ci/`, 33 files):** build/version/release (`build-all`, `sync-version`, `generate-checksums`, `verify-release-metadata`, `create-release-tag`, `extract-release-notes`), security (`check-no-hardcoded-secrets`), mobile release gates (`verify-mobile-release-boundary/-config/-build-config`, `verify-android-artifact/-app-links`, `verify-play-store-assets`, `prepare-whisper-model`, `create-mobile-release-evidence`, `prepare-mobile-release-publication`, emulator/CSPRNG gates), keys (`create-desktop-license-keypair`, `create-release-evidence-key`, etc.), publish (`publish-forgejo-release` canonical, `publish-gitlab-release` mirror; the legacy `sync-and-publish-forgejo-release`/`upload-asset-to-forgejo-release` scripts were deleted 2026-09-26, Wave 3, cd9d199), env/tooling (`bootstrap-linux-toolchain.sh`, `audit-nas-stt-config.ps1`, mobile local E2E scripts).
- **Packaged native gate:** `verify-native-abi.mjs` rejects a packaged `better_sqlite3.node` that the host Node runtime can load (wrong ABI) and requires the target-specific `uiohook-napi/prebuilds/<platform>-<arch>/uiohook-napi.node`. `--self-test` proves the missing/present N-API fixture; relative and absolute `--dir` inputs resolve to the same package. `build-desktop-installer.mjs` and `build-portable.mjs` repair only the better-sqlite3 ABI, verify both native contracts, and require `resources/app-update.yml` before publication.
- **Packaged native gate:** since better-sqlite3 13 (Node-API prebuild inside the package, 2026-11-20) `verify-native-abi.mjs` requires the target `better-sqlite3/prebuilds/<platform>-<arch>.node`, fails if a stale `build/Release` binary would shadow it, and opens a database through the packaged module; for an older ABI-bound layout it still rejects a packaged `better_sqlite3.node` that the host Node runtime can load (wrong ABI) and requires the target-specific `uiohook-napi/prebuilds/<platform>-<arch>/uiohook-napi.node`. `--self-test` proves the missing/present N-API fixture; relative and absolute `--dir` inputs resolve to the same package. `build-desktop-installer.mjs` and `build-portable.mjs` repair only the better-sqlite3 ABI, verify both native contracts, and require `resources/app-update.yml` before publication.
- **Deploy/release:** `deploy-nas.ps1/.sh`, `nas-control.sh`, `publish-gh.ps1`, `gen-keystore.js` (`deploy-site-to-nas.js` deleted 2026-09-26, Wave 3, cd9d199 — site deploy is Cloudflare Pages only).
- **Android artifact verification (2026-11-01):** `verify-android-artifact.mjs` parses both legacy `Signer #1` and Build Tools 37 `V2/V3.x Signer` certificate output. Self-test and the actual universal E2E APK verification pass with Build Tools `37.0.0`.
- **GCP/Google OAuth automation + inspection (~70 `*.mjs`):** `auto-configure-oauth`, `automate-google-oauth`, `setup-consent`, `create-*-client`, `check-*`, `inspect-*` — mostly one-off/browser-driven console automation.