From fb5f76f57f932485a5f088ccc1a12d5004e593fd Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Fri, 20 Nov 2026 15:30:08 +0900 Subject: [PATCH] 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. --- CHANGELOG.md | 10 +- apps/desktop/electron-builder.yml | 2 + apps/desktop/package.json | 2 +- docs/map/02-infrastructure.md | 2 +- docs/map/11-gap-backlog.md | 2 +- memory/project_status.md | 1 + package-lock.json | 268 +++--------------------------- scripts/ci/fix-native-abi.mjs | 12 ++ scripts/ci/verify-native-abi.mjs | 44 ++++- 9 files changed, 88 insertions(+), 255 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61989dcc..d3fed86f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Plugin system for custom pipelines +## [1.18.1] - 2026-11-20 + +> Supersedes unpublished `1.18.0`, whose installer could not be built, and ships everything listed under `1.18.0`. + +### Fixed +- The Electron 43 installer can be built and can open its database again: the SQLite driver is upgraded to better-sqlite3 13, whose Node-API binary runs on both Node and Electron. The previous driver had no Electron 43 build and did not compile against it. +- The release build now verifies the packaged database driver by opening a database and running a query, instead of only checking which runtime it was compiled for. + ## [1.18.0] - 2026-11-20 -> Screen text capture (OCR) for Windows, plus the Electron 43 toolchain upgrade and the 2026-11-17 backlog batch. +> Screen text capture (OCR) for Windows, plus the Electron 43 toolchain upgrade and the 2026-11-17 backlog batch. Never published — see `1.18.1`. ### Added - **Screen text capture (OCR).** Press `Ctrl+Alt+O` (rebindable under Settings → key bindings) to freeze the monitor under the cursor and select the text on it: diff --git a/apps/desktop/electron-builder.yml b/apps/desktop/electron-builder.yml index 08a456a9..77bb9219 100644 --- a/apps/desktop/electron-builder.yml +++ b/apps/desktop/electron-builder.yml @@ -22,6 +22,8 @@ files: - "!out/**/*.map" # ffmpeg 정적 바이너리(61MB)는 설치본에 넣지 않는다 — 필요할 때 런타임으로 내려받는다 - "!node_modules/@ffmpeg-installer/**" + # better-sqlite3 13 은 모든 플랫폼의 Node-API 프리빌드를 싣는다 — 내지 않는 플랫폼(linux)은 뺀다 + - "!node_modules/better-sqlite3/prebuilds/linux*" # ──────────────────────────────────────────────────────────────────── # 자동 업데이트 feed — 이 설정이 있어야 electron-builder가 diff --git a/apps/desktop/package.json b/apps/desktop/package.json index dd463f6d..fb906d9d 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -59,7 +59,7 @@ "@mui/material": "^7.0.0", "@nut-tree-fork/nut-js": "^4.2.6", "@supabase/supabase-js": "^2.45.0", - "better-sqlite3": "^12.8.0", + "better-sqlite3": "^13.2.0", "docx": "^9.6.1", "drizzle-orm": "^0.45.2", "electron-log": "^5.2.0", diff --git a/docs/map/02-infrastructure.md b/docs/map/02-infrastructure.md index 6bfa3f24..c40b50fb 100644 --- a/docs/map/02-infrastructure.md +++ b/docs/map/02-infrastructure.md @@ -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/-/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/-.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/-/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. diff --git a/docs/map/11-gap-backlog.md b/docs/map/11-gap-backlog.md index 451cecae..e9ae498d 100644 --- a/docs/map/11-gap-backlog.md +++ b/docs/map/11-gap-backlog.md @@ -132,7 +132,7 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res | GAP-OPS-01 | Ops | **Production Supabase was five migrations behind** (`0029` content reporting, `0030` profile column ACL — users could raise their own `role`/`tier` through PostgREST, `0031` audit-log actor unlink, `0032` meeting-document reporting, `0033` team activity feed) and `content-report` was never deployed, while the map listed those features GREEN from local runs. Most functions still ran the 2026-08-21 build. | `server/supabase/migrations/`, `scripts/ci/check-supabase-migrations.mjs` | `[x]` 2026-09-27: schema+data dump taken, `db push` applied `0029`–`0035`, all functions redeployed (unauthenticated calls return 401, i.e. live and gated); `authenticated` can no longer UPDATE `profiles.tier`; real-account export returns exactly the v1 keys. **2026-11-04 boundary:** file checker는 73개 파일의 self-test/order/name/duplicate/non-empty만 다룬다. 별도 격리 로컬 stack의 empty/reset replay와 `pg-delta` shadow diff는 통과했지만 linked remote migration state/drift는 재검증하지 않았다. | | GAP-STT-01 | Cloud STT | A 5 s phone recording took ~66 s and ended on the phone's tiny local model (2026-09-27). Chain: the gateway's first endpoint (laptop GPU 192.168.0.227) is off (3 s), the NAS CPU Whisper (2 cores, load ~7) needs 30–90 s for 3 s of audio, and `stt-proxy` waited up to 60 s for the gateway. The direct OpenAI fallback **never worked**: the production `OPENAI_API_KEY` secret is not a valid header value (invisible/non-ASCII characters — `TypeError: headers … not a valid ByteString`), and whisper-1 `verbose_json` reports the language by name, which the result contract rejected. The same key backs `embed-chunks`, `search-knowledge` and `realtime-token`. | `server/supabase/functions/{stt-proxy,_shared/stt-contract.ts,_shared/provider-key.ts}` | `[!]` 2026-09-27 code fixed and deployed: gateway wait = 5 s + clip length (max 30 s) when a direct provider exists, provider language names mapped to codes, keys stripped of BOM/zero-width characters (still-invalid keys count as not configured), fail-closed responses list per-provider failures (`attempts`). **External:** re-enter a valid `OPENAI_API_KEY` (or add `GROQ_API_KEY`) in Supabase function secrets, or keep the GPU endpoint online; until then cloud STT depends on the NAS CPU. **2026-11-17 실제 운영 probe:** 임시 계정과 4.7초 로컬 TTS WAV로 `stt-proxy`가 HTTP 502 `gateway/http_504`를 반환하고 direct provider는 시도되지 않았다. NAS를 재시작한 직접 전사는 정확히 성공했으나 콜드 로딩 포함 약 101초였다. 임시 계정은 HTTP 200으로 삭제했다. 유효한 공급자 키 또는 상시 GPU가 여전히 필요하다. | -| GAP-SEC-01 | Dependencies | Docker 빌드에서 발견한 Next.js 등의 critical 취약점과 오래된 Electron/Vitest toolchain | `apps/{web,admin,desktop}/package.json`, `package-lock.json`, `apps/mobile-rn/package.json` | `[~]` 2026-11-18: Next 16.4.6, Mermaid 12.3.0, Electron 43.8.10, electron-vite 6.0.0, Vite 8.3.8, Vitest 5.1.0으로 갱신하고 Node 24 계약·비동기 Clipboard await·전체 테스트/빌드를 통과했다. 현재 audit은 critical 0, high 25 / moderate 12다. picomatch는 최신 4.0.7도 GHSA-fc5q-39xc-vjpf 대상이므로 안전한 상위 수정판이 나오면 다시 평가한다. 운영 Web `f36c4661…3906d3`·Admin `1a98f25d…36ca58` 배포와 localhost/public health 200을 확인했다. Electron 실GUI는 외부 터미널 수동 게이트로 남긴다. 증거: `docs/evidence/2026-11-17-backlog-operations.md`. | +| GAP-SEC-01 | Dependencies | Docker 빌드에서 발견한 Next.js 등의 critical 취약점과 오래된 Electron/Vitest toolchain | `apps/{web,admin,desktop}/package.json`, `package-lock.json`, `apps/mobile-rn/package.json` | `[~]` 2026-11-18: Next 16.4.6, Mermaid 12.3.0, Electron 43.8.10, electron-vite 6.0.0, Vite 8.3.8, Vitest 5.1.0으로 갱신하고 Node 24 계약·비동기 Clipboard await·전체 테스트/빌드를 통과했다. 현재 audit은 critical 0, high 25 / moderate 12다. picomatch는 최신 4.0.7도 GHSA-fc5q-39xc-vjpf 대상이므로 안전한 상위 수정판이 나오면 다시 평가한다. 운영 Web `f36c4661…3906d3`·Admin `1a98f25d…36ca58` 배포와 localhost/public health 200을 확인했다. Electron 실GUI는 외부 터미널 수동 게이트로 남긴다. 증거: `docs/evidence/2026-11-17-backlog-operations.md`. **2026-11-20:** 이 상태의 Electron 43 은 설치본을 만들 수 없었다 — better-sqlite3 12.8.0 은 Electron 43(ABI 148) 프리빌드가 없고 소스 빌드도 V8 API 변경으로 실패해 `v1.18.0` 빌드가 `fix-native-abi` 에서 멈췄다(미게시). better-sqlite3 13.2.0(Node-API 프리빌드 내장)으로 올리고 `fix-native-abi.mjs`/`verify-native-abi.mjs` 를 그 구조에 맞췄다: 데스크톱 2,933 테스트 GREEN, Electron 43.8.10 메인 프로세스에서 WAL·트랜잭션·FTS5 질의 확인. `npm run rebuild:test`/`rebuild:app` 은 더 이상 필요 없다. | --- ## 2. Mobile checklist roll-up (from `MOBILE_APP_COMPLETION_SSOT.md` §4) diff --git a/memory/project_status.md b/memory/project_status.md index ca13cc2c..1abd1ce8 100644 --- a/memory/project_status.md +++ b/memory/project_status.md @@ -10,6 +10,7 @@ - 실측: desktopCapturer 는 모니터 3대에서 2.9초(DXGI 500ms 대기 × 모니터) → GDI BitBlt 39ms 로 교체(폴백으로만 남김). 실제 화면 2560×1440 인식 0.76초(프로세스 포함 1.2초). - 검증: core 34 + 데스크톱 42 신규 테스트, 데스크톱 전체 214 files / 2,933 GREEN(Node 24.19.0), workspace typecheck·lint·hygiene·design·i18n·contract GREEN, 실엔진 프로브, 헤드리스 Electron 43 에서 오버레이(흐름/사각형 선택·복사·번역·PDF 요청·닫힘 정리) + 인쇄한 PDF 글자 층 검색 확인. - **남은 것:** 실행 중인 앱에서 단축키→포커스→선택 실사용 확인(`GAP-OCR-01`, 그래서 카탈로그는 `[~]`), macOS 엔진 없음(`GAP-OCR-02`, fail-closed 안내). +- **릴리스:** `v1.18.0` 은 설치본 빌드에서 멈춰 미게시(로컬 태그만 있음) — 기존 Electron 43 업그레이드가 better-sqlite3 12.8.0(ABI 148 프리빌드 없음·소스 빌드 실패)과 맞지 않았다. better-sqlite3 13.2.0(Node-API)으로 올리고 ABI 스크립트를 고쳐 `1.18.1` 로 다시 냈다. Node-API 라 Node/Electron 이 같은 바이너리를 쓰므로 `rebuild:test`/`rebuild:app` 은 불필요. - 함정: 기본 셸 Node 는 23 — 테스트는 `PATH="$APPDATA/npm:$PATH"`(Node 24.19.0, better-sqlite3 ABI 137)로 돌려야 한다. 한국어 OCR 팩만 있으면 작은 영문 UI 글자를 가끔 오독한다(영어 언어 팩 설치 시 오버레이에서 언어 전환 가능). ## 학습 어휘를 회의록 전사 교열에 연결 (2026-11-05) diff --git a/package-lock.json b/package-lock.json index 0518fc84..99a5ad27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -87,7 +87,7 @@ "@mui/material": "^7.0.0", "@nut-tree-fork/nut-js": "^4.2.6", "@supabase/supabase-js": "^2.45.0", - "better-sqlite3": "^12.8.0", + "better-sqlite3": "^13.2.0", "docx": "^9.6.1", "drizzle-orm": "^0.45.2", "electron-log": "^5.2.0", @@ -5858,17 +5858,24 @@ } }, "node_modules/better-sqlite3": { - "version": "12.8.0", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-12.8.0.tgz", - "integrity": "sha512-RxD2Vd96sQDjQr20kdP+F+dK/1OUNiVOl200vKBZY8u0vTwysfolF6Hq+3ZK2+h8My9YvZhHsF+RSGZW2VYrPQ==", - "hasInstallScript": true, + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-13.2.0.tgz", + "integrity": "sha512-Z8Q/9x/uNyKxA1v4FNodyItRVRw1TeKBrmj32JhxhR0ceNcBY+wMobt/Bv7M7TzwPAXjnZRtNaEsATnUZSKWZQ==", "license": "MIT", "dependencies": { - "bindings": "^1.5.0", - "prebuild-install": "^7.1.1" + "node-addon-api": "^8.0.0" }, "engines": { - "node": "20.x || 22.x || 23.x || 24.x || 25.x" + "node": ">=22" + } + }, + "node_modules/better-sqlite3/node_modules/node-addon-api": { + "version": "8.9.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.9.2.tgz", + "integrity": "sha512-VijLXbi3UACN69I0JVXJsX4tjACjNoQDgv2gTF6sx2wWEi8tkSg2eX8p5gSIFi8z2+DL3oHmY6OyKce38SDolg==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" } }, "node_modules/bindings": { @@ -5880,31 +5887,6 @@ "file-uri-to-path": "1.0.0" } }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "license": "MIT", - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -7274,6 +7256,7 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, "license": "MIT", "dependencies": { "mimic-response": "^3.1.0" @@ -7289,6 +7272,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -7297,15 +7281,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "license": "MIT", - "engines": { - "node": ">=4.0.0" - } - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -7414,6 +7389,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "devOptional": true, "license": "Apache-2.0", "engines": { "node": ">=8" @@ -8641,15 +8617,6 @@ "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", "integrity": "sha512-c2bQfLNbMzLPmzQuOr8fy0csy84WmwnER81W88DzTp9CYNPJ6yzOj2EZAh9pywYpqHnshVLHQJ8WzldAyfY+Iw==" }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", - "license": "(MIT OR WTFPL)", - "engines": { - "node": ">=6" - } - }, "node_modules/expect-type": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", @@ -8982,12 +8949,6 @@ "node": ">= 0.6" } }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "license": "MIT" - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -9098,12 +9059,6 @@ "omggif": "^1.0.10" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", - "license": "MIT" - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -9682,12 +9637,6 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "license": "ISC" }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", - "license": "ISC" - }, "node_modules/inline-style-parser": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", @@ -12225,6 +12174,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" @@ -12264,12 +12214,6 @@ "node": ">=10" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", - "license": "MIT" - }, "node_modules/mlly": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz", @@ -12312,12 +12256,6 @@ "node": "^18 || >=20" } }, - "node_modules/napi-build-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz", - "integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==", - "license": "MIT" - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -13203,45 +13141,6 @@ "node": "^12.20.0 || >=14" } }, - "node_modules/prebuild-install": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz", - "integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==", - "deprecated": "No longer maintained. Please contact the author of the relevant native addon; alternatives are available.", - "license": "MIT", - "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^2.0.0", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/prebuild-install/node_modules/node-abi": { - "version": "3.89.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.89.0.tgz", - "integrity": "sha512-6u9UwL0HlAl21+agMN3YAMXcKByMqwGx+pq+P76vii5f7hTPtKDp08/H9py6DY+cfDw7kQNTGEj/rly3IgbNQA==", - "license": "MIT", - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -13484,30 +13383,6 @@ "node": ">= 0.6" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", - "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/react": { "version": "19.2.4", "resolved": "https://registry.npmjs.org/react/-/react-19.2.4.tgz", @@ -14497,51 +14372,6 @@ "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "license": "ISC" }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/simple-get": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" - } - }, "node_modules/simple-update-notifier": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", @@ -14869,54 +14699,6 @@ "node": ">=18" } }, - "node_modules/tar-fs": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", - "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", - "license": "MIT", - "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" - } - }, - "node_modules/tar-fs/node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", - "license": "ISC" - }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "license": "MIT", - "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "license": "MIT", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/tar/node_modules/yallist": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", @@ -15263,18 +15045,6 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", - "license": "Apache-2.0", - "dependencies": { - "safe-buffer": "^5.0.1" - }, - "engines": { - "node": "*" - } - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/scripts/ci/fix-native-abi.mjs b/scripts/ci/fix-native-abi.mjs index e9422044..56d6cb13 100644 --- a/scripts/ci/fix-native-abi.mjs +++ b/scripts/ci/fix-native-abi.mjs @@ -51,6 +51,18 @@ const targetBinary = inPlace ? join(root, relativeBinary) : join(packagedDir, 'resources', 'app.asar.unpacked', relativeBinary) +// better-sqlite3 13 부터는 Node-API 프리빌드(prebuilds/-.node)가 패키지에 들어 있다. +// Node-API 바이너리는 런타임 ABI(NODE_MODULE_VERSION)에 묶이지 않아 Node 와 Electron 이 같은 파일을 쓴다 — +// 교체할 것이 없다. (12 이하는 Electron 43(ABI 148)용 프리빌드가 없고 소스 빌드도 V8 API 변경으로 실패한다.) +const moduleRoot = inPlace + ? join(root, 'node_modules', 'better-sqlite3') + : join(packagedDir, 'resources', 'app.asar.unpacked', 'node_modules', 'better-sqlite3') +const napiPrebuild = join(moduleRoot, 'prebuilds', `${process.platform}-${arch}.node`) +if (!existsSync(targetBinary) && existsSync(napiPrebuild)) { + console.log(`[native-abi] better-sqlite3 는 Node-API 프리빌드입니다 — ABI 교체 불필요 (${napiPrebuild})`) + process.exit(0) +} + if (!existsSync(targetBinary)) { console.error(`[native-abi] 패키징 트리에 better-sqlite3 바이너리가 없습니다: ${targetBinary}`) process.exit(1) diff --git a/scripts/ci/verify-native-abi.mjs b/scripts/ci/verify-native-abi.mjs index 5e090b27..74f7f5d7 100644 --- a/scripts/ci/verify-native-abi.mjs +++ b/scripts/ci/verify-native-abi.mjs @@ -150,7 +150,48 @@ const REQUIRED_ELECTRON_ABI = [ const failures = [] const notes = [] +const packagedTarget = inferPackagedTarget(packagedDir) + +/** + * better-sqlite3 13+ 는 Node-API 프리빌드를 패키지에 싣는다 (prebuilds/-.node). + * Node-API 는 런타임 ABI 에 묶이지 않으므로 "호스트 Node 가 거부해야 통과" 규칙이 뒤집힌다: + * 대상 플랫폼 프리빌드가 있어야 하고, 호스트와 같은 플랫폼이면 실제로 열어 질의까지 해 본다. + * build/Release 바이너리가 함께 있으면 로더가 그것을 먼저 집으므로(옛 ABI 종속 빌드) 실패로 본다. + */ +function verifyNapiSqlite(moduleDir) { + const prebuild = join(moduleDir, 'prebuilds', `${packagedTarget.platform}-${packagedTarget.arch}.node`) + if (!existsSync(prebuild)) return null + if (existsSync(join(moduleDir, 'build', 'Release', 'better_sqlite3.node'))) { + return { failure: 'better-sqlite3: Node-API 프리빌드와 build/Release 바이너리가 함께 있습니다 — 로더가 옛 빌드를 먼저 집습니다.' } + } + if (packagedTarget.platform !== process.platform || packagedTarget.arch !== process.arch) { + return { note: `better-sqlite3: ${packagedTarget.platform}-${packagedTarget.arch} Node-API 프리빌드 존재 확인` } + } + const probe = spawnSync( + process.execPath, + [ + '-e', + `const D=require(${JSON.stringify(moduleDir)});const d=new D(':memory:');` + + `if(d.prepare('select 1 as one').get().one!==1)process.exit(3);d.close()`, + ], + { encoding: 'utf8' }, + ) + if (probe.status !== 0) { + const output = `${probe.stdout ?? ''}${probe.stderr ?? ''}`.trim().split(String.fromCharCode(10)).slice(0, 3).join(' | ') + return { failure: `better-sqlite3: 패키징된 Node-API 모듈이 열리지 않습니다 → ${output}` } + } + return { note: 'better-sqlite3: 패키징된 Node-API 모듈로 DB 를 열고 질의함 (런타임 ABI 무관)' } +} + for (const module of REQUIRED_ELECTRON_ABI) { + if (module.name === 'better-sqlite3') { + const napi = verifyNapiSqlite(join(unpackedRoot, 'better-sqlite3')) + if (napi) { + if (napi.failure) failures.push(napi.failure) + else notes.push(napi.note) + continue + } + } const binaryPath = join(unpackedRoot, module.binary) if (!existsSync(binaryPath)) { failures.push(`${module.name}: 패키징된 네이티브 바이너리가 없습니다 → ${binaryPath}`) @@ -183,8 +224,7 @@ for (const module of REQUIRED_ELECTRON_ABI) { } } -const target = inferPackagedTarget(packagedDir) -const napiResults = requiredNapiResults(unpackedRoot, target) +const napiResults = requiredNapiResults(unpackedRoot, packagedTarget) failures.push(...napiResults.failures) notes.push(...napiResults.notes)