Skip to content

Commit 33b26ab

Browse files
Mayank PandeyMayank Pandey
authored andcommitted
Major fix: Resolve macOS ARM backend crash
1 parent 2fb67ca commit 33b26ab

23 files changed

Lines changed: 1918 additions & 2681 deletions

.github/CODE_SIGNING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ Code signing provides:
4646
4747
- name: Build Tauri app (with signing)
4848
env:
49-
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
50-
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
49+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
50+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
5151
run: |
5252
cd frontend
53-
npm run tauri build
53+
pnpm run tauri build
5454
```
5555
5656
### Option 2: Self-Signed Certificate (For testing/development)

.github/RELEASE_PROCESS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This document outlines the complete release process for Local Lens, ensuring tra
1717
```bash
1818
# Update package.json
1919
cd frontend
20-
npm version patch|minor|major --no-git-tag-version
20+
pnpm version patch|minor|major --no-git-tag-version
2121

2222
# Update Cargo.toml
2323
cd src-tauri
@@ -132,8 +132,8 @@ git checkout v1.2.3
132132
```yaml
133133
# In .github/workflows/release.yml
134134
env:
135-
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
136-
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
135+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
136+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
137137
```
138138
139139
#### macOS (Requires Apple Developer Account)

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ jobs:
2727
with:
2828
node-version: ${{ env.NODE_VERSION }}
2929

30+
- name: Setup pnpm
31+
uses: pnpm/action-setup@v4
32+
with:
33+
version: 10
34+
3035
- name: Setup Rust
3136
uses: dtolnay/rust-toolchain@stable
3237

@@ -41,7 +46,6 @@ jobs:
4146
.\venv\Scripts\activate
4247
python -m pip install --upgrade pip
4348
pip install -r requirements.txt
44-
pip install pyinstaller
4549
4650
- name: Test backend build
4751
run: |
@@ -52,7 +56,7 @@ jobs:
5256
- name: Install frontend requirements
5357
run: |
5458
cd frontend
55-
npm install
59+
pnpm install --frozen-lockfile
5660
5761
- name: Copy backend executable
5862
run: |
@@ -61,7 +65,7 @@ jobs:
6165
- name: Test frontend build
6266
run: |
6367
cd frontend
64-
npm run build
68+
pnpm run build
6569
6670
- name: Test Tauri build (debug)
6771
run: |
@@ -85,4 +89,4 @@ jobs:
8589
Write-Output "Updated tauri.conf.json to disable signing and remove updater config."
8690
}
8791
88-
npm run tauri build -- --debug
92+
pnpm run tauri build -- --debug

.github/workflows/release.yml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ jobs:
3939
with:
4040
node-version: ${{ env.NODE_VERSION }}
4141

42+
- name: Setup pnpm
43+
uses: pnpm/action-setup@v4
44+
with:
45+
version: 10
46+
4247
- name: Setup Rust
4348
uses: dtolnay/rust-toolchain@stable
4449
with:
@@ -55,18 +60,42 @@ jobs:
5560
source .venv/bin/activate
5661
python -m pip install --upgrade pip setuptools wheel
5762
pip install -r requirements.txt
58-
pip install pyinstaller==6.11.1
5963
6064
- name: Build Python backend with PyInstaller
6165
run: |
6266
cd backend
6367
source .venv/bin/activate
6468
python -m PyInstaller backend_server.spec
6569
70+
- name: Smoke test backend startup (macOS)
71+
run: |
72+
cd backend
73+
source .venv/bin/activate
74+
./dist/backend_server/backend_server > backend-smoke.log 2>&1 &
75+
backend_pid=$!
76+
sleep 10
77+
78+
echo "=== backend smoke log ==="
79+
cat backend-smoke.log
80+
81+
if grep -E "(ModuleNotFoundError|ImportError|Failed to execute script)" backend-smoke.log; then
82+
echo "Backend smoke test failed: startup import error detected"
83+
kill "$backend_pid" 2>/dev/null || true
84+
exit 1
85+
fi
86+
87+
if ! kill -0 "$backend_pid" 2>/dev/null; then
88+
echo "Backend smoke test failed: backend process exited early"
89+
exit 1
90+
fi
91+
92+
echo "Backend smoke test passed: process is running without import errors"
93+
kill "$backend_pid" 2>/dev/null || true
94+
6695
- name: Install frontend requirements
6796
run: |
6897
cd frontend
69-
npm install
98+
pnpm install --frozen-lockfile
7099
71100
- name: Copy backend bundle for Tauri
72101
run: |
@@ -76,10 +105,10 @@ jobs:
76105
- name: Build Tauri application
77106
env:
78107
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
79-
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
108+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
80109
run: |
81110
cd frontend
82-
npm run tauri build
111+
pnpm run tauri build
83112
84113
- name: Find macOS build artifacts
85114
id: find_files
@@ -213,6 +242,11 @@ jobs:
213242
with:
214243
node-version: ${{ env.NODE_VERSION }}
215244

245+
- name: Setup pnpm
246+
uses: pnpm/action-setup@v4
247+
with:
248+
version: 10
249+
216250
- name: Setup Rust
217251
uses: dtolnay/rust-toolchain@stable
218252

@@ -228,7 +262,6 @@ jobs:
228262
.\venv\Scripts\activate
229263
python -m pip install --upgrade pip
230264
pip install -r requirements.txt
231-
pip install pyinstaller
232265
233266
# Backend: Build with PyInstaller using your spec file
234267
- name: Build Python backend with PyInstaller
@@ -241,7 +274,7 @@ jobs:
241274
- name: Install frontend requirements
242275
run: |
243276
cd frontend
244-
npm install
277+
pnpm install --frozen-lockfile
245278
246279
# Run ensure-backend.js to copy and rename the backend executable
247280
- name: Copy and rename backend executable
@@ -253,20 +286,18 @@ jobs:
253286
run: |
254287
cd frontend/src-tauri
255288
# Install any additional Tauri-specific requirements if needed
256-
# Currently using npm install from frontend folder covers this
289+
# Currently using pnpm install from frontend folder covers this
257290
258291
259292
# Build the final application
260293
- name: Build Tauri application
261294
env:
262-
# Pass the Base64 secret DIRECTLY here.
263-
# Tauri will handle the decoding automatically.
264295
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
265-
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ''
296+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
266297

267298
run: |
268299
cd frontend
269-
npm run tauri build
300+
pnpm run tauri build
270301
271302
272303
@@ -531,6 +562,7 @@ jobs:
531562
2. Open the DMG and drag Local Lens to Applications
532563
3. Fix Gatekeeper block (choose one):
533564
- Download and double-click Fix_Local_Lens.command
565+
- If blocked: run `bash ~/Downloads/Fix_Local_Lens.command`
534566
- Right-click the app, Open, click Open in the dialog
535567
- Terminal: xattr -cr "/Applications/Local Lens.app"
536568

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ cython_debug/
214214
# Ignore the user-specific configuration and path presets.
215215
# These files store local paths and settings that should not be in version control.
216216
/backend/presets/
217+
/.backend/for dev/Reach.txt
217218

218219
# Ignore any log files that might be generated in the backend directory.
219220
/backend/*.log

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to Local Lens will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.3.0] - 2026-04-03
9+
10+
### Fixed
11+
12+
- Fixed critical backend crash on macOS Apple Silicon (M-series) caused by `numpy` dependency incompatibility.
13+
- Resolved Tauri auto-updater code signing failures during the build process.
14+
- Hardened PyInstaller build spec to properly bundle native C-extensions.
15+
16+
### Added
17+
18+
- Added background backend smoke tests in CI/CD pipeline to verify build integrity prior to packaging.
19+
820
## [2.2.1] - 2025-12-31
921

1022
### Added

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pip install -r requirements.txt
4242

4343
# Frontend setup
4444
cd ../frontend
45-
npm install
45+
pnpm install
4646
```
4747

4848
**macOS (Intel & Apple Silicon):**
@@ -59,7 +59,7 @@ pip install -r requirements.txt
5959

6060
# Frontend setup
6161
cd ../frontend
62-
npm install
62+
pnpm install
6363
```
6464

6565
**Linux:**
@@ -75,7 +75,7 @@ pip install -r requirements.txt
7575

7676
# Frontend setup
7777
cd ../frontend
78-
npm install
78+
pnpm install
7979
```
8080

8181
4. **Run the application in development mode**:
@@ -86,7 +86,7 @@ python main.py
8686

8787
# Terminal 2: Start frontend
8888
cd frontend
89-
npm run tauri dev
89+
pnpm run tauri dev
9090
```
9191

9292
## 🤝 How to Contribute
@@ -139,10 +139,10 @@ python -m pytest tests/
139139

140140
# Run frontend tests
141141
cd frontend
142-
npm test
142+
pnpm test
143143

144144
# Test the full application
145-
npm run tauri dev
145+
pnpm run tauri dev
146146
```
147147

148148
#### Step 4: Commit and Push

Local Lens - Installation & Setup Guid.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ pip install -r requirements.txt
123123
> **Note**: If you're using Python 3.12+, you MUST install `dlib` via Homebrew first.
124124
> The `rawpy` library is replaced by `Wand` (ImageMagick) on macOS for RAW image support.
125125
126-
*Linux:*
127126
```bash
128127
# Ensure development packages are installed
129128
sudo apt install build-essential cmake libopenblas-dev liblapack-dev
@@ -135,7 +134,7 @@ pip install face_recognition
135134

136135
```bash
137136
cd ../frontend
138-
npm install
137+
pnpm install
139138
```
140139

141140
### 4. Development Workflow
@@ -157,7 +156,7 @@ The backend will start on `http://127.0.0.1:8000`
157156
**Terminal 2: Frontend & Tauri**
158157
```bash
159158
cd frontend
160-
npm run tauri dev
159+
pnpm run tauri dev
161160
```
162161
This will:
163162
- Start the Vite development server
@@ -170,10 +169,10 @@ Force Tauri to launch the bundled `backend_server` executable (sidecar) instead
170169
**Terminal:**
171170
```powershell
172171
# Windows PowerShell
173-
$env:USE_SIDECAR="true"; npm run tauri dev
172+
$env:USE_SIDECAR="true"; pnpm run tauri dev
174173
175174
# macOS/Linux
176-
USE_SIDECAR=true npm run tauri dev
175+
USE_SIDECAR=true pnpm run tauri dev
177176
```
178177

179178
## 🔧 Building for Production
@@ -230,7 +229,7 @@ This script will:
230229
cd frontend
231230

232231
# Build production version
233-
npm run tauri build
232+
pnpm run tauri build
234233
```
235234

236235
This will create:
@@ -281,11 +280,11 @@ python -m PyInstaller --hidden-import=missing_module_name ...
281280
#### Tauri Build Issues
282281
```bash
283282
# Clear Tauri build cache
284-
npm run tauri clean
283+
pnpm run tauri clean
285284

286285
# Rebuild node modules if needed
287-
rm -rf node_modules package-lock.json
288-
npm install
286+
rm -rf node_modules pnpm-lock.yaml
287+
pnpm install
289288
```
290289

291290
#### Face Recognition Issues

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ brew install ashesbloom/locallens/local-lens
4242
2. Drag **Local Lens** to Applications
4343
3. **Fix Gatekeeper** (required for unsigned apps):
4444
- Download and double-click `Fix_Local_Lens.command` from the release
45+
- If macOS blocks double-click: `bash ~/Downloads/Fix_Local_Lens.command`
4546
- Or: Right-click the app → Open → Click "Open"
4647
- Or run in Terminal:
4748
```bash

backend/backend_server.spec

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import site
55
from pathlib import Path
66
import face_recognition_models
77
import reverse_geocoder
8+
from PyInstaller.utils.hooks import collect_dynamic_libs, collect_submodules
89

910
block_cipher = None
1011

@@ -17,14 +18,17 @@ datas = [
1718
(str(rg_path), 'reverse_geocoder'),
1819
]
1920

21+
numpy_hiddenimports = collect_submodules('numpy')
22+
numpy_binaries = collect_dynamic_libs('numpy')
23+
2024
# Use a platform-neutral base name; PyInstaller adds .exe on Windows automatically.
2125
exe_name = 'backend_server'
2226

2327

2428
a = Analysis(
2529
['main.py'],
2630
pathex=[],
27-
binaries=[],
31+
binaries=numpy_binaries,
2832
datas=datas,
2933
hiddenimports=[
3034
'multiprocessing',
@@ -33,7 +37,7 @@ a = Analysis(
3337
'multiprocessing.synchronize',
3438
'multiprocessing.resource_tracker',
3539
'_multiprocessing',
36-
],
40+
] + numpy_hiddenimports,
3741
hookspath=[],
3842
hooksconfig={},
3943
runtime_hooks=[],

0 commit comments

Comments
 (0)