You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/20 19:23:41 UTC

(maka) branch refactor/desktop-dev-shared-data created (now c17e155f4)

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a change to branch refactor/desktop-dev-shared-data
in repository https://gitbox.apache.org/repos/asf/maka.git


      at c17e155f4 refactor(desktop): share the dev userData profile across worktrees

This branch includes the following new commits:

     new c17e155f4 refactor(desktop): share the dev userData profile across worktrees

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


(maka) 01/01: refactor(desktop): share the dev userData profile across worktrees

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch refactor/desktop-dev-shared-data
in repository https://gitbox.apache.org/repos/asf/maka.git

commit c17e155f47d8ff5cae02cb20a41f5a9f91950b01
Author: AstroHan <le...@outlook.com>
AuthorDate: Fri Aug 21 03:23:21 2026 +0800

    refactor(desktop): share the dev userData profile across worktrees
    
    The macOS TCC dev build redirected userData to
    `~/Library/Application Support/Maka Dev-<worktreeHash>`, derived from the
    same WORKTREE_ID used for the TCC bundle identifier. That per-worktree
    data root was collateral of the TCC grant and diverged from every other
    dev entry point:
    
    - `npm run cli:dev` resolves to the `Maka Dev` profile
    - plain `npm run dev` (via app.setName("Maka Dev")) resolves to `Maka Dev`
    - only the TCC dev build (MAKA_DEV_TCC=1) wrote to `Maka Dev-<hash>`
    
    So enabling MAKA_DEV_TCC silently switched the developer's database, and
    the TCC dev host could not join the same runtime host as the repository
    CLI. Dev/release data isolation is provided by the `Maka Dev` profile
    (distinct from release `Maka`), not by the per-worktree hash: the hash
    must stay only on DEV_BUNDLE_ID, where macOS TCC keys its grants.
    
    Pointing the TCC dev bootstrap at the shared `Maka Dev` profile makes dev
    data layout mirror release data layout: single runtime host per profile,
    second-instance focuses the existing window, and the repository CLI and
    dev Desktop attach to the same host.
    
    Because the profile is burned into the generated bootstrap at build time,
    the chosen root is added to the runtime cache marker so existing
    worktrees rebuild instead of silently keeping the old hashed root.
    
    Generated-by: Maka (design via Codex and Claude consult)
---
 apps/desktop/README.md                   | 10 ++++++----
 apps/desktop/scripts/dev-app-runtime.mjs | 16 ++++++++++------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/apps/desktop/README.md b/apps/desktop/README.md
index ac980b5e8..db8924754 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-<worktree-id>`,
-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 2db7ddfc2..bacdd08c8 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,
   };
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org