experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(profiles): enforce dev profile isolation from production

Development builds (source/dev-packaged) now ALWAYS use 'dev' profile,
never touching production profiles regardless of profiles.db active profile.

Profile selection logic:
1. Explicit PROFILE env var (testing override)
2. Development builds → force 'dev' (isolation)
3. Production builds → use profiles.db active profile
4. Fallback → 'default'

This ensures:
- Dev builds never touch production data
- Single-instance lock skips dev profiles (already implemented)
- Dev and production can run side-by-side safely

+10 -7
+10 -7
backend/electron/entry.ts
··· 145 145 146 146 // Profile selection: 147 147 // 1. Explicit PROFILE env var takes precedence (for dev/testing) 148 - // 2. Active profile from profiles.db (normal operation) 149 - // 3. Packaged app in /Applications uses 'default' (production fallback) 150 - // 4. Packaged app in out/ directory uses 'dev' (dev packaged build fallback) 151 - // 5. Running from source uses 'dev' (development fallback) 148 + // 2. Development builds (source/dev-packaged) ALWAYS use 'dev' (isolation from production) 149 + // 3. Production packaged builds use active profile from profiles.db 150 + // 4. Fallback to 'default' if profiles.db fails 152 151 let PROFILE: string; 153 152 154 153 if (profileIsLegit(process.env.PROFILE)) { 155 154 // Explicit env var takes precedence 156 155 PROFILE = process.env.PROFILE; 157 156 DEBUG && console.log('[profiles] Using PROFILE env var:', PROFILE); 157 + } else if (!app.isPackaged || isDevPackagedBuild()) { 158 + // Development builds ALWAYS use 'dev' profile (never touch production profiles) 159 + PROFILE = 'dev'; 160 + DEBUG && console.log('[profiles] Development build, forcing dev profile'); 158 161 } else { 159 - // Try to get active profile from profiles.db 162 + // Production packaged build - use active profile from profiles.db 160 163 try { 161 164 const activeProfile = getActiveProfile(); 162 165 PROFILE = activeProfile.slug; 163 166 DEBUG && console.log('[profiles] Using active profile from profiles.db:', PROFILE); 164 167 } catch (error) { 165 - // Fallback to default behavior if profiles.db fails 166 - PROFILE = app.isPackaged && !isDevPackagedBuild() ? 'default' : 'dev'; 168 + // Fallback to default if profiles.db fails 169 + PROFILE = 'default'; 167 170 DEBUG && console.log('[profiles] Fallback to default PROFILE:', PROFILE); 168 171 } 169 172 }