diff --git a/apps/desktop/README.md b/apps/desktop/README.md index ac980b5e81..db89247542 100644 --- a/apps/desktop/README.md +++ b/apps/desktop/README.md @@ -60,10 +60,12 @@ signature seal. Write access to this repository is therefore a deliberate trust assumption of the development workflow — a separate matter from who may claim the bundle's identity. -The default profile is `~/Library/Application Support/Maka Dev-`, -which keeps development isolated from the packaged Maka profile; an explicit -`--user-data-dir` takes precedence. Shutdown matches this worktree's own bundle -path, so a concurrent worktree's app is unaffected. Because that lock is keyed +The default profile is `~/Library/Application Support/Maka Dev`, which keeps +development isolated from the packaged Maka profile and is shared by the +repository CLI (`npm run cli:dev`), the plain dev build, and the TCC dev build; +an explicit `--user-data-dir` takes precedence. Shutdown matches this worktree's +own bundle path, so a concurrent worktree's app survives — and then holds the +single-instance lock for the shared profile. Because that lock is keyed on the profile, a launch first reclaims any app left over from a hard-killed session — otherwise the stale app would absorb the new launch and keep showing its old, dead Vite URL. diff --git a/apps/desktop/scripts/dev-app-runtime.mjs b/apps/desktop/scripts/dev-app-runtime.mjs index 2db7ddfc2f..bacdd08c8f 100644 --- a/apps/desktop/scripts/dev-app-runtime.mjs +++ b/apps/desktop/scripts/dev-app-runtime.mjs @@ -45,12 +45,13 @@ const MARKER = join(DEV_RUNTIME_DIR, 'runtime.json'); const ELECTRON_PACKAGE = join(REPO_ROOT, 'node_modules', 'electron', 'package.json'); const SOURCE_APP = join(REPO_ROOT, 'node_modules', 'electron', 'dist', 'Electron.app'); const WORKTREE_ID = createHash('sha256').update(REPO_ROOT).digest('hex').slice(0, 12); -const DEV_USER_DATA_DIR = join( - homedir(), - 'Library', - 'Application Support', - `Maka Dev-${WORKTREE_ID}`, -); +// Deliberately NOT worktree-scoped, unlike the bundle identifier above: the +// profile is what `app.setName('Maka Dev')` already yields on the plain +// `npm run dev` path and what `npm run cli:dev` writes to, so scoping it here +// would only mean that turning MAKA_DEV_TCC on silently switched the +// developer's database. TCC isolation is provided by DEV_BUNDLE_ID, not by the +// data root. An explicit `--user-data-dir=` still takes precedence. +const DEV_USER_DATA_DIR = join(homedir(), 'Library', 'Application Support', 'Maka Dev'); /** * Per-worktree, and deliberately so. An ad-hoc signature designates a bare @@ -484,6 +485,9 @@ export function createRuntimeMarker(electronVersion) { electronVersion, bundleId: DEV_BUNDLE_ID, desktopDir: DESKTOP_DIR, + // Burned into the generated bootstrap, so a change here must invalidate + // the cached bundle (isDevelopmentRuntimeCurrent compares every field). + userDataDir: DEV_USER_DATA_DIR, }; }