Skip to content

fix: harden better-sqlite3 Electron ABI compatibility and install workflow#3

Merged
astyfx merged 6 commits intomainfrom
worktree-release-0.0.18
Mar 25, 2026
Merged

fix: harden better-sqlite3 Electron ABI compatibility and install workflow#3
astyfx merged 6 commits intomainfrom
worktree-release-0.0.18

Conversation

@astyfx
Copy link
Copy Markdown
Member

@astyfx astyfx commented Mar 25, 2026

Summary

  • add postinstall hook so bun install automatically recompiles better-sqlite3 and node-pty against the Electron ABI — eliminates the most common NODE_MODULE_VERSION mismatch for new contributors
  • add .nvmrc (Node 22) and engines: { node: ">=20" } so the host toolchain is consistent across machines
  • fix resolveElectronVersion to read the actual installed version from node_modules/electron/package.json instead of stripping the semver range prefix, ensuring compiled ABI always matches what is on disk
  • add SKIP_ELECTRON_REBUILD=1 escape hatch for CI or pure web-build environments
  • surface better-sqlite3 load failures in the Electron main-process log via console.error in the sync IPC persistence handler (was silently returning { ok: false })
  • expand README with Node version requirement, C++ toolchain prerequisites, a dedicated "Running the desktop app" section for bun run run:desktop:built, and a troubleshooting table
  • rename stave-patch-release skill to stave-release, remove hardcoded repo paths, remove public remote references, update workflow to PR-based release

Test plan

  • bun run typecheck passes
  • bun test passes
  • fresh bun install on a machine with a different Node version triggers rebuild automatically
  • SKIP_ELECTRON_REBUILD=1 bun install skips the rebuild without error
  • bun run run:desktop:built launches the app and persistence works (no ABI crash)

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 25, 2026 01:22
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Release prep for 0.0.18 focused on improving Electron native-module install/rebuild reliability, aligning contributor toolchains, and making provider icon URLs stable across the UI.

Changes:

  • Add a postinstall hook and SKIP_ELECTRON_REBUILD escape hatch for rebuilding Electron native deps (better-sqlite3, node-pty).
  • Improve Electron version detection by reading the installed node_modules/electron/package.json.
  • Stabilize provider icon URL resolution, update UI usage, and extend tests/docs/logging accordingly.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/model-catalog.test.ts Adds coverage for getProviderIconUrl and theme-specific Stave icon behavior.
src/lib/providers/model-catalog.ts Introduces asset-backed icon URL constants and routes icon selection through getProviderIconUrl.
src/components/layout/StaveAppMenuButton.tsx Switches Stave menu logo to use getProviderIconUrl.
scripts/rebuild-electron-deps.mjs Resolves Electron version from installed package; adds SKIP_ELECTRON_REBUILD skip path.
package.json Bumps version, adds Node engines constraint, and adds postinstall rebuild hook.
electron/main/ipc/persistence.ts Logs persistence upsert failures to main-process console for visibility.
README.md Documents toolchain prerequisites, postinstall behavior, run flow, and troubleshooting.
CHANGELOG.md Adds 0.0.18 entry summarizing the release highlights.
.nvmrc Pins Node to 22 (LTS per PR description).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/providers/model-catalog.ts Outdated
Comment thread README.md Outdated
…kflow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@astyfx astyfx force-pushed the worktree-release-0.0.18 branch from 49fc65f to 99c6793 Compare March 25, 2026 01:29
@astyfx astyfx changed the title chore: release 0.0.18 fix: harden better-sqlite3 Electron ABI compatibility and install workflow Mar 25, 2026
astyfx and others added 2 commits March 25, 2026 10:33
Triggers when a PR titled `chore: release x.y.z` is merged into main
(the pattern the stave-release skill produces). On merge it:
- reads the version bumped in package.json
- builds the macOS DMG via electron-builder
- creates a GitHub release tagged v{version} with auto-generated notes
- attaches the DMG as a release asset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
better-sqlite3 upstream changed getter C++ source from direct info.This()
calls to a PROPERTY_HOLDER(info) macro. Update patch from/to strings to
match the new source shape so the HolderV2() fix applies correctly on
all current versions.

Absorbs fix/better-sqlite3-patch-property-holder (PR #1).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
astyfx and others added 2 commits March 25, 2026 10:38
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@astyfx astyfx enabled auto-merge (squash) March 25, 2026 01:52
@astyfx astyfx merged commit 97296c8 into main Mar 25, 2026
3 checks passed
@astyfx astyfx deleted the worktree-release-0.0.18 branch March 25, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants